gkz / grasp

JavaScript structural search, replace, and refactor
http://graspjs.com
MIT License
1.28k stars 33 forks source link

syntax extension api/configuration support #14

Closed davidmarkclements closed 10 years ago

davidmarkclements commented 10 years ago

In light of #12, #13 perhaps a way to explicitly declare additional syntax would be favorable - this could take a few different forms

1) a way to literally declare syntax and extend the api 2) a way to turn non-standard or yet-to-be-a-standard syntax on/off 3) a single "harmony" (?) option that turns es6 stuff on

gkz commented 10 years ago

As I mentioned in #12, Grasp uses acorn to parse JavaScript. Once acorn supports ES6, it will only take a couple of additional lines in grasp-syntax-javascript for Grasp to support it as well.

Also, you can currently use the parser to specify a different parser, and the engine option to specify a different query engine. In the future, the plan is to simply have to identify a parser and a syntax file.

davidmarkclements commented 10 years ago

@gkz that's awesome, thanks for covering these so fast :)

gkz commented 10 years ago

Now we just have to encourage/contribute toward ES6 support in acorn :)