| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return this; | 112 return this; |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool isEmpty() => false; | 115 bool isEmpty() => false; |
| 116 bool isPrivate() => false; | 116 bool isPrivate() => false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 /** | 119 /** |
| 120 * Abstract state in a state machine for scanning keywords. | 120 * Abstract state in a state machine for scanning keywords. |
| 121 */ | 121 */ |
| 122 class KeywordState { | 122 abstract class KeywordState { |
| 123 abstract bool isLeaf(); | 123 abstract bool isLeaf(); |
| 124 abstract KeywordState next(int c); | 124 abstract KeywordState next(int c); |
| 125 abstract Keyword get keyword; | 125 abstract Keyword get keyword; |
| 126 | 126 |
| 127 static KeywordState _KEYWORD_STATE; | 127 static KeywordState _KEYWORD_STATE; |
| 128 static KeywordState get KEYWORD_STATE { | 128 static KeywordState get KEYWORD_STATE { |
| 129 if (_KEYWORD_STATE === null) { | 129 if (_KEYWORD_STATE === null) { |
| 130 List<String> strings = new List<String>(Keyword.values.length); | 130 List<String> strings = new List<String>(Keyword.values.length); |
| 131 for (int i = 0; i < Keyword.values.length; i++) { | 131 for (int i = 0; i < Keyword.values.length; i++) { |
| 132 strings[i] = Keyword.values[i].syntax; | 132 strings[i] = Keyword.values[i].syntax; |
| (...skipping 86 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 |