[Pkg-javascript-commits] [node-acorn-jsx] 343/484: Loose: fix #33.

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:53 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 6bf8311061807e719bfa4c6efe156e8db7214bca
Author: Ingvar Stepanyan <me at rreverser.com>
Date:   Fri Oct 31 01:09:21 2014 +0200

    Loose: fix #33.
---
 acorn_loose.js | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/acorn_loose.js b/acorn_loose.js
index 261d9e7..4c5806a 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -59,15 +59,14 @@
   var lastEnd, token = {start: 0, end: 0}, ahead = [];
   var curLineStart, nextLineStart, curIndent, lastEndLoc, sourceFile;
 
-  function next() {
+  function next(forceRegexp) {
     lastEnd = token.end;
     if (options.locations)
       lastEndLoc = token.endLoc;
+    if (forceRegexp)
+      ahead.length = 0;
 
-    if (ahead.length)
-      token = ahead.shift();
-    else
-      token = readToken();
+    token = ahead.shift() || readToken(forceRegexp);
 
     if (token.start >= nextLineStart) {
       while (token.start >= nextLineStart) {
@@ -78,10 +77,10 @@
     }
   }
 
-  function readToken() {
+  function readToken(forceRegexp) {
     for (;;) {
       try {
-        var tok = fetchToken();
+        var tok = fetchToken(forceRegexp);
         if (tok.type === tt.dot && input.substr(tok.end, 1) === '.') {
           tok = fetchToken();
           tok.start--;
@@ -309,6 +308,9 @@
   }
 
   function parseStatement() {
+    if (token.type === tt.slash || token.type === tt.assign && token.value === "/=")
+      next(true);
+
     var starttype = token.type, node = startNode();
 
     switch (starttype) {

-- 
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