[loose parser] Ignore shebang lines

Closes marijnh/tern#408
This commit is contained in:
Marijn Haverbeke 2014-10-21 12:35:06 +02:00
parent ad69446c0a
commit 437ce2d9be

View File

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