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 // Generated by scripts/tokenizer_gen.py. | 4 // Generated by scripts/tokenizer_gen.py. |
5 | 5 |
6 | 6 |
7 abstract class TokenSource { | 7 abstract class TokenSource { |
8 Token next(); | 8 Token next(); |
9 } | 9 } |
10 | 10 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 return c - 87; | 173 return c - 87; |
174 } else if (c >= 65/*A*/ && c <= 70/*F*/) { | 174 } else if (c >= 65/*A*/ && c <= 70/*F*/) { |
175 return c - 55; | 175 return c - 55; |
176 } else { | 176 } else { |
177 return -1; | 177 return -1; |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 int readHex([int hexLength]) { | 181 int readHex([int hexLength]) { |
182 int maxIndex; | 182 int maxIndex; |
183 if (hexLength === null) { | 183 if (hexLength == null) { |
184 maxIndex = _text.length - 1; | 184 maxIndex = _text.length - 1; |
185 } else { | 185 } else { |
186 // TODO(jimhug): What if this is too long? | 186 // TODO(jimhug): What if this is too long? |
187 maxIndex = _index + hexLength; | 187 maxIndex = _index + hexLength; |
188 if (maxIndex >= _text.length) return -1; | 188 if (maxIndex >= _text.length) return -1; |
189 } | 189 } |
190 var result = 0; | 190 var result = 0; |
191 while (_index < maxIndex) { | 191 while (_index < maxIndex) { |
192 final digit = _hexDigit(_text.charCodeAt(_index)); | 192 final digit = _hexDigit(_text.charCodeAt(_index)); |
193 if (digit == -1) { | 193 if (digit == -1) { |
194 if (hexLength === null) { | 194 if (hexLength == null) { |
195 return result; | 195 return result; |
196 } else { | 196 } else { |
197 return -1; | 197 return -1; |
198 } | 198 } |
199 } | 199 } |
200 _hexDigit(_text.charCodeAt(_index)); | 200 _hexDigit(_text.charCodeAt(_index)); |
201 // Multiply by 16 rather than shift by 4 since that will result in a | 201 // Multiply by 16 rather than shift by 4 since that will result in a |
202 // correct value for numbers that exceed the 32 bit precision of JS | 202 // correct value for numbers that exceed the 32 bit precision of JS |
203 // 'integers'. | 203 // 'integers'. |
204 // TODO: Figure out a better solution to integer truncation. Issue 638. | 204 // TODO: Figure out a better solution to integer truncation. Issue 638. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } | 456 } |
457 int kind = getIdentifierKind(); | 457 int kind = getIdentifierKind(); |
458 if (kind == TokenKind.IDENTIFIER) { | 458 if (kind == TokenKind.IDENTIFIER) { |
459 return _finishToken(TokenKind.IDENTIFIER); | 459 return _finishToken(TokenKind.IDENTIFIER); |
460 } else { | 460 } else { |
461 return _finishToken(kind); | 461 return _finishToken(kind); |
462 } | 462 } |
463 } | 463 } |
464 } | 464 } |
465 | 465 |
OLD | NEW |