Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: lib/compiler/implementation/scanner/scanner.dart

Issue 11021008: Added 'dynamic' keyword, so that 'Dynamic' can be deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated dart2dart test status file with co19 issue as well. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/scanner/parser.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/parser.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698