Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(grammar update required) JavaScript parsing error: Error parsing source code at ... #326

Open
Sec-ant opened this issue May 12, 2024 · 4 comments

Comments

@Sec-ant
Copy link
Contributor

Sec-ant commented May 12, 2024

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

@Sec-ant
Copy link
Contributor Author

Sec-ant commented May 16, 2024

tree sitter javascript tree sitter typescript
image image

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.

@Sec-ant Sec-ant closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
@morgante
Copy link
Contributor

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.

@Sec-ant
Copy link
Contributor Author

Sec-ant commented May 16, 2024

FYI: The tree-sitter-typescript bug is quickly fixed by its author: tree-sitter/tree-sitter-typescript#296

@morgante
Copy link
Contributor

Thanks, reopening this for us to update the grammar.

@morgante morgante reopened this May 16, 2024
@morgante morgante changed the title JavaScript parsing error: Error parsing source code at ... (grammar update required) JavaScript parsing error: Error parsing source code at ... May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants