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

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

Issue 340703003: Prevent double reporting on hex, strings, and multiline comments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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: sdk/lib/_internal/compiler/implementation/scanner/scanner.dart
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/scanner.dart b/sdk/lib/_internal/compiler/implementation/scanner/scanner.dart
index f74e339dacf807912659ee1fb7a801e333aa9383..d4a9e18069bf7192bc10de358457c16d2df9b895 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/scanner.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/scanner.dart
@@ -628,7 +628,8 @@ abstract class AbstractScanner implements Scanner {
hasDigits = true;
} else {
if (!hasDigits) {
- return unterminated('0x');
+ unterminated('0x', shouldAdvance: false);
+ return next;
}
appendSubstringToken(HEXADECIMAL_INFO, start, true);
return next;
@@ -852,7 +853,7 @@ abstract class AbstractScanner implements Scanner {
next = advance();
if (identical(quoteChar, next)) {
// Multiline string.
- return tokenizeMultiLineString(quoteChar, start, raw);
+ return tokenizeMultiLineString(next, quoteChar, start, raw);
} else {
// Empty string.
appendSubstringToken(STRING_INFO, start, true);
@@ -949,7 +950,6 @@ abstract class AbstractScanner implements Scanner {
int tokenizeSingleLineRawString(int next, int quoteChar, int start) {
bool asciiOnly = true;
- next = advance(); // Advance past the quote.
ahe 2014/06/23 14:28:49 This line caused dart2js to incorrectly compile th
srawlins 2014/07/15 20:07:07 I disagree. In this example, I get the correct err
ahe 2014/07/16 07:54:18 What I'm trying to say is: You removed this line.
srawlins 2014/08/12 04:32:58 Oh, I see! OK thank you. I've added your test as t
while (next != $EOF) {
if (identical(next, quoteChar)) {
if (!asciiOnly) handleUnicode(start);
@@ -968,7 +968,7 @@ abstract class AbstractScanner implements Scanner {
return unterminatedRawString(quoteChar);
}
- int tokenizeMultiLineRawString(int quoteChar, int start) {
+ int tokenizeMultiLineRawString(int next, int quoteChar, int start) {
bool asciiOnlyString = true;
bool asciiOnlyLine = true;
int unicodeStart = start;
@@ -1005,12 +1005,12 @@ abstract class AbstractScanner implements Scanner {
return unterminatedRawMultiLineString(quoteChar);
}
- int tokenizeMultiLineString(int quoteChar, int start, bool raw) {
- if (raw) return tokenizeMultiLineRawString(quoteChar, start);
+ int tokenizeMultiLineString(int next, int quoteChar, int start, bool raw) {
ahe 2014/06/23 14:28:49 I don't understand this change.
srawlins 2014/07/15 20:07:08 Done. Sorry, I think from a previous fix.
+ if (raw) return tokenizeMultiLineRawString(next, quoteChar, start);
bool asciiOnlyString = true;
bool asciiOnlyLine = true;
int unicodeStart = start;
- int next = advance(); // Advance past the (last) quote (of three).
+ next = advance(); // Advance past the (last) quote (of three).
while (!identical(next, $EOF)) {
if (identical(next, $$)) {
if (!asciiOnlyLine) handleUnicode(unicodeStart);
@@ -1078,6 +1078,7 @@ abstract class AbstractScanner implements Scanner {
return unterminated(
new String.fromCharCodes([quoteChar, quoteChar, quoteChar]));
}
+
int unterminatedRawMultiLineString(int quoteChar) {
return unterminated(
'r${new String.fromCharCodes([quoteChar, quoteChar, quoteChar])}');

Powered by Google App Engine
This is Rietveld 408576698