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 SourceString> extends AbstractScanner<S> { | 5 class ArrayBasedScanner<S extends SourceString> 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 void beginToken() { | 69 void beginToken() { |
70 tokenStart = charOffset; | 70 tokenStart = charOffset; |
71 } | 71 } |
72 | 72 |
73 Token firstToken() { | 73 Token firstToken() { |
74 return tokens.next; | 74 return tokens.next; |
75 } | 75 } |
76 | 76 |
| 77 Token previousToken() { |
| 78 return tail; |
| 79 } |
| 80 |
77 void addToCharOffset(int offset) { | 81 void addToCharOffset(int offset) { |
78 extraCharOffset += offset; | 82 extraCharOffset += offset; |
79 } | 83 } |
80 | 84 |
81 void appendWhiteSpace(int next) { | 85 void appendWhiteSpace(int next) { |
82 // Do nothing, we don't collect white space. | 86 // Do nothing, we don't collect white space. |
83 } | 87 } |
84 | 88 |
85 void appendBeginGroup(PrecedenceInfo info, String value) { | 89 void appendBeginGroup(PrecedenceInfo info, String value) { |
86 Token token = new BeginGroupToken(info, value, tokenStart); | 90 Token token = new BeginGroupToken(info, value, tokenStart); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 166 |
163 void discardOpenLt() { | 167 void discardOpenLt() { |
164 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) { | 168 while (!groupingStack.isEmpty() && groupingStack.head.kind === LT_TOKEN) { |
165 groupingStack = groupingStack.tail; | 169 groupingStack = groupingStack.tail; |
166 } | 170 } |
167 } | 171 } |
168 | 172 |
169 // TODO(ahe): make class abstract instead of adding an abstract method. | 173 // TODO(ahe): make class abstract instead of adding an abstract method. |
170 abstract peek(); | 174 abstract peek(); |
171 } | 175 } |
OLD | NEW |