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

Unified Diff: compiler/java/com/google/dart/compiler/parser/DartScanner.java

Issue 9414015: Issue 1551. Report error for new-line in single-line raw string. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 | compiler/javatests/com/google/dart/compiler/parser/ParserEventsTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/parser/DartScanner.java
diff --git a/compiler/java/com/google/dart/compiler/parser/DartScanner.java b/compiler/java/com/google/dart/compiler/parser/DartScanner.java
index 5cd44292c5c2388c0fa99702be067290c4c847bd..e710149510e67e59db80fad5896d45b09ee62252 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartScanner.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartScanner.java
@@ -861,7 +861,7 @@ public class DartScanner {
int quote = internalState.getQuote();
boolean multiLine = internalState.isMultiLine();
// TODO(floitsch): Do we really need a StringBuffer to accumulate the characters?
- StringBuffer tokenValueBuffer = new StringBuffer();
+ StringBuilder tokenValueBuffer = new StringBuilder();
while (true) {
if (isEos()) {
// Unterminated string (either multi-line or not).
@@ -880,6 +880,11 @@ public class DartScanner {
advance();
break;
}
+ } else if (c == '\n' && !multiLine) {
codefu 2012/02/16 18:59:38 Will this catch the case on windows as well?
scheglov 2012/02/16 19:13:26 Yes, on Windows \r\n is used.
+ advance();
+ internalState.popMode();
+ // unterminated (non multi-line) string
+ return Token.ILLEGAL;
}
tokenValueBuffer.appendCodePoint(c);
}
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/parser/ParserEventsTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698