OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * A keyword in the Dart programming language. | 6 * A keyword in the Dart programming language. |
7 */ | 7 */ |
8 class Keyword implements SourceString { | 8 class Keyword implements SourceString { |
9 static const Keyword BREAK = const Keyword("break"); | 9 static const Keyword BREAK = const Keyword("break"); |
10 static const Keyword CASE = const Keyword("case"); | 10 static const Keyword CASE = const Keyword("case"); |
(...skipping 18 matching lines...) Expand all Loading... | |
29 static const Keyword SUPER = const Keyword("super"); | 29 static const Keyword SUPER = const Keyword("super"); |
30 static const Keyword SWITCH = const Keyword("switch"); | 30 static const Keyword SWITCH = const Keyword("switch"); |
31 static const Keyword THIS = const Keyword("this"); | 31 static const Keyword THIS = const Keyword("this"); |
32 static const Keyword THROW = const Keyword("throw"); | 32 static const Keyword THROW = const Keyword("throw"); |
33 static const Keyword TRUE = const Keyword("true"); | 33 static const Keyword TRUE = const Keyword("true"); |
34 static const Keyword TRY = const Keyword("try"); | 34 static const Keyword TRY = const Keyword("try"); |
35 static const Keyword VAR = const Keyword("var"); | 35 static const Keyword VAR = const Keyword("var"); |
36 static const Keyword VOID = const Keyword("void"); | 36 static const Keyword VOID = const Keyword("void"); |
37 static const Keyword WHILE = const Keyword("while"); | 37 static const Keyword WHILE = const Keyword("while"); |
38 | 38 |
39 // Pseudo keywords: | 39 // Built-in identifiers. |
ahe
2012/09/06 22:25:53
I still don't understand why you have modified thi
Lasse Reichstein Nielsen
2012/09/07 10:18:57
Sure.
The modification was only for my own ease-of
| |
40 static const Keyword ABSTRACT = const Keyword("abstract", isPseudo: true); | 40 static const Keyword ABSTRACT = const Keyword("abstract", isPseudo: true); |
41 static const Keyword AS = const Keyword("as", info: AS_INFO, isPseudo: true); | 41 static const Keyword AS = const Keyword("as", info: AS_INFO, isPseudo: true); |
42 static const Keyword ASSERT = const Keyword("assert", isPseudo: true); | 42 static const Keyword ASSERT = const Keyword("assert", isPseudo: true); |
43 // And "Dynamic". | |
43 static const Keyword EXTERNAL = const Keyword("external", isPseudo: true); | 44 static const Keyword EXTERNAL = const Keyword("external", isPseudo: true); |
44 static const Keyword FACTORY = const Keyword("factory", isPseudo: true); | 45 static const Keyword FACTORY = const Keyword("factory", isPseudo: true); |
45 static const Keyword GET = const Keyword("get", isPseudo: true); | 46 static const Keyword GET = const Keyword("get", isPseudo: true); |
46 static const Keyword IMPLEMENTS = const Keyword("implements", isPseudo: true); | 47 static const Keyword IMPLEMENTS = const Keyword("implements", isPseudo: true); |
48 static const Keyword OPERATOR = const Keyword("operator", isPseudo: true); | |
49 static const Keyword SET = const Keyword("set", isPseudo: true); | |
50 static const Keyword STATIC = const Keyword("static", isPseudo: true); | |
51 static const Keyword TYPEDEF = const Keyword("typedef", isPseudo: true); | |
52 | |
53 // Pseudo keywords: | |
47 static const Keyword IMPORT = const Keyword("import", isPseudo: true); | 54 static const Keyword IMPORT = const Keyword("import", isPseudo: true); |
48 static const Keyword INTERFACE = const Keyword("interface", isPseudo: true); | 55 static const Keyword INTERFACE = const Keyword("interface", isPseudo: true); |
49 static const Keyword LIBRARY = const Keyword("library", isPseudo: true); | 56 static const Keyword LIBRARY = const Keyword("library", isPseudo: true); |
50 static const Keyword NATIVE = const Keyword("native", isPseudo: true); | 57 static const Keyword NATIVE = const Keyword("native", isPseudo: true); |
51 static const Keyword OPERATOR = const Keyword("operator", isPseudo: true); | |
52 static const Keyword ON = const Keyword("on", isPseudo: true); | 58 static const Keyword ON = const Keyword("on", isPseudo: true); |
53 static const Keyword SET = const Keyword("set", isPseudo: true); | |
54 static const Keyword SOURCE = const Keyword("source", isPseudo: true); | 59 static const Keyword SOURCE = const Keyword("source", isPseudo: true); |
55 static const Keyword STATIC = const Keyword("static", isPseudo: true); | |
56 static const Keyword TYPEDEF = const Keyword("typedef", isPseudo: true); | |
57 | 60 |
58 static const List<Keyword> values = const <Keyword> [ | 61 static const List<Keyword> values = const <Keyword> [ |
59 AS, | 62 AS, |
60 BREAK, | 63 BREAK, |
61 CASE, | 64 CASE, |
62 CATCH, | 65 CATCH, |
63 CONST, | 66 CONST, |
64 CONTINUE, | 67 CONTINUE, |
65 DEFAULT, | 68 DEFAULT, |
66 DO, | 69 DO, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 final Keyword keyword; | 258 final Keyword keyword; |
256 | 259 |
257 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; | 260 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; |
258 | 261 |
259 bool isLeaf() => true; | 262 bool isLeaf() => true; |
260 | 263 |
261 KeywordState next(int c) => null; | 264 KeywordState next(int c) => null; |
262 | 265 |
263 String toString() => keyword.syntax; | 266 String toString() => keyword.syntax; |
264 } | 267 } |
OLD | NEW |