Fix parsing strings with literal DOS newlines
(should not set newline_before) Fix #693
This commit is contained in:
@@ -354,8 +354,13 @@ function tokenizer($TEXT, filename, html5_comments) {
|
|||||||
case 120 : return String.fromCharCode(hex_bytes(2)); // \x
|
case 120 : return String.fromCharCode(hex_bytes(2)); // \x
|
||||||
case 117 : return String.fromCharCode(hex_bytes(4)); // \u
|
case 117 : return String.fromCharCode(hex_bytes(4)); // \u
|
||||||
case 10 : return ""; // newline
|
case 10 : return ""; // newline
|
||||||
default : return ch;
|
case 13 : // \r
|
||||||
|
if (peek() == "\n") { // DOS newline
|
||||||
|
next(true, in_string);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return ch;
|
||||||
};
|
};
|
||||||
|
|
||||||
function hex_bytes(n) {
|
function hex_bytes(n) {
|
||||||
@@ -372,7 +377,7 @@ function tokenizer($TEXT, filename, html5_comments) {
|
|||||||
var read_string = with_eof_error("Unterminated string constant", function(quote_char){
|
var read_string = with_eof_error("Unterminated string constant", function(quote_char){
|
||||||
var quote = next(), ret = "";
|
var quote = next(), ret = "";
|
||||||
for (;;) {
|
for (;;) {
|
||||||
var ch = next(true);
|
var ch = next(true, true);
|
||||||
if (ch == "\\") {
|
if (ch == "\\") {
|
||||||
// read OctalEscapeSequence (XXX: deprecated if "strict mode")
|
// read OctalEscapeSequence (XXX: deprecated if "strict mode")
|
||||||
// https://github.com/mishoo/UglifyJS/issues/178
|
// https://github.com/mishoo/UglifyJS/issues/178
|
||||||
|
|||||||
Reference in New Issue
Block a user