| 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 const int EOF_TOKEN = 0; | 5 const int EOF_TOKEN = 0; |
| 6 | 6 |
| 7 const int KEYWORD_TOKEN = $k; | 7 const int KEYWORD_TOKEN = $k; |
| 8 const int IDENTIFIER_TOKEN = $a; | 8 const int IDENTIFIER_TOKEN = $a; |
| 9 const int BAD_INPUT_TOKEN = $X; | 9 const int BAD_INPUT_TOKEN = $X; |
| 10 const int DOUBLE_TOKEN = $d; | 10 const int DOUBLE_TOKEN = $d; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 /** Gives a [SourceString] that is not including the [initial] first and | 183 /** Gives a [SourceString] that is not including the [initial] first and |
| 184 * [terminal] last characters. This is only intended to be used to remove | 184 * [terminal] last characters. This is only intended to be used to remove |
| 185 * quotes from string literals (including an initial '@' for raw strings). | 185 * quotes from string literals (including an initial '@' for raw strings). |
| 186 */ | 186 */ |
| 187 SourceString copyWithoutQuotes(int initial, int terminal); | 187 SourceString copyWithoutQuotes(int initial, int terminal); |
| 188 | 188 |
| 189 String get stringValue; | 189 String get stringValue; |
| 190 | 190 |
| 191 String slowToString(); | 191 String slowToString(); |
| 192 | 192 |
| 193 bool isEmpty(); | 193 bool get isEmpty; |
| 194 | 194 |
| 195 bool isPrivate(); | 195 bool isPrivate(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 class StringWrapper implements SourceString { | 198 class StringWrapper implements SourceString { |
| 199 final String stringValue; | 199 final String stringValue; |
| 200 | 200 |
| 201 const StringWrapper(String this.stringValue); | 201 const StringWrapper(String this.stringValue); |
| 202 | 202 |
| 203 int get hashCode => stringValue.hashCode; | 203 int get hashCode => stringValue.hashCode; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 217 String slowToString() => stringValue; | 217 String slowToString() => stringValue; |
| 218 | 218 |
| 219 SourceString copyWithoutQuotes(int initial, int terminal) { | 219 SourceString copyWithoutQuotes(int initial, int terminal) { |
| 220 assert(0 <= initial); | 220 assert(0 <= initial); |
| 221 assert(0 <= terminal); | 221 assert(0 <= terminal); |
| 222 assert(initial + terminal <= stringValue.length); | 222 assert(initial + terminal <= stringValue.length); |
| 223 return new StringWrapper( | 223 return new StringWrapper( |
| 224 stringValue.substring(initial, stringValue.length - terminal)); | 224 stringValue.substring(initial, stringValue.length - terminal)); |
| 225 } | 225 } |
| 226 | 226 |
| 227 bool isEmpty() => stringValue.isEmpty(); | 227 bool get isEmpty => stringValue.isEmpty; |
| 228 | 228 |
| 229 bool isPrivate() => !isEmpty() && identical(stringValue.charCodeAt(0), $_); | 229 bool isPrivate() => !isEmpty && identical(stringValue.charCodeAt(0), $_); |
| 230 } | 230 } |
| 231 | 231 |
| 232 class StringCodeIterator implements Iterator<int> { | 232 class StringCodeIterator implements Iterator<int> { |
| 233 final String string; | 233 final String string; |
| 234 int index; | 234 int index; |
| 235 final int end; | 235 final int end; |
| 236 | 236 |
| 237 StringCodeIterator(String string) : | 237 StringCodeIterator(String string) : |
| 238 this.string = string, index = 0, end = string.length; | 238 this.string = string, index = 0, end = string.length; |
| 239 | 239 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 493 |
| 494 const PrecedenceInfo HEXADECIMAL_INFO = | 494 const PrecedenceInfo HEXADECIMAL_INFO = |
| 495 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); | 495 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); |
| 496 | 496 |
| 497 const PrecedenceInfo COMMENT_INFO = | 497 const PrecedenceInfo COMMENT_INFO = |
| 498 const PrecedenceInfo(const SourceString('comment'), 0, COMMENT_TOKEN); | 498 const PrecedenceInfo(const SourceString('comment'), 0, COMMENT_TOKEN); |
| 499 | 499 |
| 500 // For reporting lexical errors. | 500 // For reporting lexical errors. |
| 501 const PrecedenceInfo ERROR_INFO = | 501 const PrecedenceInfo ERROR_INFO = |
| 502 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); | 502 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); |
| OLD | NEW |