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

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

Issue 2899043006: cleanup fasta token classes (Closed)
Patch Set: Created 3 years, 7 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
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 6cb01c8433b5a4a0cb63ec2d55fc6c7d1fd5c4c0..3ab4c0cd7a1f4446782e5b981a4b816879b9d7ad 100644
--- a/pkg/front_end/lib/src/fasta/scanner/token.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/token.dart
@@ -12,83 +12,6 @@ import 'token_constants.dart' show IDENTIFIER_TOKEN;
import 'string_canonicalizer.dart';
/**
- * A [SymbolToken] represents the symbol in its precedence info.
- * Also used for end of file with EOF_INFO.
- */
-class SymbolToken extends analyzer.TokenWithComment {
- SymbolToken(TokenType type, int offset,
- [analyzer.CommentToken precedingComments])
- : super(type, offset, precedingComments);
-
- factory SymbolToken.eof(int charOffset,
- [analyzer.CommentToken precedingComments]) {
- var eof =
- new SyntheticSymbolToken(TokenType.EOF, charOffset, precedingComments);
- // EOF points to itself so there's always infinite look-ahead.
- eof.previous = eof;
- eof.next = eof;
- return eof;
- }
-
- @override
- String get lexeme => type.value;
-
- @override
- String toString() => "SymbolToken(${isEof ? '-eof-' : lexeme})";
-
- @override
- Token copy() => isEof
- ? new SymbolToken.eof(charOffset, precedingComments)
- : new SymbolToken(type, charOffset, precedingComments);
-}
-
-/**
- * A [SyntheticSymbolToken] represents the symbol in its precedence info
- * which does not exist in the original source.
- * For example, if the scanner finds '(' missing a ')'
- * then it will insert an synthetic ')'.
- */
-class SyntheticSymbolToken extends SymbolToken {
- SyntheticSymbolToken(TokenType type, int charOffset,
- [analyzer.CommentToken precedingComments])
- : super(type, charOffset, precedingComments);
-
- @override
- int get length => 0;
-
- @override
- Token copy() => isEof
- ? new SymbolToken.eof(charOffset, precedingComments)
- : new SyntheticSymbolToken(type, charOffset, precedingComments);
-}
-
-/**
- * A [BeginGroupToken] represents a symbol that may be the beginning of
- * a pair of brackets, i.e., ( { [ < or ${
- * The [endGroup] token points to the matching closing bracket in case
- * it can be identified during scanning.
- */
-class BeginGroupToken extends SymbolToken
- implements analyzer.BeginTokenWithComment {
- Token endGroup;
-
- BeginGroupToken(TokenType type, int charOffset,
- [analyzer.CommentToken precedingComments])
- : super(type, charOffset, precedingComments);
-
- @override
- analyzer.Token get endToken => endGroup;
-
- @override
- void set endToken(analyzer.Token token) {
- endGroup = token;
- }
-
- @override
- Token copy() => new BeginGroupToken(type, charOffset, precedingComments);
-}
-
-/**
* A String-valued token. Represents identifiers, string literals,
* number literals, comments, and error tokens, using the corresponding
* precedence info.
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/recover.dart ('k') | pkg/front_end/lib/src/fasta/source/diet_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698