| 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 abstract class Scanner { | 5 abstract class Scanner { |
| 6 Token tokenize(); | 6 Token tokenize(); |
| 7 } | 7 } |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Common base class for a Dart scanner. | 10 * Common base class for a Dart scanner. |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 } else if (next < 128) { | 648 } else if (next < 128) { |
| 649 appendKeywordToken(state.keyword); | 649 appendKeywordToken(state.keyword); |
| 650 return next; | 650 return next; |
| 651 } else { | 651 } else { |
| 652 return tokenizeIdentifier(next, start, allowDollar); | 652 return tokenizeIdentifier(next, start, allowDollar); |
| 653 } | 653 } |
| 654 } | 654 } |
| 655 | 655 |
| 656 int tokenizeIdentifier(int next, int start, bool allowDollar) { | 656 int tokenizeIdentifier(int next, int start, bool allowDollar) { |
| 657 bool isAscii = true; | 657 bool isAscii = true; |
| 658 |
| 659 // TODO(aprelev@gmail.com): Remove deprecated Dynamic keyword support. |
| 658 bool isDynamicBuiltIn = false; | 660 bool isDynamicBuiltIn = false; |
| 659 | 661 |
| 660 if (next === $D) { | 662 if (next === $D) { |
| 661 next = advance(); | 663 next = advance(); |
| 662 if (next === $y) { | 664 if (next === $y) { |
| 663 next = advance(); | 665 next = advance(); |
| 664 if (next === $n) { | 666 if (next === $n) { |
| 665 next = advance(); | 667 next = advance(); |
| 666 if (next === $a) { | 668 if (next === $a) { |
| 667 next = advance(); | 669 next = advance(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 686 ($0 <= next && next <= $9) || | 688 ($0 <= next && next <= $9) || |
| 687 next === $_ || | 689 next === $_ || |
| 688 (next === $$ && allowDollar)) { | 690 (next === $$ && allowDollar)) { |
| 689 isDynamicBuiltIn = false; | 691 isDynamicBuiltIn = false; |
| 690 next = advance(); | 692 next = advance(); |
| 691 } else if ((next < 128) || (next === $NBSP)) { | 693 } else if ((next < 128) || (next === $NBSP)) { |
| 692 // Identifier ends here. | 694 // Identifier ends here. |
| 693 if (start == byteOffset) { | 695 if (start == byteOffset) { |
| 694 return error(const SourceString("expected identifier")); | 696 return error(const SourceString("expected identifier")); |
| 695 } else if (isDynamicBuiltIn) { | 697 } else if (isDynamicBuiltIn) { |
| 696 appendKeywordToken(Keyword.DYNAMIC); | 698 appendKeywordToken(Keyword.DYNAMIC_DEPRECATED); |
| 697 } else if (isAscii) { | 699 } else if (isAscii) { |
| 698 appendByteStringToken(IDENTIFIER_INFO, asciiString(start, 0)); | 700 appendByteStringToken(IDENTIFIER_INFO, asciiString(start, 0)); |
| 699 } else { | 701 } else { |
| 700 appendByteStringToken(BAD_INPUT_INFO, utf8String(start, -1)); | 702 appendByteStringToken(BAD_INPUT_INFO, utf8String(start, -1)); |
| 701 } | 703 } |
| 702 return next; | 704 return next; |
| 703 } else { | 705 } else { |
| 704 isDynamicBuiltIn = false; | 706 isDynamicBuiltIn = false; |
| 705 int nonAsciiStart = byteOffset; | 707 int nonAsciiStart = byteOffset; |
| 706 do { | 708 do { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 next = advance(); | 865 next = advance(); |
| 864 } | 866 } |
| 865 return error(const SourceString("unterminated string literal")); | 867 return error(const SourceString("unterminated string literal")); |
| 866 } | 868 } |
| 867 | 869 |
| 868 int error(SourceString message) { | 870 int error(SourceString message) { |
| 869 appendByteStringToken(BAD_INPUT_INFO, message); | 871 appendByteStringToken(BAD_INPUT_INFO, message); |
| 870 return advance(); // Ensure progress. | 872 return advance(); // Ensure progress. |
| 871 } | 873 } |
| 872 } | 874 } |
| OLD | NEW |