| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 } | 445 } |
| 446 int kind = getIdentifierKind(); | 446 int kind = getIdentifierKind(); |
| 447 if (kind == TokenKind.IDENTIFIER) { | 447 if (kind == TokenKind.IDENTIFIER) { |
| 448 return _finishToken(TokenKind.IDENTIFIER); | 448 return _finishToken(TokenKind.IDENTIFIER); |
| 449 } else { | 449 } else { |
| 450 return _finishToken(kind); | 450 return _finishToken(kind); |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| OLD | NEW |