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 library fasta.scanner.array_based_scanner; | 5 library fasta.scanner.array_based_scanner; |
6 | 6 |
7 import 'error_token.dart' show ErrorToken; | 7 import 'error_token.dart' show ErrorToken; |
8 | 8 |
9 import 'keyword.dart' show Keyword; | 9 import 'keyword.dart' show Keyword; |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 appendToken(new KeywordToken(keyword, tokenStart)); | 100 appendToken(new KeywordToken(keyword, tokenStart)); |
101 } | 101 } |
102 | 102 |
103 void appendEofToken() { | 103 void appendEofToken() { |
104 beginToken(); | 104 beginToken(); |
105 discardOpenLt(); | 105 discardOpenLt(); |
106 while (!groupingStack.isEmpty) { | 106 while (!groupingStack.isEmpty) { |
107 unmatchedBeginGroup(groupingStack.head); | 107 unmatchedBeginGroup(groupingStack.head); |
108 groupingStack = groupingStack.tail; | 108 groupingStack = groupingStack.tail; |
109 } | 109 } |
110 appendToken(new SymbolToken(EOF_INFO, tokenStart)); | 110 appendToken(new SymbolToken.eof(tokenStart)); |
111 // EOF points to itself so there's always infinite look-ahead. | |
112 tail.next = tail; | |
113 } | 111 } |
114 | 112 |
115 /** | 113 /** |
116 * Notifies scanning a whitespace character. Note that [appendWhiteSpace] is | 114 * Notifies scanning a whitespace character. Note that [appendWhiteSpace] is |
117 * not always invoked for [$SPACE] characters. | 115 * not always invoked for [$SPACE] characters. |
118 * | 116 * |
119 * This method is used by the scanners to track line breaks and create the | 117 * This method is used by the scanners to track line breaks and create the |
120 * [lineStarts] map. | 118 * [lineStarts] map. |
121 */ | 119 */ |
122 void appendWhiteSpace(int next) { | 120 void appendWhiteSpace(int next) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 * something which cannot possibly be part of a type parameter/argument | 313 * something which cannot possibly be part of a type parameter/argument |
316 * list, like the '=' in the above example. | 314 * list, like the '=' in the above example. |
317 */ | 315 */ |
318 void discardOpenLt() { | 316 void discardOpenLt() { |
319 while (!groupingStack.isEmpty && | 317 while (!groupingStack.isEmpty && |
320 identical(groupingStack.head.kind, LT_TOKEN)) { | 318 identical(groupingStack.head.kind, LT_TOKEN)) { |
321 groupingStack = groupingStack.tail; | 319 groupingStack = groupingStack.tail; |
322 } | 320 } |
323 } | 321 } |
324 } | 322 } |
OLD | NEW |