[Pkg-javascript-commits] [uglifyjs] 07/11: Fix parsing strings with literal DOS newlines

Jonas Smedegaard dr at jones.dk
Tue May 19 00:02:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag v2.4.21
in repository uglifyjs.

commit 92e4340732ba9b182e339896ffda0e13ef98e40a
Author: Mihai Bazon <mihai.bazon at gmail.com>
Date:   Thu Apr 23 12:08:19 2015 +0300

    Fix parsing strings with literal DOS newlines
    
    (should not set newline_before)
    
    Fix #693
---
 lib/parse.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/parse.js b/lib/parse.js
index 95a9f77..53aaabd 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -354,8 +354,13 @@ function tokenizer($TEXT, filename, html5_comments) {
           case 120 : return String.fromCharCode(hex_bytes(2)); // \x
           case 117 : return String.fromCharCode(hex_bytes(4)); // \u
           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) {
@@ -372,7 +377,7 @@ function tokenizer($TEXT, filename, html5_comments) {
     var read_string = with_eof_error("Unterminated string constant", function(quote_char){
         var quote = next(), ret = "";
         for (;;) {
-            var ch = next(true);
+            var ch = next(true, true);
             if (ch == "\\") {
                 // read OctalEscapeSequence (XXX: deprecated if "strict mode")
                 // https://github.com/mishoo/UglifyJS/issues/178

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list