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

Unified Diff: dart/lib/compiler/implementation/scanner/keyword.dart

Issue 10917170: Improve handling of built-in identifiers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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: dart/lib/compiler/implementation/scanner/keyword.dart
diff --git a/dart/lib/compiler/implementation/scanner/keyword.dart b/dart/lib/compiler/implementation/scanner/keyword.dart
index 87aeaf6fd520e97dde87a0cd95fe2be4a793b833..1d5319ba27dd3abefb7979aaa030bd2c74e31fe0 100644
--- a/dart/lib/compiler/implementation/scanner/keyword.dart
+++ b/dart/lib/compiler/implementation/scanner/keyword.dart
@@ -6,105 +6,64 @@
* A keyword in the Dart programming language.
*/
class Keyword implements SourceString {
- static const Keyword BREAK = const Keyword("break");
- static const Keyword CASE = const Keyword("case");
- static const Keyword CATCH = const Keyword("catch");
- static const Keyword CLASS = const Keyword("class");
- static const Keyword CONST = const Keyword("const");
- static const Keyword CONTINUE = const Keyword("continue");
- static const Keyword DEFAULT = const Keyword("default");
- static const Keyword DO = const Keyword("do");
- static const Keyword ELSE = const Keyword("else");
- static const Keyword EXTENDS = const Keyword("extends");
- static const Keyword FALSE = const Keyword("false");
- static const Keyword FINAL = const Keyword("final");
- static const Keyword FINALLY = const Keyword("finally");
- static const Keyword FOR = const Keyword("for");
- static const Keyword IF = const Keyword("if");
- static const Keyword IN = const Keyword("in");
- static const Keyword IS = const Keyword("is", info: IS_INFO);
- static const Keyword NEW = const Keyword("new");
- static const Keyword NULL = const Keyword("null");
- static const Keyword RETURN = const Keyword("return");
- static const Keyword SUPER = const Keyword("super");
- static const Keyword SWITCH = const Keyword("switch");
- static const Keyword THIS = const Keyword("this");
- static const Keyword THROW = const Keyword("throw");
- static const Keyword TRUE = const Keyword("true");
- static const Keyword TRY = const Keyword("try");
- static const Keyword VAR = const Keyword("var");
- static const Keyword VOID = const Keyword("void");
- static const Keyword WHILE = const Keyword("while");
-
- // Pseudo keywords:
- static const Keyword ABSTRACT = const Keyword("abstract", isPseudo: true);
- static const Keyword AS = const Keyword("as", info: AS_INFO, isPseudo: true);
- static const Keyword ASSERT = const Keyword("assert", isPseudo: true);
- static const Keyword EXTERNAL = const Keyword("external", isPseudo: true);
- static const Keyword FACTORY = const Keyword("factory", isPseudo: true);
- static const Keyword GET = const Keyword("get", isPseudo: true);
- static const Keyword IMPLEMENTS = const Keyword("implements", isPseudo: true);
- static const Keyword IMPORT = const Keyword("import", isPseudo: true);
- static const Keyword INTERFACE = const Keyword("interface", isPseudo: true);
- static const Keyword LIBRARY = const Keyword("library", isPseudo: true);
- static const Keyword NATIVE = const Keyword("native", isPseudo: true);
- static const Keyword OPERATOR = const Keyword("operator", isPseudo: true);
- static const Keyword ON = const Keyword("on", isPseudo: true);
- static const Keyword SET = const Keyword("set", isPseudo: true);
- static const Keyword SOURCE = const Keyword("source", isPseudo: true);
- static const Keyword STATIC = const Keyword("static", isPseudo: true);
- static const Keyword TYPEDEF = const Keyword("typedef", isPseudo: true);
-
static const List<Keyword> values = const <Keyword> [
- AS,
- BREAK,
- CASE,
- CATCH,
- CONST,
- CONTINUE,
- DEFAULT,
- DO,
- ELSE,
- FALSE,
- FINAL,
- FINALLY,
- FOR,
- IF,
- IN,
- IS,
- NEW,
- NULL,
- RETURN,
- SUPER,
- SWITCH,
- THIS,
- THROW,
- TRUE,
- TRY,
- VAR,
- VOID,
- WHILE,
- ABSTRACT,
- ASSERT,
- CLASS,
- EXTENDS,
- EXTERNAL,
- FACTORY,
- GET,
- IMPLEMENTS,
- IMPORT,
- INTERFACE,
- LIBRARY,
- NATIVE,
- OPERATOR,
- ON,
- SET,
- SOURCE,
- STATIC,
- TYPEDEF ];
+ const Keyword("break"),
+ const Keyword("case"),
+ const Keyword("catch"),
+ const Keyword("class"),
+ const Keyword("const"),
+ const Keyword("continue"),
+ const Keyword("default"),
+ const Keyword("do"),
+ const Keyword("else"),
+ const Keyword("extends"),
+ const Keyword("false"),
+ const Keyword("final"),
+ const Keyword("finally"),
+ const Keyword("for"),
+ const Keyword("if"),
+ const Keyword("in"),
+ const Keyword("is", info: IS_INFO),
+ const Keyword("new"),
+ const Keyword("null"),
+ const Keyword("return"),
+ const Keyword("super"),
+ const Keyword("switch"),
+ const Keyword("this"),
+ const Keyword("throw"),
+ const Keyword("true"),
+ const Keyword("try"),
+ const Keyword("var"),
+ const Keyword("void"),
+ const Keyword("while"),
+
+ const Keyword("abstract", isBuiltIn: true),
+ const Keyword("as", info: AS_INFO, isBuiltIn: true),
+ const Keyword("assert", isBuiltIn: true),
+ const Keyword("external", isBuiltIn: true),
+ const Keyword("factory", isBuiltIn: true),
+ const Keyword("get", isBuiltIn: true),
+ const Keyword("implements", isBuiltIn: true),
+ const Keyword("interface", isBuiltIn: true),
+ const Keyword("operator", isBuiltIn: true),
+ const Keyword("set", isBuiltIn: true),
+ const Keyword("static", isBuiltIn: true),
+ const Keyword("typedef", isBuiltIn: true),
+
+ const Keyword("hide", isPseudo: true),
+ const Keyword("import", isPseudo: true),
+ const Keyword("library", isPseudo: true),
+ const Keyword("native", isPseudo: true),
+ const Keyword("on", isPseudo: true),
+ const Keyword("part", isPseudo: true),
+ const Keyword("show", isPseudo: true),
+ const Keyword("source", isPseudo: true) ];
+
+ static const DYNAMIC = const Keyword("Dynamic", isBuiltIn: true);
final String syntax;
final bool isPseudo;
+ final bool isBuiltIn;
final PrecedenceInfo info;
static Map<String, Keyword> _keywords;
@@ -117,6 +76,7 @@ class Keyword implements SourceString {
const Keyword(String this.syntax,
[bool this.isPseudo = false,
+ bool this.isBuiltIn = false,
PrecedenceInfo this.info = KEYWORD_INFO]);
static Map<String, Keyword> computeKeywordMap() {

Powered by Google App Engine
This is Rietveld 408576698