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

Side by Side Diff: frog/leg/scanner/scanner.dart

Issue 9190038: Handle escapes in string literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed validation from scanner Created 8 years, 11 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 | « frog/leg/scanner/parser.dart ('k') | frog/leg/scanner/scanner_implementation.dart » ('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) 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 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 return next; 622 return next;
623 } 623 }
624 } 624 }
625 if (raw) { 625 if (raw) {
626 return tokenizeSingleLineRawString(next, q, start); 626 return tokenizeSingleLineRawString(next, q, start);
627 } else { 627 } else {
628 return tokenizeSingleLineString(next, q, start); 628 return tokenizeSingleLineString(next, q, start);
629 } 629 }
630 } 630 }
631 631
632 static bool isHexDigit(int character) {
633 if ($0 <= character && character <= $9) return true;
634 character |= 0x20;
635 return ($a <= character && character <= $f);
636 }
637
632 int tokenizeSingleLineString(int next, int q1, int start) { 638 int tokenizeSingleLineString(int next, int q1, int start) {
633 while (next !== $EOF) { 639 while (next !== $EOF) {
634 if (next === q1) { 640 if (next === q1) {
635 appendByteStringToken(STRING_INFO, utf8String(start, 0)); 641 appendByteStringToken(STRING_INFO, utf8String(start, 0));
636 return advance(); 642 return advance();
637 } else if (next === $BACKSLASH) { 643 } else if (next === $BACKSLASH) {
638 next = advance(); 644 next = advance();
639 if (next === $EOF) { 645 if (next === $EOF) {
640 throw new MalformedInputException(charOffset); 646 throw new MalformedInputException(charOffset);
641 } 647 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } 715 }
710 return next; 716 return next;
711 } 717 }
712 } 718 }
713 719
714 class MalformedInputException { 720 class MalformedInputException {
715 final message; 721 final message;
716 MalformedInputException(this.message); 722 MalformedInputException(this.message);
717 toString() => message.toString(); 723 toString() => message.toString();
718 } 724 }
OLDNEW
« no previous file with comments | « frog/leg/scanner/parser.dart ('k') | frog/leg/scanner/scanner_implementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698