We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
tree-sitter --version
https://tree-sitter.github.io/tree-sitter/7-playground.html
Incorrect parsing tree for variadic template function with pointer arguments.
Consider this snippet of code:
template <typename... Arg> void Method(Arg *...args) { (MethodImpl(args), ...); }
Arg *...args is parsed as binary expression and overall syntax tree for this function definition gets messed up.
Arg *...args
Hopefully this can be parsed with less breaking error. Thank you!
translation_unit [0, 0] - [5, 0] template_declaration [0, 0] - [1, 25] parameters: template_parameter_list [0, 9] - [0, 26] variadic_type_parameter_declaration [0, 10] - [0, 25] type_identifier [0, 22] - [0, 25] declaration [1, 0] - [1, 25] type: primitive_type [1, 0] - [1, 4] declarator: init_declarator [1, 5] - [1, 25] declarator: identifier [1, 5] - [1, 11] value: argument_list [1, 11] - [1, 25] binary_expression [1, 12] - [1, 24] left: identifier [1, 12] - [1, 15] ERROR [1, 17] - [1, 20] right: identifier [1, 20] - [1, 24] MISSING ";" [1, 25] - [1, 25] compound_statement [2, 0] - [4, 1] expression_statement [3, 4] - [3, 28] fold_expression [3, 4] - [3, 27] left: call_expression [3, 5] - [3, 21] function: identifier [3, 5] - [3, 15] arguments: argument_list [3, 15] - [3, 21] identifier [3, 16] - [3, 20]
Expected to parse to function_definition
function_definition
translation_unit [0, 0] - [5, 0] template_declaration [0, 0] - [4, 1] parameters: template_parameter_list [0, 9] - [0, 26] variadic_type_parameter_declaration [0, 10] - [0, 25] type_identifier [0, 22] - [0, 25] function_definition [1, 0] - [4, 1] type: primitive_type [1, 0] - [1, 4] declarator: function_declarator [1, 5] - [1, 25] declarator: identifier [1, 5] - [1, 11] parameters: parameter_list [1, 11] - [1, 25] variadic_parameter_declaration [1, 12] - [1, 24] type: type_identifier [1, 12] - [1, 15] declarator: pointer_declarator [1, 16] - [1, 24] variadic_declarator [1, 17] - [1, 24] identifier [1, 20] - [1, 24] body: compound_statement [2, 0] - [4, 1] expression_statement [3, 4] - [3, 28] fold_expression [3, 4] - [3, 27] left: call_expression [3, 5] - [3, 21] function: identifier [3, 5] - [3, 15] arguments: argument_list [3, 15] - [3, 21] identifier [3, 16] - [3, 20]
template <typename Arg> void MethodImpl(Arg *args) { /* ... */ } // Code that fails to parse, or causes an error template <typename... Arg> void Method(Arg *...args) { (MethodImpl(args), ...); } int main() { return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)https://tree-sitter.github.io/tree-sitter/7-playground.html
Describe the bug
Incorrect parsing tree for variadic template function with pointer arguments.
Consider this snippet of code:
Arg *...args
is parsed as binary expression and overall syntax tree for this function definition gets messed up.Hopefully this can be parsed with less breaking error. Thank you!
Steps To Reproduce/Bad Parse Tree
Expected Behavior/Parse Tree
Expected to parse to
function_definition
Repro
The text was updated successfully, but these errors were encountered: