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

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

Issue 2890523002: merge fasta.Token into analyzer.Token (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/scanner/token.dart
diff --git a/pkg/front_end/lib/src/scanner/token.dart b/pkg/front_end/lib/src/scanner/token.dart
index ca3ea2b47d982f0e80fbc336c4c8349fe4cbfb53..aa2a041bb3f0bc26adbed0db4231af7178df6cda 100644
--- a/pkg/front_end/lib/src/scanner/token.dart
+++ b/pkg/front_end/lib/src/scanner/token.dart
@@ -372,6 +372,7 @@ class Keyword extends TokenType {
/**
* A flag indicating whether the keyword is "built-in" identifier.
*/
+ @override
final bool isBuiltIn;
@override
@@ -446,8 +447,6 @@ class KeywordToken extends SimpleToken {
bool get isIdentifier => keyword.isPseudo || keyword.isBuiltIn;
@override
- // Changed return type from Keyword to Object because
- // fasta considers pseudo-keywords to be keywords rather than identifiers
Object value() => keyword;
}
@@ -606,7 +605,7 @@ class SimpleToken implements Token {
String toString() => lexeme;
@override
- Object value() => type.lexeme;
+ Object value() => lexeme;
/**
* Sets the `parent` property to `this` for the given [comment] and all the
@@ -892,6 +891,17 @@ abstract class Token implements SyntacticEntity {
Token setNextWithoutSettingPrevious(Token token);
/**
+ * Returns a textual representation of this token to be used for debugging
+ * purposes. The resulting string might contain information about the
+ * structure of the token, for example 'StringToken(foo)' for the identifier
+ * token 'foo'.
+ *
+ * Use [lexeme] for the text actually parsed by the token.
+ */
+ @override
+ String toString();
+
+ /**
* Return the value of this token. For keyword tokens, this is the keyword
* associated with the token, for other tokens it is the lexeme associated
* with the token.
@@ -1530,6 +1540,11 @@ class TokenType {
this == TokenType.STAR;
/**
+ * A flag indicating whether the keyword is a "built-in" identifier.
+ */
+ bool get isBuiltIn => false;
+
+ /**
* Return `true` if this type of token represents an equality operator.
*/
bool get isEqualityOperator =>
« no previous file with comments | « pkg/front_end/lib/src/scanner/errors.dart ('k') | pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698