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

Unified Diff: pkg/dart_scanner/lib/src/keyword.dart

Issue 2631503002: Modify scanner and parser to be standalone packages. (Closed)
Patch Set: Created 3 years, 11 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/dart_scanner/lib/src/keyword.dart
diff --git a/pkg/dart_scanner/lib/src/keyword.dart b/pkg/dart_scanner/lib/src/keyword.dart
index 4d914bccfb50ebf7844e8d87043ff90420b3587a..95d95955939beb38eaa99d93e9de6c49941fdc0f 100644
--- a/pkg/dart_scanner/lib/src/keyword.dart
+++ b/pkg/dart_scanner/lib/src/keyword.dart
@@ -2,12 +2,18 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library dart2js.tokens.keywords;
+library scanner.keywords;
-import '../util/characters.dart' as Characters show $a;
-import 'precedence.dart' show PrecedenceInfo;
-import 'precedence_constants.dart' as Precedence
- show AS_INFO, IS_INFO, KEYWORD_INFO;
+import 'characters.dart' show
+ $a;
+
+import 'precedence.dart' show
+ PrecedenceInfo;
+
+import 'precedence.dart' show
+ AS_INFO,
+ IS_INFO,
+ KEYWORD_INFO;
/**
* A keyword in the Dart programming language.
@@ -49,10 +55,10 @@ class Keyword {
// TODO(ahe): Don't think this is a reserved word.
// See: http://dartbug.com/5579
- const Keyword("is", info: Precedence.IS_INFO),
+ const Keyword("is", info: IS_INFO),
const Keyword("abstract", isBuiltIn: true),
- const Keyword("as", info: Precedence.AS_INFO, isBuiltIn: true),
+ const Keyword("as", info: AS_INFO, isBuiltIn: true),
const Keyword("dynamic", isBuiltIn: true),
const Keyword("export", isBuiltIn: true),
const Keyword("external", isBuiltIn: true),
@@ -96,7 +102,7 @@ class Keyword {
const Keyword(this.syntax,
{this.isPseudo: false,
this.isBuiltIn: false,
- this.info: Precedence.KEYWORD_INFO});
+ this.info: KEYWORD_INFO});
static Map<String, Keyword> computeKeywordMap() {
Map<String, Keyword> result = new Map<String, Keyword>();
@@ -146,8 +152,8 @@ abstract class KeywordState {
int c = strings[i].codeUnitAt(start);
if (chunk != c) {
if (chunkStart != -1) {
- assert(result[chunk - Characters.$a] == null);
- result[chunk - Characters.$a] = computeKeywordStateTable(
+ assert(result[chunk - $a] == null);
+ result[chunk - $a] = computeKeywordStateTable(
start + 1, strings, chunkStart, i - chunkStart);
}
chunkStart = i;
@@ -156,8 +162,8 @@ abstract class KeywordState {
}
}
if (chunkStart != -1) {
- assert(result[chunk - Characters.$a] == null);
- result[chunk - Characters.$a] = computeKeywordStateTable(
+ assert(result[chunk - $a] == null);
+ result[chunk - $a] = computeKeywordStateTable(
start + 1, strings, chunkStart, offset + length - chunkStart);
} else {
assert(length == 1);
@@ -180,7 +186,7 @@ class ArrayKeywordState extends KeywordState {
ArrayKeywordState(List<KeywordState> this.table, String syntax)
: super((syntax == null) ? null : Keyword.keywords[syntax]);
- KeywordState next(int c) => table[c - Characters.$a];
+ KeywordState next(int c) => table[c - $a];
String toString() {
StringBuffer sb = new StringBuffer();
@@ -193,7 +199,7 @@ class ArrayKeywordState extends KeywordState {
List<KeywordState> foo = table;
for (int i = 0; i < foo.length; i++) {
if (foo[i] != null) {
- sb.write("${new String.fromCharCodes([i + Characters.$a])}: "
+ sb.write("${new String.fromCharCodes([i + $a])}: "
"${foo[i]}; ");
}
}

Powered by Google App Engine
This is Rietveld 408576698