| 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("assert"), | 10 const Keyword("assert"), |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 static Map<String, Keyword> _keywords; | 76 static Map<String, Keyword> _keywords; |
| 77 static Map<String, Keyword> get keywords { | 77 static Map<String, Keyword> get keywords { |
| 78 if (_keywords === null) { | 78 if (_keywords === null) { |
| 79 _keywords = computeKeywordMap(); | 79 _keywords = computeKeywordMap(); |
| 80 } | 80 } |
| 81 return _keywords; | 81 return _keywords; |
| 82 } | 82 } |
| 83 | 83 |
| 84 const Keyword(String this.syntax, | 84 const Keyword(String this.syntax, |
| 85 [bool this.isPseudo = false, | 85 {bool this.isPseudo: false, |
| 86 bool this.isBuiltIn = false, | 86 bool this.isBuiltIn: false, |
| 87 PrecedenceInfo this.info = KEYWORD_INFO]); | 87 PrecedenceInfo this.info: KEYWORD_INFO}); |
| 88 | 88 |
| 89 static Map<String, Keyword> computeKeywordMap() { | 89 static Map<String, Keyword> computeKeywordMap() { |
| 90 Map<String, Keyword> result = new LinkedHashMap<String, Keyword>(); | 90 Map<String, Keyword> result = new LinkedHashMap<String, Keyword>(); |
| 91 for (Keyword keyword in values) { | 91 for (Keyword keyword in values) { |
| 92 result[keyword.syntax] = keyword; | 92 result[keyword.syntax] = keyword; |
| 93 } | 93 } |
| 94 return result; | 94 return result; |
| 95 } | 95 } |
| 96 | 96 |
| 97 int hashCode() => syntax.hashCode(); | 97 int hashCode() => syntax.hashCode(); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 final Keyword keyword; | 222 final Keyword keyword; |
| 223 | 223 |
| 224 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; | 224 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; |
| 225 | 225 |
| 226 bool isLeaf() => true; | 226 bool isLeaf() => true; |
| 227 | 227 |
| 228 KeywordState next(int c) => null; | 228 KeywordState next(int c) => null; |
| 229 | 229 |
| 230 String toString() => keyword.syntax; | 230 String toString() => keyword.syntax; |
| 231 } | 231 } |
| OLD | NEW |