[Pkg-javascript-commits] [node-acorn-jsx] 300/484: [loose parser] Ignore shebang lines

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:46 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 437ce2d9bee35bcccfcf9912040a418f8125fbea
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Tue Oct 21 12:35:06 2014 +0200

    [loose parser] Ignore shebang lines
    
    Closes marijnh/tern#408
---
 acorn_loose.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/acorn_loose.js b/acorn_loose.js
index d94fb46..09fbf21 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -43,9 +43,11 @@
   exports.parse_dammit = function(inpt, opts) {
     if (!opts) opts = {};
     input = String(inpt);
+    if (/^#!.*/.test(input)) input = "//" + input.slice(2);
+
     options = opts;
     if (!opts.tabSize) opts.tabSize = 4;
-    fetchToken = acorn.tokenize(inpt, opts);
+    fetchToken = acorn.tokenize(input, opts);
     sourceFile = options.sourceFile || null;
     context = [];
     nextLineStart = 0;

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