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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 String toString() => syntax; | 109 String toString() => syntax; |
110 String slowToString() => syntax; | 110 String slowToString() => syntax; |
111 String get stringValue => syntax; | 111 String get stringValue => syntax; |
112 | 112 |
113 SourceString copyWithoutQuotes(int initial, int terminal) { | 113 SourceString copyWithoutQuotes(int initial, int terminal) { |
114 // TODO(lrn): consider remodelling to avoid having this method in keywords. | 114 // TODO(lrn): consider remodelling to avoid having this method in keywords. |
115 return this; | 115 return this; |
116 } | 116 } |
117 | 117 |
118 bool isEmpty() => false; | 118 bool get isEmpty => false; |
119 bool isPrivate() => false; | 119 bool isPrivate() => false; |
120 } | 120 } |
121 | 121 |
122 /** | 122 /** |
123 * Abstract state in a state machine for scanning keywords. | 123 * Abstract state in a state machine for scanning keywords. |
124 */ | 124 */ |
125 abstract class KeywordState { | 125 abstract class KeywordState { |
126 abstract bool isLeaf(); | 126 abstract bool isLeaf(); |
127 abstract KeywordState next(int c); | 127 abstract KeywordState next(int c); |
128 abstract Keyword get keyword; | 128 abstract Keyword get keyword; |
(...skipping 93 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 |