| 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 |
| 7 /** |
| 8 */ |
| 9 interface TokenSource { |
| 10 Token next(); |
| 11 } |
| 12 |
| 6 class InterpStack { | 13 class InterpStack { |
| 7 InterpStack next, previous; | 14 InterpStack next, previous; |
| 8 final int quote; | 15 final int quote; |
| 9 final bool isMultiline; | 16 final bool isMultiline; |
| 10 int depth; | 17 int depth; |
| 11 | 18 |
| 12 InterpStack(this.previous, this.quote, this.isMultiline): depth = -1; | 19 InterpStack(this.previous, this.quote, this.isMultiline): depth = -1; |
| 13 | 20 |
| 14 InterpStack pop() { | 21 InterpStack pop() { |
| 15 return this.previous; | 22 return this.previous; |
| 16 } | 23 } |
| 17 | 24 |
| 18 static InterpStack push(InterpStack stack, int quote, bool isMultiline) { | 25 static InterpStack push(InterpStack stack, int quote, bool isMultiline) { |
| 19 var newStack = new InterpStack(stack, quote, isMultiline); | 26 var newStack = new InterpStack(stack, quote, isMultiline); |
| 20 if (stack != null) newStack.previous = stack; | 27 if (stack != null) newStack.previous = stack; |
| 21 return newStack; | 28 return newStack; |
| 22 } | 29 } |
| 23 } | 30 } |
| 24 | 31 |
| 25 /** | 32 /** |
| 26 * The base class for our tokenizer. The hand coded parts are in this file, with | 33 * The base class for our tokenizer. The hand coded parts are in this file, with |
| 27 * the generated parts in the subclass Tokenizer. | 34 * the generated parts in the subclass Tokenizer. |
| 28 */ | 35 */ |
| 29 class TokenizerBase extends TokenizerHelpers { | 36 class TokenizerBase extends TokenizerHelpers implements TokenSource { |
| 30 final SourceFile _source; | 37 final SourceFile _source; |
| 31 final bool _skipWhitespace; | 38 final bool _skipWhitespace; |
| 32 String _text; | 39 String _text; |
| 33 | 40 |
| 34 int _index; | 41 int _index; |
| 35 int _startIndex; | 42 int _startIndex; |
| 36 | 43 |
| 37 /** Keeps track of string interpolation state. */ | 44 /** Keeps track of string interpolation state. */ |
| 38 InterpStack _interpStack; | 45 InterpStack _interpStack; |
| 39 | 46 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 417 } |
| 411 } | 418 } |
| 412 int kind = getIdentifierKind(); | 419 int kind = getIdentifierKind(); |
| 413 if (kind == TokenKind.IDENTIFIER) { | 420 if (kind == TokenKind.IDENTIFIER) { |
| 414 return _finishToken(TokenKind.IDENTIFIER); | 421 return _finishToken(TokenKind.IDENTIFIER); |
| 415 } else { | 422 } else { |
| 416 return _finishToken(kind); | 423 return _finishToken(kind); |
| 417 } | 424 } |
| 418 } | 425 } |
| 419 } | 426 } |
| OLD | NEW |