Skip to content

Commit 8ae5351

Browse files
committed
fix oob in syntax error
1 parent 0150deb commit 8ae5351

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/PythonErrorStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static SourceSection getPosition(Source source, Exception e) {
7373
}
7474
}
7575
Token token = r.getOffendingToken();
76-
return source.createSection(token.getStartIndex(), token.getStopIndex() - token.getStartIndex());
76+
return source.createSection(token.getStartIndex(), Math.max(0, token.getStopIndex() - token.getStartIndex()));
7777
}
7878

7979
private static String getTokeLineText(Parser recognizer, Token token) {

0 commit comments

Comments
 (0)