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 library dart2js.tokens.keywords; | 5 library dart2js.tokens.keywords; |
6 | 6 |
7 import '../util/characters.dart' as Characters show $a; | 7 import '../util/characters.dart' as Characters show $a; |
8 import 'precedence.dart' show PrecedenceInfo; | 8 import 'precedence.dart' show PrecedenceInfo; |
9 import 'precedence_constants.dart' as Precedence | 9 import 'precedence_constants.dart' as Precedence |
10 show AS_INFO, IS_INFO, KEYWORD_INFO; | 10 show AS_INFO, IS_INFO, KEYWORD_INFO; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const Keyword("void"), | 46 const Keyword("void"), |
47 const Keyword("while"), | 47 const Keyword("while"), |
48 const Keyword("with"), | 48 const Keyword("with"), |
49 | 49 |
50 // TODO(ahe): Don't think this is a reserved word. | 50 // TODO(ahe): Don't think this is a reserved word. |
51 // See: http://dartbug.com/5579 | 51 // See: http://dartbug.com/5579 |
52 const Keyword("is", info: Precedence.IS_INFO), | 52 const Keyword("is", info: Precedence.IS_INFO), |
53 | 53 |
54 const Keyword("abstract", isBuiltIn: true), | 54 const Keyword("abstract", isBuiltIn: true), |
55 const Keyword("as", info: Precedence.AS_INFO, isBuiltIn: true), | 55 const Keyword("as", info: Precedence.AS_INFO, isBuiltIn: true), |
| 56 const Keyword("covariant", isBuiltIn: true), |
56 const Keyword("dynamic", isBuiltIn: true), | 57 const Keyword("dynamic", isBuiltIn: true), |
57 const Keyword("export", isBuiltIn: true), | 58 const Keyword("export", isBuiltIn: true), |
58 const Keyword("external", isBuiltIn: true), | 59 const Keyword("external", isBuiltIn: true), |
59 const Keyword("factory", isBuiltIn: true), | 60 const Keyword("factory", isBuiltIn: true), |
60 const Keyword("get", isBuiltIn: true), | 61 const Keyword("get", isBuiltIn: true), |
61 const Keyword("implements", isBuiltIn: true), | 62 const Keyword("implements", isBuiltIn: true), |
62 const Keyword("import", isBuiltIn: true), | 63 const Keyword("import", isBuiltIn: true), |
63 const Keyword("library", isBuiltIn: true), | 64 const Keyword("library", isBuiltIn: true), |
64 const Keyword("operator", isBuiltIn: true), | 65 const Keyword("operator", isBuiltIn: true), |
65 const Keyword("part", isBuiltIn: true), | 66 const Keyword("part", isBuiltIn: true), |
66 const Keyword("set", isBuiltIn: true), | 67 const Keyword("set", isBuiltIn: true), |
67 const Keyword("static", isBuiltIn: true), | 68 const Keyword("static", isBuiltIn: true), |
68 const Keyword("typedef", isBuiltIn: true), | 69 const Keyword("typedef", isBuiltIn: true), |
69 | 70 |
70 const Keyword("hide", isPseudo: true), | 71 const Keyword("hide", isPseudo: true), |
71 const Keyword("native", isPseudo: true), | 72 const Keyword("native", isPseudo: true), |
72 const Keyword("of", isPseudo: true), | 73 const Keyword("of", isPseudo: true), |
73 const Keyword("on", isPseudo: true), | 74 const Keyword("on", isPseudo: true), |
74 const Keyword("show", isPseudo: true), | 75 const Keyword("show", isPseudo: true), |
75 const Keyword("source", isPseudo: true), | 76 const Keyword("source", isPseudo: true), |
76 const Keyword("deferred", isPseudo: true), | 77 const Keyword("deferred", isPseudo: true), |
77 const Keyword("async", isPseudo: true), | 78 const Keyword("async", isPseudo: true), |
78 const Keyword("sync", isPseudo: true), | 79 const Keyword("sync", isPseudo: true), |
79 const Keyword("await", isPseudo: true), | 80 const Keyword("await", isPseudo: true), |
80 const Keyword("yield", isPseudo: true) | 81 const Keyword("yield", isPseudo: true), |
81 ]; | 82 ]; |
82 | 83 |
83 final String syntax; | 84 final String syntax; |
84 final bool isPseudo; | 85 final bool isPseudo; |
85 final bool isBuiltIn; | 86 final bool isBuiltIn; |
86 final PrecedenceInfo info; | 87 final PrecedenceInfo info; |
87 | 88 |
88 static Map<String, Keyword> _keywords; | 89 static Map<String, Keyword> _keywords; |
89 static Map<String, Keyword> get keywords { | 90 static Map<String, Keyword> get keywords { |
90 if (_keywords == null) { | 91 if (_keywords == null) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 /** | 206 /** |
206 * A state that has no outgoing transitions. | 207 * A state that has no outgoing transitions. |
207 */ | 208 */ |
208 class LeafKeywordState extends KeywordState { | 209 class LeafKeywordState extends KeywordState { |
209 LeafKeywordState(String syntax) : super(Keyword.keywords[syntax]); | 210 LeafKeywordState(String syntax) : super(Keyword.keywords[syntax]); |
210 | 211 |
211 KeywordState next(int c) => null; | 212 KeywordState next(int c) => null; |
212 | 213 |
213 String toString() => keyword.syntax; | 214 String toString() => keyword.syntax; |
214 } | 215 } |
OLD | NEW |