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 final Keyword BREAK = const Keyword("break"); | 9 static final Keyword BREAK = const Keyword("break"); |
10 static final Keyword CASE = const Keyword("case"); | 10 static final Keyword CASE = const Keyword("case"); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 Iterator<int> iterator() => new StringCodeIterator(syntax); | 132 Iterator<int> iterator() => new StringCodeIterator(syntax); |
133 | 133 |
134 void printOn(StringBuffer sb) { | 134 void printOn(StringBuffer sb) { |
135 sb.add(syntax); | 135 sb.add(syntax); |
136 } | 136 } |
137 | 137 |
138 String toString() => syntax; | 138 String toString() => syntax; |
139 String slowToString() => syntax; | 139 String slowToString() => syntax; |
140 String get stringValue() => syntax; | 140 String get stringValue() => syntax; |
141 | 141 |
142 bool isEmtpy() => false; | 142 bool isEmpty() => false; |
143 } | 143 } |
144 | 144 |
145 /** | 145 /** |
146 * Abstract state in a state machine for scanning keywords. | 146 * Abstract state in a state machine for scanning keywords. |
147 */ | 147 */ |
148 class KeywordState { | 148 class KeywordState { |
149 abstract bool isLeaf(); | 149 abstract bool isLeaf(); |
150 abstract KeywordState next(int c); | 150 abstract KeywordState next(int c); |
151 abstract Keyword get keyword(); | 151 abstract Keyword get keyword(); |
152 | 152 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 final Keyword keyword; | 245 final Keyword keyword; |
246 | 246 |
247 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; | 247 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; |
248 | 248 |
249 bool isLeaf() => true; | 249 bool isLeaf() => true; |
250 | 250 |
251 KeywordState next(int c) => null; | 251 KeywordState next(int c) => null; |
252 | 252 |
253 String toString() => keyword.syntax; | 253 String toString() => keyword.syntax; |
254 } | 254 } |
OLD | NEW |