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

Unified Diff: pkg/analyzer/lib/src/fasta/token_utils.dart

Issue 2799133003: enhance analyzer to parse uppercase and built-in/pseudo keywords (Closed)
Patch Set: Created 3 years, 8 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/analyzer/lib/src/fasta/token_utils.dart
diff --git a/pkg/analyzer/lib/src/fasta/token_utils.dart b/pkg/analyzer/lib/src/fasta/token_utils.dart
index 368a2de8f2bcbb6a3594df685b51e075b2e2e3ca..c4a474524f5566735917c817b67148da5ecaeff0 100644
--- a/pkg/analyzer/lib/src/fasta/token_utils.dart
+++ b/pkg/analyzer/lib/src/fasta/token_utils.dart
@@ -495,15 +495,6 @@ analyzer.Token toAnalyzerToken(Token token,
case KEYWORD_TOKEN:
KeywordToken keywordToken = token;
var syntax = keywordToken.keyword.syntax;
- if (keywordToken.keyword.isPseudo) {
- // TODO(paulberry,ahe): Fasta considers "deferred" be a "pseudo-keyword"
- // (ordinary identifier which has special meaning under circumstances),
- // but analyzer and the spec consider it to be a built-in identifier
- // (identifier which can't be used in type names).
- if (!identical(syntax, 'deferred')) {
- return makeStringToken(TokenType.IDENTIFIER);
- }
- }
// TODO(paulberry): if the map lookup proves to be too slow, consider
// using a switch statement, or perhaps a string of
// "if (identical(syntax, "foo"))" checks. (Note that identical checks
@@ -575,10 +566,13 @@ final _keywordMap = {
"void": analyzer.Keyword.VOID,
"while": analyzer.Keyword.WHILE,
"with": analyzer.Keyword.WITH,
+ //
"is": analyzer.Keyword.IS,
+ //
"abstract": analyzer.Keyword.ABSTRACT,
"as": analyzer.Keyword.AS,
"covariant": analyzer.Keyword.COVARIANT,
+ "deferred": analyzer.Keyword.DEFERRED,
"dynamic": analyzer.Keyword.DYNAMIC,
"export": analyzer.Keyword.EXPORT,
"external": analyzer.Keyword.EXTERNAL,
@@ -592,7 +586,19 @@ final _keywordMap = {
"set": analyzer.Keyword.SET,
"static": analyzer.Keyword.STATIC,
"typedef": analyzer.Keyword.TYPEDEF,
- "deferred": analyzer.Keyword.DEFERRED,
+ //
+ "async": analyzer.Keyword.ASYNC,
+ "await": analyzer.Keyword.AWAIT,
+ "Function": analyzer.Keyword.FUNCTION,
+ "hide": analyzer.Keyword.HIDE,
+ "native": analyzer.Keyword.NATIVE,
+ "of": analyzer.Keyword.OF,
+ "on": analyzer.Keyword.ON,
+ "patch": analyzer.Keyword.PATCH,
+ "show": analyzer.Keyword.SHOW,
+ "source": analyzer.Keyword.SOURCE,
+ "sync": analyzer.Keyword.SYNC,
+ "yield": analyzer.Keyword.YIELD,
};
TokenType getTokenType(Token token) {
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | pkg/analyzer/lib/src/generated/error_verifier.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698