| 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 final int EOF_TOKEN = 0; | 5 final int EOF_TOKEN = 0; |
| 6 | 6 |
| 7 final int KEYWORD_TOKEN = $k; | 7 final int KEYWORD_TOKEN = $k; |
| 8 final int IDENTIFIER_TOKEN = $a; | 8 final int IDENTIFIER_TOKEN = $a; |
| 9 final int DOUBLE_TOKEN = $d; | 9 final int DOUBLE_TOKEN = $d; |
| 10 final int INT_TOKEN = $i; | 10 final int INT_TOKEN = $i; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 /** Gives a [SourceString] that is not including the [initial] first and | 134 /** Gives a [SourceString] that is not including the [initial] first and |
| 135 * [terminal] last characters. This is only intended to be used to remove | 135 * [terminal] last characters. This is only intended to be used to remove |
| 136 * quotes from string literals (including an initial '@' for raw strings). | 136 * quotes from string literals (including an initial '@' for raw strings). |
| 137 */ | 137 */ |
| 138 SourceString copyWithoutQuotes(int initial, int terminal); | 138 SourceString copyWithoutQuotes(int initial, int terminal); |
| 139 | 139 |
| 140 String get stringValue(); | 140 String get stringValue(); |
| 141 | 141 |
| 142 bool isEmpty(); | 142 bool isEmpty(); |
| 143 |
| 144 bool isPrivate(); |
| 143 } | 145 } |
| 144 | 146 |
| 145 class StringWrapper implements SourceString { | 147 class StringWrapper implements SourceString { |
| 146 final String stringValue; | 148 final String stringValue; |
| 147 | 149 |
| 148 const StringWrapper(String this.stringValue); | 150 const StringWrapper(String this.stringValue); |
| 149 | 151 |
| 150 int hashCode() => stringValue.hashCode(); | 152 int hashCode() => stringValue.hashCode(); |
| 151 | 153 |
| 152 bool operator ==(other) { | 154 bool operator ==(other) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 165 | 167 |
| 166 SourceString copyWithoutQuotes(int initial, int terminal) { | 168 SourceString copyWithoutQuotes(int initial, int terminal) { |
| 167 assert(0 <= initial); | 169 assert(0 <= initial); |
| 168 assert(0 <= terminal); | 170 assert(0 <= terminal); |
| 169 assert(initial + terminal <= stringValue.length); | 171 assert(initial + terminal <= stringValue.length); |
| 170 return new StringWrapper( | 172 return new StringWrapper( |
| 171 stringValue.substring(initial, stringValue.length - terminal)); | 173 stringValue.substring(initial, stringValue.length - terminal)); |
| 172 } | 174 } |
| 173 | 175 |
| 174 bool isEmpty() => stringValue.isEmpty(); | 176 bool isEmpty() => stringValue.isEmpty(); |
| 177 |
| 178 bool isPrivate() => !isEmpty() && stringValue.charCodeAt(0) === $_; |
| 175 } | 179 } |
| 176 | 180 |
| 177 class StringCodeIterator implements Iterator<int> { | 181 class StringCodeIterator implements Iterator<int> { |
| 178 final String string; | 182 final String string; |
| 179 int index; | 183 int index; |
| 180 final int end; | 184 final int end; |
| 181 | 185 |
| 182 StringCodeIterator(String string) : | 186 StringCodeIterator(String string) : |
| 183 this.string = string, index = 0, end = string.length; | 187 this.string = string, index = 0, end = string.length; |
| 184 | 188 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 final PrecedenceInfo STRING_INTERPOLATION_INFO = | 428 final PrecedenceInfo STRING_INTERPOLATION_INFO = |
| 425 const PrecedenceInfo(const SourceString('\${'), 0, | 429 const PrecedenceInfo(const SourceString('\${'), 0, |
| 426 STRING_INTERPOLATION_TOKEN); | 430 STRING_INTERPOLATION_TOKEN); |
| 427 | 431 |
| 428 final PrecedenceInfo HEXADECIMAL_INFO = | 432 final PrecedenceInfo HEXADECIMAL_INFO = |
| 429 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); | 433 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); |
| 430 | 434 |
| 431 // For reporting lexical errors. | 435 // For reporting lexical errors. |
| 432 final PrecedenceInfo ERROR_INFO = | 436 final PrecedenceInfo ERROR_INFO = |
| 433 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); | 437 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); |
| OLD | NEW |