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

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

Issue 10836351: Parse metadata, but ignore it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 4 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
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 interface Scanner { 5 interface 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (next === $CLOSE_CURLY_BRACKET) { 224 if (next === $CLOSE_CURLY_BRACKET) {
225 return appendEndGroup(CLOSE_CURLY_BRACKET_INFO, "}", 225 return appendEndGroup(CLOSE_CURLY_BRACKET_INFO, "}",
226 OPEN_CURLY_BRACKET_TOKEN); 226 OPEN_CURLY_BRACKET_TOKEN);
227 } 227 }
228 228
229 if (next === $SLASH) { 229 if (next === $SLASH) {
230 return tokenizeSlashOrComment(next); 230 return tokenizeSlashOrComment(next);
231 } 231 }
232 232
233 if (next === $AT) { 233 if (next === $AT) {
234 return tokenizeRawString(next); 234 return tokenizeAtOrRawString(next);
235 } 235 }
236 236
237 if (next === $DQ || next === $SQ) { 237 if (next === $DQ || next === $SQ) {
238 return tokenizeString(next, byteOffset, false); 238 return tokenizeString(next, byteOffset, false);
239 } 239 }
240 240
241 if (next === $PERIOD) { 241 if (next === $PERIOD) {
242 return tokenizeDotsOrNumber(next); 242 return tokenizeDotsOrNumber(next);
243 } 243 }
244 244
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 next = nextByte(); 665 next = nextByte();
666 } while (next > 127); 666 } while (next > 127);
667 String string = utf8String(nonAsciiStart, -1).slowToString(); 667 String string = utf8String(nonAsciiStart, -1).slowToString();
668 isAscii = false; 668 isAscii = false;
669 int byteLength = nonAsciiStart - byteOffset; 669 int byteLength = nonAsciiStart - byteOffset;
670 addToCharOffset(string.length - byteLength); 670 addToCharOffset(string.length - byteLength);
671 } 671 }
672 } 672 }
673 } 673 }
674 674
675 int tokenizeRawString(int next) { 675 int tokenizeAtOrRawString(int next) {
676 int start = byteOffset; 676 int start = byteOffset;
677 next = advance(); 677 next = advance();
678 if (next === $DQ || next === $SQ) { 678 if (next === $DQ || next === $SQ) {
679 return tokenizeString(next, start, true); 679 return tokenizeString(next, start, true);
680 } else { 680 } else {
681 throw new MalformedInputException("expected ' or \"", charOffset); 681 appendPrecedenceToken(AT_INFO);
682 return next;
682 } 683 }
683 } 684 }
684 685
685 int tokenizeString(int next, int start, bool raw) { 686 int tokenizeString(int next, int start, bool raw) {
686 int quoteChar = next; 687 int quoteChar = next;
687 next = advance(); 688 next = advance();
688 if (quoteChar === next) { 689 if (quoteChar === next) {
689 next = advance(); 690 next = advance();
690 if (quoteChar === next) { 691 if (quoteChar === next) {
691 // Multiline string. 692 // Multiline string.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 charOffset); 827 charOffset);
827 } 828 }
828 } 829 }
829 830
830 class MalformedInputException { 831 class MalformedInputException {
831 final String message; 832 final String message;
832 final position; 833 final position;
833 MalformedInputException(this.message, this.position); 834 MalformedInputException(this.message, this.position);
834 toString() => message; 835 toString() => message;
835 } 836 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698