[Pkg-javascript-commits] [node-acorn-jsx] 425/484: Merge branch 'upstream' into jsx2

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:21:05 UTC 2017


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

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit c445d073e25b4f13804d2b6d4c759b77dbfa9e02
Merge: de23a86 5d96bbd
Author: Ingvar Stepanyan <me at rreverser.com>
Date:   Sun Jan 25 00:20:02 2015 +0200

    Merge branch 'upstream' into jsx2
    
    Conflicts:
    	acorn.js

 acorn.js              |  427 ++++----
 acorn_loose.js        |  147 ++-
 test/driver.js        |    5 +-
 test/tests-harmony.js | 2721 ++++++++++++++++++++++++++-----------------------
 test/tests.js         |  148 ++-
 util/walk.js          |    8 +-
 6 files changed, 1814 insertions(+), 1642 deletions(-)

diff --cc acorn.js
index 4ee7488,847a6ba..9998818
--- a/acorn.js
+++ b/acorn.js
@@@ -638,8 -628,7 +636,8 @@@
  
    var b_stat = {token: "{", isExpr: false}, b_expr = {token: "{", isExpr: true}, b_tmpl = {token: "${", isExpr: true};
    var p_stat = {token: "(", isExpr: false}, p_expr = {token: "(", isExpr: true};
-   var q_tmpl = {token: "`", isExpr: true};
+   var q_tmpl = {token: "`", isExpr: true}, f_expr = {token: "function", isExpr: true};
 +  var j_oTag = {token: "<tag", isExpr: false}, j_cTag = {token: "</tag", isExpr: false}, j_expr = {token: "<tag>...</tag>", isExpr: true};
  
    function curTokContext() {
      return tokContext[tokContext.length - 1];
@@@ -677,8 -662,14 +675,16 @@@
      // Update context info
      if (type === _parenR || type === _braceR) {
        var out = tokContext.pop();
-       tokExprAllowed = !(out && out.isExpr);
-       preserveSpace = out === b_tmpl || curTokContext() === j_expr;
+       if (out === b_tmpl) {
+         preserveSpace = true;
++      } else if (curTokContext() === j_expr) {
++        preserveSpace = tokExprAllowed = true;
+       } else if (out === b_stat && curTokContext() === f_expr) {
+         tokContext.pop();
+         tokExprAllowed = false;
+       } else {
+         tokExprAllowed = !(out && out.isExpr);
+       }
      } else if (type === _braceL) {
        tokContext.push(braceIsBlock(prevType) ? b_stat : b_expr);
        tokExprAllowed = true;
@@@ -1167,28 -1120,22 +1176,27 @@@
    }
  
    function readString(quote) {
 +    var isJSX = curTokContext() === j_oTag;
-     ++tokPos;
-     var out = "";
+     var out = "", chunkStart = ++tokPos;
      for (;;) {
        if (tokPos >= inputLen) raise(tokStart, "Unterminated string constant");
        var ch = input.charCodeAt(tokPos);
-       if (ch === quote) {
-         ++tokPos;
-         return finishToken(_string, out);
-       }
+       if (ch === quote) break;
 -      if (ch === 92) { // '\'
 +      if (ch === 92 && !isJSX) { // '\'
+         out += input.slice(chunkStart, tokPos);
          out += readEscapedChar();
+         chunkStart = tokPos;
 +      } else if (ch === 38 && isJSX) { // '&'
++        out += input.slice(chunkStart, tokPos);
 +        out += readJSXEntity();
++        chunkStart = tokPos;
        } else {
+         if (isNewLine(ch)) raise(tokStart, "Unterminated string constant");
          ++tokPos;
-         if (isNewLine(ch)) {
-           raise(tokStart, "Unterminated string constant");
-         }
-         out += String.fromCharCode(ch); // '\'
        }
      }
+     out += input.slice(chunkStart, tokPos++);
+     return finishToken(_string, out);
    }
  
    // Reads template string tokens.

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



More information about the Pkg-javascript-commits mailing list