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

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

Issue 2794653002: fasta tokens implement analyzer token API (Closed)
Patch Set: 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
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 34c308c255bb37435e990581ae21f13c0a45c1dd..7959eae728d64182ec49221a48a4de02316f4bcf 100644
--- a/pkg/front_end/lib/src/scanner/token.dart
+++ b/pkg/front_end/lib/src/scanner/token.dart
@@ -600,6 +600,38 @@ class StringTokenWithComment extends StringToken implements TokenWithComment {
}
/**
+ * A synthetic keyword token.
+ */
+class SyntheticKeywordToken extends KeywordToken {
+ /**
+ * Initialize a newly created token to represent the given [keyword] at the
+ * given [offset].
+ */
+ SyntheticKeywordToken(Keyword keyword, int offset) : super(keyword, offset);
+
+ @override
+ int get length => 0;
+
+ @override
+ Token copy() => new SyntheticKeywordToken(keyword, offset);
+}
+
+/**
+ * A token whose value is independent of it's type.
+ */
+class SyntheticStringToken extends StringToken {
+ /**
+ * Initialize a newly created token to represent a token of the given [type]
+ * with the given [value] at the given [offset].
+ */
+ SyntheticStringToken(TokenType type, String value, int offset)
+ : super(type, value, offset);
+
+ @override
+ bool get isSynthetic => true;
+}
+
+/**
* A token that was scanned from the input. Each token knows which tokens
* precede and follow it, acting as a link in a doubly linked list of tokens.
*

Powered by Google App Engine
This is Rietveld 408576698