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 part of scanner_implementation; | 5 part of scanner_implementation; |
6 | 6 |
7 abstract | 7 abstract |
8 class ArrayBasedScanner<S extends SourceString> extends AbstractScanner<S> { | 8 class ArrayBasedScanner<S extends SourceString> extends AbstractScanner<S> { |
9 int get charOffset => byteOffset + extraCharOffset; | 9 int get charOffset => byteOffset + extraCharOffset; |
10 final Token tokens; | 10 final Token tokens; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 tail = tail.next; | 61 tail = tail.next; |
62 } | 62 } |
63 | 63 |
64 void appendEofToken() { | 64 void appendEofToken() { |
65 tail.next = new Token(EOF_INFO, charOffset); | 65 tail.next = new Token(EOF_INFO, charOffset); |
66 tail = tail.next; | 66 tail = tail.next; |
67 // EOF points to itself so there's always infinite look-ahead. | 67 // EOF points to itself so there's always infinite look-ahead. |
68 tail.next = tail; | 68 tail.next = tail; |
69 discardOpenLt(); | 69 discardOpenLt(); |
70 while (!groupingStack.isEmpty) { | 70 while (!groupingStack.isEmpty) { |
71 BeginGroupToken begin = groupingStack.head; | 71 unmatchedBeginGroup(groupingStack.head); |
72 begin.endGroup = tail; | |
73 groupingStack = groupingStack.tail; | 72 groupingStack = groupingStack.tail; |
74 } | 73 } |
75 } | 74 } |
76 | 75 |
77 void beginToken() { | 76 void beginToken() { |
78 tokenStart = charOffset; | 77 tokenStart = charOffset; |
79 } | 78 } |
80 | 79 |
81 Token firstToken() { | 80 Token firstToken() { |
82 return tokens.next; | 81 return tokens.next; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 void discardOpenLt() { | 175 void discardOpenLt() { |
177 while (!groupingStack.isEmpty | 176 while (!groupingStack.isEmpty |
178 && identical(groupingStack.head.kind, LT_TOKEN)) { | 177 && identical(groupingStack.head.kind, LT_TOKEN)) { |
179 groupingStack = groupingStack.tail; | 178 groupingStack = groupingStack.tail; |
180 } | 179 } |
181 } | 180 } |
182 | 181 |
183 // TODO(ahe): make class abstract instead of adding an abstract method. | 182 // TODO(ahe): make class abstract instead of adding an abstract method. |
184 peek(); | 183 peek(); |
185 } | 184 } |
OLD | NEW |