language-javascript-semantic
language-javascript-semantic copied to clipboard
Update Acorn for ES6 users
The version of acorn bundled with this package does not properly highlight ES6 syntax like keywords such as const, let, and class or features like template strings. The latest version of acorn supports the new ES6 syntax.
It would also be great for early adopters if ES7 could also be supported. What is the process you used to get the acorn-modified.js file from the acorn project? I could grab it and submit a pull request if you want, and if you don't want a pull request I would still like to know so I can use it in my local project.
acorn-modified.js is based on acorn.js from Acorn's commit 7f0f07e1f9c227d61147f2962f3418149b55e66a. If you diff the two you should see exactly what has been changed.
It boils down to the two points mentioned in the README:
- Support for tokenizing unterminated multi-line comments (required to allow incremental, i.e. line-by-line, tokenizing)
- Reverting to regex- rather than eval-based keyword recognition to work around Atom Shell's CSP restrictions
Of course, I will happily accept any pull request that advances the project! :+1:
@p-e-w You might want to consider Acorn's loose parser and/or plugin system, and the eval problem can be solved with Atom's loophole module (which uses Node's vm module behind the scenes).