Skip to content

Commit 02596cc

Browse files
committed
Fix offset for break/continue syntax errors
1 parent f6d3903 commit 02596cc

File tree

1 file changed

+2
-2
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/antlr

1 file changed

+2
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/antlr/Python3.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,15 +768,15 @@ flow_stmt
768768
b='break'
769769
{
770770
if (loopState == null) {
771-
throw new PythonRecognitionException("'break' outside loop", this, _input, _localctx, getCurrentToken());
771+
throw new PythonRecognitionException("'break' outside loop", this, _input, _localctx, $b);
772772
}
773773
push(new SimpleSSTNode(SimpleSSTNode.Type.BREAK, getStartIndex($b), getStopIndex($b)));
774774
loopState.containsBreak = true;
775775
}
776776
| c='continue'
777777
{
778778
if (loopState == null) {
779-
throw new PythonRecognitionException("'continue' not properly in loop", this, _input, _localctx, getCurrentToken());
779+
throw new PythonRecognitionException("'continue' not properly in loop", this, _input, _localctx, $c);
780780
}
781781
push(new SimpleSSTNode(SimpleSSTNode.Type.CONTINUE, getStartIndex($c), getStopIndex($c)));
782782
loopState.containsContinue = true;

0 commit comments

Comments
 (0)