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