You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was introduced in 0.20.0, the 0.19.0 grammar gave an ERROR node: 39b534f
I am not sure that declarations should be allowed in export default. I'd be happy if you can point me to the specification you're following when working on the grammar, so I can triple-check before opening issues
The parser not marking syntax errors as such is not a big problem, like in this kind of issues. The consuming code can assume it won't happen.
In this issue, the consuming code has to adapt to the new grammar, because export default function foo() { } contains a function_declaration instead of a function. I worked around like this:
switch(node.type):
case"class-declaration":
case"function-declaration":
// valid because 'class' and 'function' node types existcase"variable-declaration":
case"module-declaration":
default:
// syntax error
The text was updated successfully, but these errors were encountered:
I think in general it's ok if the tree-sitter parser accepts more programs than it should. Maybe @maxbrunsfeld are more specific guidelines regarding this.
If we can fix this in a way that simplifies the parser (reducing the state count), then that would be great. But if it would complicate the parser, then I'm inclined to leave it as-is.
Hi!
The following piece of code is invalid but it is parsed correctly:
Here's a link to the TypeScript Playground showing that the snippet above is invalid JavaScript or TypeScript:
https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBAE2AMwIYFcA29PHquAXjgBYAmAbiA
The output of
tree-sitter parse
is the following:This issue was introduced in 0.20.0, the 0.19.0 grammar gave an
ERROR
node: 39b534fI am not sure that declarations should be allowed in
export default
. I'd be happy if you can point me to the specification you're following when working on the grammar, so I can triple-check before opening issuesThe parser not marking syntax errors as such is not a big problem, like in this kind of issues. The consuming code can assume it won't happen.
In this issue, the consuming code has to adapt to the new grammar, because
export default function foo() { }
contains afunction_declaration
instead of afunction
. I worked around like this:The text was updated successfully, but these errors were encountered: