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

Unified Diff: lib/compiler/implementation/scanner/scanner.dart

Issue 10920066: issue 4817 fixed. Implemented raw strings with 'r' instead of '@' for dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased, weird problem with patch in string_interpolation_test.dart hopefully fixed Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/scanner/scanner.dart
diff --git a/lib/compiler/implementation/scanner/scanner.dart b/lib/compiler/implementation/scanner/scanner.dart
index 84af8ad0ab1f9ca936711c4a9a960fd85aa11810..376056a5c49a2258fe46ff3af300ec90c4f6062c 100644
--- a/lib/compiler/implementation/scanner/scanner.dart
+++ b/lib/compiler/implementation/scanner/scanner.dart
@@ -106,6 +106,10 @@ class AbstractScanner<T extends SourceString> implements Scanner {
return advance();
}
+ if ($r === next) {
+ return tokenizeRawStringKeywordOrIdentifier(next, true);
+ }
+
if ($a <= next && next <= $z) {
return tokenizeKeywordOrIdentifier(next, true);
}
@@ -230,6 +234,7 @@ class AbstractScanner<T extends SourceString> implements Scanner {
return tokenizeSlashOrComment(next);
}
+ // TODO(aprelev@gmail.com) Remove deprecated raw string literals
if (next === $AT) {
return tokenizeAtOrRawString(next);
}
@@ -620,6 +625,16 @@ class AbstractScanner<T extends SourceString> implements Scanner {
}
}
+ int tokenizeRawStringKeywordOrIdentifier(int next, bool allowDollar) {
ahe 2012/09/11 06:04:34 allowDollar is always true. The parameter is not n
aam-me 2012/09/12 02:12:38 Done.
+ int nextnext = peek();
+ if (nextnext === $DQ || nextnext === $SQ) {
+ int start = byteOffset;
+ next = advance();
+ return tokenizeString(next, start, true);
+ }
+ return tokenizeKeywordOrIdentifier(next, allowDollar);
+ }
+
int tokenizeKeywordOrIdentifier(int next, bool allowDollar) {
KeywordState state = KeywordState.KEYWORD_STATE;
int start = byteOffset;
« no previous file with comments | « no previous file | lib/compiler/implementation/string_validator.dart » ('j') | lib/compiler/implementation/string_validator.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698