Skip to content

Commit 11eac89

Browse files
numberpicosminbasca
authored andcommitted
Fix handling of RecognitionExceptions to get line and column of syntax errors
1 parent 7505328 commit 11eac89

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ private static ParserRuleContext preParseWithAntlr(PythonCore core, Source sourc
9191
Token token = ((RecognitionException) e).getOffendingToken();
9292
line = token.getLine();
9393
column = token.getCharPositionInLine();
94-
} else if (e.getCause() instanceof NoViableAltException) {
95-
Token token = ((NoViableAltException) e.getCause()).getOffendingToken();
94+
} else if (e.getCause() instanceof RecognitionException) {
95+
Token token = ((RecognitionException) e.getCause()).getOffendingToken();
9696
line = token.getLine();
9797
column = token.getCharPositionInLine();
9898
} else {

0 commit comments

Comments
 (0)