hex13 / lupa

Analysis tool for JavaScript
MIT License
8 stars 0 forks source link

hashbang in JS files causes error #11

Open hex13 opened 8 years ago

hex13 commented 8 years ago

when parsing with Acorn:

#!/usr/bin/env node                                                                                                                                       
// ... rest of file

SyntaxError: Unexpected character '#' (1:0) at Parser.pp.raise (/Users/lukasz/sandbox/lupa/node_modules/acorn/dist/acorn.js:920:13)

hex13 commented 8 years ago

ok. Acorn has option allowHashBang (When this is enabled (off by default), if the code starts with the characters #! (as in a shellscript), the first line will be treated as a comment) https://github.com/ternjs/acorn

hex13 commented 8 years ago

Added option and it works, but test is needed to avoid errors in future.