gritql
gritql copied to clipboard
(grammar update required) JavaScript parsing error: Error parsing source code at ...
The JavaScript snippet below will trigger an Error parsing source code at ... error:
Code
true ? function(){return true} : function(){};
Error
Error Error parsing source code at 1:30 in /tmp/marzano-cli-d8845386-5e0c-4c15-b11f-6edccb7573ff/grit/example-1.js. This may cause otherwise applicable queries to not match.
If I add a semicolon after return true, the error disappears:
true ? function(){return true;} : function(){};
Reproduction
https://app.grit.io/studio?key=kBqInNBs5q0ZOx82gjWez
| tree sitter javascript | tree sitter typescript |
|---|---|
This seems to be a bug of the tree-sitter typescript grammar. No more errors will be thrown if I change the target language to js(js_do_not_use).
engine marzano(0.1)
language js(js_do_not_use)
`$body`
As this seems not a bug of gritql and has a workaround, I'm going to close this issue.
Thanks for the follow up, feel free to open an issue upstream and we will pull it in the next time we update the tree-sitter grammar.
FYI: The tree-sitter-typescript bug is quickly fixed by its author: https://github.com/tree-sitter/tree-sitter-typescript/issues/296
Thanks, reopening this for us to update the grammar.