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

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. Marked raw_string_test as pass for dart2js-ff and dart2dart 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
« no previous file with comments | « no previous file | lib/compiler/implementation/string_validator.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/scanner/scanner.dart
diff --git a/lib/compiler/implementation/scanner/scanner.dart b/lib/compiler/implementation/scanner/scanner.dart
index fcdebd397b4dcae4394d3a95ae9693b5d8abb1fc..882f845933a7ff4bd75acf5aa44e68a111863a97 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);
+ }
+
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) {
+ int nextnext = peek();
+ if (nextnext === $DQ || nextnext === $SQ) {
+ int start = byteOffset;
+ next = advance();
+ return tokenizeString(next, start, true);
+ }
+ return tokenizeKeywordOrIdentifier(next, true);
+ }
+
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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698