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