Closed ashamedbit closed 1 week ago
tree-sitter --version
0.22.3
Unable to get AST without error nodes for the following code which includes extension
The code that produces the bad parse tree is : *to = (char_u)((__extension__ ({int c; c=0;})));
*to = (char_u)((__extension__ ({int c; c=0;})));
It produces following tree:
[translation_unit](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [1, 0] [expression_statement](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [0, 48] [assignment_expression](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [0, 45] left: [pointer_expression](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [0, 3] argument: [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [0, 1] - [0, 3] right: [call_expression](https://tree-sitter.github.io/tree-sitter/playground#) [0, 6] - [0, 45] function: [parenthesized_expression](https://tree-sitter.github.io/tree-sitter/playground#) [0, 6] - [0, 14] [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [0, 7] - [0, 13] arguments: [argument_list](https://tree-sitter.github.io/tree-sitter/playground#) [0, 14] - [0, 45] [ERROR](https://tree-sitter.github.io/tree-sitter/playground#) [0, 15] - [0, 31] [type_qualifier](https://tree-sitter.github.io/tree-sitter/playground#) [0, 16] - [0, 29] [compound_statement](https://tree-sitter.github.io/tree-sitter/playground#) [0, 31] - [0, 44] [declaration](https://tree-sitter.github.io/tree-sitter/playground#) [0, 32] - [0, 38] type: [primitive_type](https://tree-sitter.github.io/tree-sitter/playground#) [0, 32] - [0, 35] declarator: [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [0, 36] - [0, 37] [expression_statement](https://tree-sitter.github.io/tree-sitter/playground#) [0, 39] - [0, 43] [assignment_expression](https://tree-sitter.github.io/tree-sitter/playground#) [0, 39] - [0, 42] left: [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [0, 39] - [0, 40] right: [number_literal](https://tree-sitter.github.io/tree-sitter/playground#) [0, 41] - [0, 42] [ERROR](https://tree-sitter.github.io/tree-sitter/playground#) [0, 45] - [0, 47]
It should not have error nodes within the correct parse tree. As it is perfectly compilable code.
// Example code that causes the issue void foo() { // Code that fails to parse, or causes an error }
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)0.22.3
Describe the bug
Unable to get AST without error nodes for the following code which includes extension
Steps To Reproduce/Bad Parse Tree
The code that produces the bad parse tree is :
*to = (char_u)((__extension__ ({int c; c=0;})));
It produces following tree:
Expected Behavior/Parse Tree
It should not have error nodes within the correct parse tree. As it is perfectly compilable code.
Repro