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

Unified Diff: pkg/compiler/lib/src/tokens/keyword.dart

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/compiler/lib/src/string_validator.dart ('k') | pkg/compiler/lib/src/tokens/precedence.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/tokens/keyword.dart
diff --git a/pkg/compiler/lib/src/tokens/keyword.dart b/pkg/compiler/lib/src/tokens/keyword.dart
index ce1bc87c9900aaf197e06742b1856c3b53f2283e..ad22ee6d8f883eba93f0394aee2293673ee4f968 100644
--- a/pkg/compiler/lib/src/tokens/keyword.dart
+++ b/pkg/compiler/lib/src/tokens/keyword.dart
@@ -4,85 +4,82 @@
library dart2js.tokens.keywords;
-import '../util/characters.dart' as Characters show
- $a;
+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 'precedence.dart' show PrecedenceInfo;
+import 'precedence_constants.dart' as Precedence
+ show AS_INFO, IS_INFO, KEYWORD_INFO;
/**
* A keyword in the Dart programming language.
*/
class Keyword {
- static const List<Keyword> values = const <Keyword> [
- const Keyword("assert"),
- 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("enum"),
- const Keyword("extends"),
- const Keyword("false"),
- const Keyword("final"),
- const Keyword("finally"),
- const Keyword("for"),
- const Keyword("if"),
- const Keyword("in"),
- const Keyword("new"),
- const Keyword("null"),
- const Keyword("rethrow"),
- 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("with"),
-
- // TODO(ahe): Don't think this is a reserved word.
- // See: http://dartbug.com/5579
- const Keyword("is", info: Precedence.IS_INFO),
-
- const Keyword("abstract", isBuiltIn: true),
- const Keyword("as", info: Precedence.AS_INFO, isBuiltIn: true),
- const Keyword("dynamic", isBuiltIn: true),
- const Keyword("export", isBuiltIn: true),
- const Keyword("external", isBuiltIn: true),
- const Keyword("factory", isBuiltIn: true),
- const Keyword("get", isBuiltIn: true),
- const Keyword("implements", isBuiltIn: true),
- const Keyword("import", isBuiltIn: true),
- const Keyword("library", isBuiltIn: true),
- const Keyword("operator", isBuiltIn: true),
- const Keyword("part", isBuiltIn: true),
- const Keyword("set", isBuiltIn: true),
- const Keyword("static", isBuiltIn: true),
- const Keyword("typedef", isBuiltIn: true),
-
- const Keyword("hide", isPseudo: true),
- const Keyword("native", isPseudo: true),
- const Keyword("of", isPseudo: true),
- const Keyword("on", isPseudo: true),
- const Keyword("show", isPseudo: true),
- const Keyword("source", isPseudo: true),
- const Keyword("deferred", isPseudo: true),
- const Keyword("async", isPseudo: true),
- const Keyword("sync", isPseudo: true),
- const Keyword("await", isPseudo: true),
- const Keyword("yield", isPseudo: true)];
+ static const List<Keyword> values = const <Keyword>[
+ const Keyword("assert"),
+ 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("enum"),
+ const Keyword("extends"),
+ const Keyword("false"),
+ const Keyword("final"),
+ const Keyword("finally"),
+ const Keyword("for"),
+ const Keyword("if"),
+ const Keyword("in"),
+ const Keyword("new"),
+ const Keyword("null"),
+ const Keyword("rethrow"),
+ 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("with"),
+
+ // TODO(ahe): Don't think this is a reserved word.
+ // See: http://dartbug.com/5579
+ const Keyword("is", info: Precedence.IS_INFO),
+
+ const Keyword("abstract", isBuiltIn: true),
+ const Keyword("as", info: Precedence.AS_INFO, isBuiltIn: true),
+ const Keyword("dynamic", isBuiltIn: true),
+ const Keyword("export", isBuiltIn: true),
+ const Keyword("external", isBuiltIn: true),
+ const Keyword("factory", isBuiltIn: true),
+ const Keyword("get", isBuiltIn: true),
+ const Keyword("implements", isBuiltIn: true),
+ const Keyword("import", isBuiltIn: true),
+ const Keyword("library", isBuiltIn: true),
+ const Keyword("operator", isBuiltIn: true),
+ const Keyword("part", isBuiltIn: true),
+ const Keyword("set", isBuiltIn: true),
+ const Keyword("static", isBuiltIn: true),
+ const Keyword("typedef", isBuiltIn: true),
+
+ const Keyword("hide", isPseudo: true),
+ const Keyword("native", isPseudo: true),
+ const Keyword("of", isPseudo: true),
+ const Keyword("on", isPseudo: true),
+ const Keyword("show", isPseudo: true),
+ const Keyword("source", isPseudo: true),
+ const Keyword("deferred", isPseudo: true),
+ const Keyword("async", isPseudo: true),
+ const Keyword("sync", isPseudo: true),
+ const Keyword("await", isPseudo: true),
+ const Keyword("yield", isPseudo: true)
+ ];
final String syntax;
final bool isPseudo;
@@ -98,9 +95,9 @@ class Keyword {
}
const Keyword(this.syntax,
- {this.isPseudo: false,
- this.isBuiltIn: false,
- this.info: Precedence.KEYWORD_INFO});
+ {this.isPseudo: false,
+ this.isBuiltIn: false,
+ this.info: Precedence.KEYWORD_INFO});
static Map<String, Keyword> computeKeywordMap() {
Map<String, Keyword> result = new Map<String, Keyword>();
@@ -125,19 +122,18 @@ abstract class KeywordState {
static KeywordState _KEYWORD_STATE;
static KeywordState get KEYWORD_STATE {
if (_KEYWORD_STATE == null) {
- List<String> strings =
- new List<String>(Keyword.values.length);
+ List<String> strings = new List<String>(Keyword.values.length);
for (int i = 0; i < Keyword.values.length; i++) {
strings[i] = Keyword.values[i].syntax;
}
- strings.sort((a,b) => a.compareTo(b));
+ strings.sort((a, b) => a.compareTo(b));
_KEYWORD_STATE = computeKeywordStateTable(0, strings, 0, strings.length);
}
return _KEYWORD_STATE;
}
- static KeywordState computeKeywordStateTable(int start, List<String> strings,
- int offset, int length) {
+ static KeywordState computeKeywordStateTable(
+ int start, List<String> strings, int offset, int length) {
List<KeywordState> result = new List<KeywordState>(26);
assert(length != 0);
int chunk = 0;
@@ -152,9 +148,8 @@ abstract class KeywordState {
if (chunk != c) {
if (chunkStart != -1) {
assert(result[chunk - Characters.$a] == null);
- result[chunk - Characters.$a] =
- computeKeywordStateTable(
- start + 1, strings, chunkStart, i - chunkStart);
+ result[chunk - Characters.$a] = computeKeywordStateTable(
+ start + 1, strings, chunkStart, i - chunkStart);
}
chunkStart = i;
chunk = c;
@@ -163,9 +158,8 @@ abstract class KeywordState {
}
if (chunkStart != -1) {
assert(result[chunk - Characters.$a] == null);
- result[chunk - Characters.$a] =
- computeKeywordStateTable(start + 1, strings, chunkStart,
- offset + length - chunkStart);
+ result[chunk - Characters.$a] = computeKeywordStateTable(
+ start + 1, strings, chunkStart, offset + length - chunkStart);
} else {
assert(length == 1);
return new LeafKeywordState(strings[offset]);
@@ -185,7 +179,7 @@ class ArrayKeywordState extends KeywordState {
final List<KeywordState> table;
ArrayKeywordState(List<KeywordState> this.table, String syntax)
- : super((syntax == null) ? null : Keyword.keywords[syntax]);
+ : super((syntax == null) ? null : Keyword.keywords[syntax]);
KeywordState next(int c) => table[c - Characters.$a];
@@ -201,7 +195,7 @@ class ArrayKeywordState extends KeywordState {
for (int i = 0; i < foo.length; i++) {
if (foo[i] != null) {
sb.write("${new String.fromCharCodes([i + Characters.$a])}: "
- "${foo[i]}; ");
+ "${foo[i]}; ");
}
}
sb.write("]");
« no previous file with comments | « pkg/compiler/lib/src/string_validator.dart ('k') | pkg/compiler/lib/src/tokens/precedence.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698