| 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 class ArrayBasedScanner<S> extends AbstractScanner<S> { | 5 class ArrayBasedScanner<S> extends AbstractScanner<S> { |
| 6 int get charOffset() => byteOffset + extraCharOffset; | 6 int get charOffset() => byteOffset + extraCharOffset; |
| 7 final Token tokens; | 7 final Token tokens; |
| 8 Token tail; | 8 Token tail; |
| 9 int tokenStart; | 9 int tokenStart; |
| 10 int byteOffset; | 10 int byteOffset; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 int advance() { | 25 int advance() { |
| 26 int next = nextByte(); | 26 int next = nextByte(); |
| 27 return next; | 27 return next; |
| 28 } | 28 } |
| 29 | 29 |
| 30 int select(int choice, PrecedenceInfo yes, PrecedenceInfo no) { | 30 int select(int choice, PrecedenceInfo yes, PrecedenceInfo no) { |
| 31 int next = advance(); | 31 int next = advance(); |
| 32 if (next === choice) { | 32 if (next === choice) { |
| 33 appendPrecenceToken(yes); | 33 appendPrecedenceToken(yes); |
| 34 return advance(); | 34 return advance(); |
| 35 } else { | 35 } else { |
| 36 appendPrecenceToken(no); | 36 appendPrecedenceToken(no); |
| 37 return next; | 37 return next; |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 void appendPrecenceToken(PrecedenceInfo info) { | 41 void appendPrecedenceToken(PrecedenceInfo info) { |
| 42 tail.next = new Token(info, tokenStart); | 42 tail.next = new Token(info, tokenStart); |
| 43 tail = tail.next; | 43 tail = tail.next; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void appendStringToken(PrecedenceInfo info, String value) { | 46 void appendStringToken(PrecedenceInfo info, String value) { |
| 47 tail.next = new StringToken(info, value, tokenStart); | 47 tail.next = new StringToken(info, value, tokenStart); |
| 48 tail = tail.next; | 48 tail = tail.next; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void appendKeywordToken(Keyword keyword) { | 51 void appendKeywordToken(Keyword keyword) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 void discardOpenLt() { | 163 void discardOpenLt() { |
| 164 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) { | 164 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) { |
| 165 groupingStack = groupingStack.tail; | 165 groupingStack = groupingStack.tail; |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 // TODO(ahe): make class abstract instead of adding an abstract method. | 169 // TODO(ahe): make class abstract instead of adding an abstract method. |
| 170 abstract peek(); | 170 abstract peek(); |
| 171 } | 171 } |
| OLD | NEW |