Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: pkg/front_end/lib/src/fasta/scanner/token.dart

Issue 2767083002: fasta scanner recovery and error code translation improvements (Closed)
Patch Set: revert address comments and fix for token_stream_rewriter test Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/recover.dart ('k') | pkg/front_end/lib/src/scanner/errors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/scanner/token.dart
diff --git a/pkg/front_end/lib/src/fasta/scanner/token.dart b/pkg/front_end/lib/src/fasta/scanner/token.dart
index 35067a2e04cce24eb47ab156400ef5d2820181a5..a380e48250348246fc5fa8e3e4407f0e68a7baf0 100644
--- a/pkg/front_end/lib/src/fasta/scanner/token.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/token.dart
@@ -16,8 +16,6 @@ import 'precedence.dart'
IDENTIFIER_INFO,
IS_INFO,
KEYWORD_INFO,
- MULTI_LINE_COMMENT_INFO,
- SINGLE_LINE_COMMENT_INFO,
PrecedenceInfo;
import 'token_constants.dart' show IDENTIFIER_TOKEN;
@@ -258,13 +256,21 @@ class SymbolToken extends Token {
SymbolToken(this.info, int charOffset) : super(charOffset);
+ SymbolToken.eof(int charOffset)
+ : info = EOF_INFO,
+ super(charOffset) {
+ // EOF points to itself so there's always infinite look-ahead.
+ previousToken = this;
+ next = this;
+ }
+
String get lexeme => info.value;
String get stringValue => info.value;
bool isIdentifier() => false;
- String toString() => "SymbolToken($lexeme)";
+ String toString() => "SymbolToken(${info == EOF_INFO ? '-eof-' : lexeme})";
bool get isEof => info == EOF_INFO;
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/recover.dart ('k') | pkg/front_end/lib/src/scanner/errors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698