Closed huanie closed 3 weeks ago
tree-sitter --version
No response
declaration or expression statement?
typedef int T; void f(void) { T * b; }
int T, b; void f(void) { T * b; }
(translation_unit (function_definition type: (primitive_type) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list ( (parameter_declaration type: (primitive_type)) ))) body: (compound_statement { (declaration type: (type_identifier) declarator: (pointer_declarator * declarator: (identifier)) ;) (return_statement return (number_literal) ;) })))
(translation_unit (function_definition type: (primitive_type) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list ( (parameter_declaration type: (primitive_type)) ))) body: (compound_statement { (expression_statement (binary_expression left: (identifier) operator: * right: (identifier)) ;) (return_statement return (number_literal) ;) })))
int main(void) { a * b; return 0; }
when it comes to true ambiguous situations like this one, you need context-aware information about the source code beforehand, which tree-sitter does not have that a compiler like clang does. this can't be solved.
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)No response
Describe the bug
declaration or expression statement?
Steps To Reproduce/Bad Parse Tree
Expected Behavior/Parse Tree
Repro