OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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; | 5 part of scanner; |
6 | 6 |
7 abstract class Scanner { | 7 abstract class Scanner { |
8 Token tokenize(); | 8 Token tokenize(); |
9 | 9 |
10 factory Scanner(SourceFile file, {bool includeComments: false}) { | 10 factory Scanner(SourceFile file, {bool includeComments: false}) { |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 return next; | 421 return next; |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 int tokenizeOpenSquareBracket(int next) { | 425 int tokenizeOpenSquareBracket(int next) { |
426 // [ [] []= | 426 // [ [] []= |
427 next = advance(); | 427 next = advance(); |
428 if (identical(next, $CLOSE_SQUARE_BRACKET)) { | 428 if (identical(next, $CLOSE_SQUARE_BRACKET)) { |
429 Token token = previousToken(); | 429 Token token = previousToken(); |
430 if (token is KeywordToken && | 430 if (token is KeywordToken && |
431 identical((token as KeywordToken).keyword.syntax, 'operator')) { | 431 identical(token.keyword.syntax, 'operator')) { |
432 return select($EQ, INDEX_EQ_INFO, INDEX_INFO); | 432 return select($EQ, INDEX_EQ_INFO, INDEX_INFO); |
433 } | 433 } |
434 } | 434 } |
435 appendBeginGroup(OPEN_SQUARE_BRACKET_INFO); | 435 appendBeginGroup(OPEN_SQUARE_BRACKET_INFO); |
436 return next; | 436 return next; |
437 } | 437 } |
438 | 438 |
439 int tokenizeCaret(int next) { | 439 int tokenizeCaret(int next) { |
440 // ^ ^= | 440 // ^ ^= |
441 return select($EQ, CARET_EQ_INFO, CARET_INFO); | 441 return select($EQ, CARET_EQ_INFO, CARET_INFO); |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 // ignore the [close] token (assuming it's correct), then the error will be | 1060 // ignore the [close] token (assuming it's correct), then the error will be |
1061 // reported when parsing the [next] token. | 1061 // reported when parsing the [next] token. |
1062 | 1062 |
1063 Token next = new StringToken.fromString( | 1063 Token next = new StringToken.fromString( |
1064 BAD_INPUT_INFO, error, begin.charOffset, canonicalize: true); | 1064 BAD_INPUT_INFO, error, begin.charOffset, canonicalize: true); |
1065 begin.endGroup = close; | 1065 begin.endGroup = close; |
1066 close.next = next; | 1066 close.next = next; |
1067 next.next = begin.next; | 1067 next.next = begin.next; |
1068 } | 1068 } |
1069 } | 1069 } |
OLD | NEW |