| 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 SourceString copyWithoutQuotes(int initial, int terminal) { |
| 143 // TODO(lrn): consider remodelling to avoid having this method in keywords. |
| 144 return this; |
| 145 } |
| 146 |
| 142 bool isEmpty() => false; | 147 bool isEmpty() => false; |
| 143 bool isPrivate() => false; | 148 bool isPrivate() => false; |
| 144 } | 149 } |
| 145 | 150 |
| 146 /** | 151 /** |
| 147 * Abstract state in a state machine for scanning keywords. | 152 * Abstract state in a state machine for scanning keywords. |
| 148 */ | 153 */ |
| 149 class KeywordState { | 154 class KeywordState { |
| 150 abstract bool isLeaf(); | 155 abstract bool isLeaf(); |
| 151 abstract KeywordState next(int c); | 156 abstract KeywordState next(int c); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 final Keyword keyword; | 251 final Keyword keyword; |
| 247 | 252 |
| 248 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; | 253 LeafKeywordState(String syntax) : keyword = Keyword.keywords[syntax]; |
| 249 | 254 |
| 250 bool isLeaf() => true; | 255 bool isLeaf() => true; |
| 251 | 256 |
| 252 KeywordState next(int c) => null; | 257 KeywordState next(int c) => null; |
| 253 | 258 |
| 254 String toString() => keyword.syntax; | 259 String toString() => keyword.syntax; |
| 255 } | 260 } |
| OLD | NEW |