graalvm / simplelanguage

A simple example language built using the Truffle API.

Home Page:http://openjdk.java.net/projects/graal/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SLParseError.getSourceLocation() raises IllegalArgumentException

numberpi opened this issue · comments

Parsing the erroneous code snippet
function main
in SL causes an internal error when calling SLParseError.getSourceLocation().

java.lang.IllegalArgumentException: column out of range
	at com.oracle.truffle.api.source.Source.createSection(Source.java:592)
	at com.oracle.truffle.sl.parser.SLParseError.getSourceLocation(SLParseError.java:67)
        ...

Caused because offending symbol is EOF and charPositionInLine + 1 is 14:

throw new SLParseError(source, line, charPositionInLine + 1, offendingSymbol == null ? 1 : ((Token) offendingSymbol).getText().length(), "Error(s) parsing script:\n" + location + msg);

sorry, duplicate of #40 ... opened by myself -.-