| 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 List<Keyword> values = const <Keyword> [ | 9 static const List<Keyword> values = const <Keyword> [ |
| 10 const Keyword("break"), | 10 const Keyword("break"), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const Keyword("throw"), | 33 const Keyword("throw"), |
| 34 const Keyword("true"), | 34 const Keyword("true"), |
| 35 const Keyword("try"), | 35 const Keyword("try"), |
| 36 const Keyword("var"), | 36 const Keyword("var"), |
| 37 const Keyword("void"), | 37 const Keyword("void"), |
| 38 const Keyword("while"), | 38 const Keyword("while"), |
| 39 | 39 |
| 40 const Keyword("abstract", isBuiltIn: true), | 40 const Keyword("abstract", isBuiltIn: true), |
| 41 const Keyword("as", info: AS_INFO, isBuiltIn: true), | 41 const Keyword("as", info: AS_INFO, isBuiltIn: true), |
| 42 const Keyword("assert", isBuiltIn: true), | 42 const Keyword("assert", isBuiltIn: true), |
| 43 const Keyword("dynamic", isBuiltIn: true), |
| 43 const Keyword("external", isBuiltIn: true), | 44 const Keyword("external", isBuiltIn: true), |
| 44 const Keyword("factory", isBuiltIn: true), | 45 const Keyword("factory", isBuiltIn: true), |
| 45 const Keyword("get", isBuiltIn: true), | 46 const Keyword("get", isBuiltIn: true), |
| 46 const Keyword("implements", isBuiltIn: true), | 47 const Keyword("implements", isBuiltIn: true), |
| 47 const Keyword("interface", isBuiltIn: true), | 48 const Keyword("interface", isBuiltIn: true), |
| 48 const Keyword("operator", isBuiltIn: true), | 49 const Keyword("operator", isBuiltIn: true), |
| 49 const Keyword("set", isBuiltIn: true), | 50 const Keyword("set", isBuiltIn: true), |
| 50 const Keyword("static", isBuiltIn: true), | 51 const Keyword("static", isBuiltIn: true), |
| 51 const Keyword("typedef", isBuiltIn: true), | 52 const Keyword("typedef", isBuiltIn: true), |
| 52 | 53 |
| 53 const Keyword("hide", isPseudo: true), | 54 const Keyword("hide", isPseudo: true), |
| 54 const Keyword("import", isPseudo: true), | 55 const Keyword("import", isPseudo: true), |
| 55 const Keyword("library", isPseudo: true), | 56 const Keyword("library", isPseudo: true), |
| 56 const Keyword("native", isPseudo: true), | 57 const Keyword("native", isPseudo: true), |
| 57 const Keyword("on", isPseudo: true), | 58 const Keyword("on", isPseudo: true), |
| 58 const Keyword("part", isPseudo: true), | 59 const Keyword("part", isPseudo: true), |
| 59 const Keyword("show", isPseudo: true), | 60 const Keyword("show", isPseudo: true), |
| 60 const Keyword("source", isPseudo: true) ]; | 61 const Keyword("source", isPseudo: true) ]; |
| 61 | 62 |
| 62 static const DYNAMIC = const Keyword("Dynamic", isBuiltIn: true); | 63 // TODO(aprelev@gmail.com): Remove deprecated Dynamic keyword support. |
| 64 static const DYNAMIC_DEPRECATED = const Keyword("Dynamic", isBuiltIn: true); |
| 63 | 65 |
| 64 final String syntax; | 66 final String syntax; |
| 65 final bool isPseudo; | 67 final bool isPseudo; |
| 66 final bool isBuiltIn; | 68 final bool isBuiltIn; |
| 67 final PrecedenceInfo info; | 69 final PrecedenceInfo info; |
| 68 | 70 |
| 69 static Map<String, Keyword> _keywords; | 71 static Map<String, Keyword> _keywords; |
| 70 static Map<String, Keyword> get keywords { | 72 static Map<String, Keyword> get keywords { |
| 71 if (_keywords === null) { | 73 if (_keywords === null) { |
| 72 _keywords = computeKeywordMap(); | 74 _keywords = computeKeywordMap(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 final Keyword keyword; | 217 final Keyword keyword; |
| 216 | 218 |
| 217 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; | 219 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; |
| 218 | 220 |
| 219 bool isLeaf() => true; | 221 bool isLeaf() => true; |
| 220 | 222 |
| 221 KeywordState next(int c) => null; | 223 KeywordState next(int c) => null; |
| 222 | 224 |
| 223 String toString() => keyword.syntax; | 225 String toString() => keyword.syntax; |
| 224 } | 226 } |
| OLD | NEW |