File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/antlr Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,10 @@ private static PIncompleteSourceException handleRecognitionException(IntervalSet
170
170
}
171
171
}
172
172
173
+ if (tokenId == Python3Parser .NEWLINE && (et .contains (Python3Parser .FINALLY ) || et .contains (Python3Parser .EXCEPT ))) {
174
+ return new PIncompleteSourceException ("" , null , -1 );
175
+ }
176
+
173
177
if ((tokenId != Python3Parser .INDENT_ERROR && tokenId != Python3Parser .TAB_ERROR && tokenId != Python3Parser .INDENT && tokenId != Python3Parser .DEDENT ) &&
174
178
(et .contains (Python3Parser .INDENT ) || et .contains (Python3Parser .NEWLINE ) && et .size () == 1 )) {
175
179
return new PIncompleteSourceException (message , cause , line );
@@ -186,6 +190,12 @@ private static PIncompleteSourceException handleInteractiveException(Recognizer<
186
190
if (tokenId == Python3Parser .LONG_QUOTES1 || tokenId == Python3Parser .LONG_QUOTES2 ) {
187
191
return new PIncompleteSourceException ("" , null , -1 );
188
192
}
193
+ if (tokenId == Python3Parser .UNKNOWN_CHAR ) {
194
+ String text = token .getText ();
195
+ if (text .startsWith ("\' " ) || text .startsWith ("\" " )) {
196
+ return new PIncompleteSourceException ("" , null , -1 );
197
+ }
198
+ }
189
199
if (isOpened (((Python3Parser ) recognizer ).getTokenStream ())) {
190
200
// The assumption is:
191
201
// Look ahead and if there are other tokens (except new lines and EOF),
You can’t perform that action at this time.
0 commit comments