File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/antlr Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,10 @@ tokens { INDENT, DEDENT }
57
57
58
58
@Override
59
59
public Token nextToken() {
60
+ Token next = super.nextToken();
61
+
60
62
// Check if the end-of-file is ahead to insert any missing DEDENTS and a NEWLINE.
61
- if (_input.LA( 1 ) == EOF && !expandedEOF) {
63
+ if (next.getType( ) == EOF && !expandedEOF) {
62
64
expandedEOF = true ;
63
65
64
66
// Remove any trailing EOF tokens from our buffer.
@@ -78,10 +80,10 @@ tokens { INDENT, DEDENT }
78
80
}
79
81
80
82
// Put the EOF back on the token stream.
81
- this.emit(commonToken(Python3Parser.EOF , " <EOF>" ));
82
- }
83
+ this.emit(next);
83
84
84
- Token next = super.nextToken();
85
+ next = super.nextToken();
86
+ }
85
87
86
88
if (next.getChannel() == Token.DEFAULT_CHANNEL ) {
87
89
// Keep track of the last token on the default channel.
Original file line number Diff line number Diff line change @@ -175,8 +175,10 @@ public void emit(Token t) {
175
175
176
176
@ Override
177
177
public Token nextToken () {
178
+ Token next = super .nextToken ();
179
+
178
180
// Check if the end-of-file is ahead to insert any missing DEDENTS and a NEWLINE.
179
- if (_input . LA ( 1 ) == EOF && !expandedEOF ) {
181
+ if (next . getType ( ) == EOF && !expandedEOF ) {
180
182
expandedEOF = true ;
181
183
182
184
// Remove any trailing EOF tokens from our buffer.
@@ -196,10 +198,10 @@ public Token nextToken() {
196
198
}
197
199
198
200
// Put the EOF back on the token stream.
199
- this .emit (commonToken (Python3Parser .EOF , "<EOF>" ));
200
- }
201
+ this .emit (next );
201
202
202
- Token next = super .nextToken ();
203
+ next = super .nextToken ();
204
+ }
203
205
204
206
if (next .getChannel () == Token .DEFAULT_CHANNEL ) {
205
207
// Keep track of the last token on the default channel.
You can’t perform that action at this time.
0 commit comments