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..6e3ffae8557e3cdeb94d4c20770ab43bc976f1b6 100644 |
--- a/pkg/front_end/lib/src/fasta/scanner/token.dart |
+++ b/pkg/front_end/lib/src/fasta/scanner/token.dart |
@@ -6,6 +6,8 @@ library fasta.scanner.token; |
import '../../scanner/token.dart' as analyzer; |
+import '../errors.dart' show internalError; |
+ |
import 'keyword.dart' show Keyword; |
import 'precedence.dart' |
@@ -16,8 +18,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 +258,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; |
@@ -490,13 +498,13 @@ class CommentToken extends StringToken implements analyzer.CommentToken { |
@override |
void set parent(analyzer.TokenWithComment ignored) { |
- throw 'unsupported operation'; |
+ internalError('Internal error: unsupported operation'); |
} |
@override |
void remove() { |
- // TODO: implement remove |
- throw 'not implemented yet'; |
+ // TODO(danrubel): implement remove |
+ internalError('Internal error: not implemented yet'); |
} |
} |