Version 0.4.2.8 .
svn merge -c 20257 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@20259 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/sdk/lib/_internal/compiler/implementation/js/builder.dart b/sdk/lib/_internal/compiler/implementation/js/builder.dart
index 2e39690..5492466 100644
--- a/sdk/lib/_internal/compiler/implementation/js/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/js/builder.dart
@@ -260,10 +260,6 @@
'=', '!=', '==', '!==', '===', '<', '<=', '>=', '>'].toSet();
static final UNARY_OPERATORS = ['++', '--', '+', '-', '~', '!'].toSet();
- // For sanity we only allow \\, \', \" and \n in string literals.
- static final STRING_LITERAL_PATTERN =
- new RegExp('^[\'"](?:[^\\\\]|\\\\[\\\\n\'"])*[\'"]\$');
-
static int category(int code) {
if (code >= CATEGORIES.length) return OTHER;
return CATEGORIES[code];
@@ -294,16 +290,21 @@
if (++position >= src.length) {
throw new MiniJsParserError(this, "Unterminated string");
}
+ int escapedCode = src.codeUnitAt(position);
+ if (!(escapedCode == charCodes.$BACKSLASH ||
+ escapedCode == charCodes.$SQ ||
+ escapedCode == charCodes.$DQ ||
+ escapedCode == charCodes.$n)) {
+ throw new MiniJsParserError(
+ this,
+ 'Only escapes allowed in string literals are '
+ r'''\\, \', \" and \n''');
+ }
}
} while (currentCode != code);
lastCategory = STRING;
position++;
lastToken = src.substring(lastPosition, position);
- if (!STRING_LITERAL_PATTERN.hasMatch(lastToken)) {
- throw new MiniJsParserError(
- this,
- "Only escapes allowed in string literals are \\, \', \" and \n");
- }
} else {
int cat = category(src.codeUnitAt(position));
int newCat;
diff --git a/tools/VERSION b/tools/VERSION
index bed1eb1..c49f814 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
MAJOR 0
MINOR 4
BUILD 2
-PATCH 7
+PATCH 8