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

bug: using typeof in declarations leads to error nodes #236

Open
2 tasks done
ashamedbit opened this issue Oct 9, 2024 · 0 comments
Open
2 tasks done

bug: using typeof in declarations leads to error nodes #236

ashamedbit opened this issue Oct 9, 2024 · 0 comments
Labels

Comments

@ashamedbit
Copy link

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-c

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

0.23.1

Describe the bug

When using typeof inside parameter declaration it leads to error nodes

Steps To Reproduce/Bad Parse Tree

declaration [0, 0] - [0, 41]
type_qualifier [0, 0] - [0, 5]
type: type_identifier [0, 6] - [0, 12]
declarator: parenthesized_declarator [0, 12] - [0, 38]
parenthesized_declarator [0, 14] - [0, 29]
parenthesized_declarator [0, 15] - [0, 27]
identifier [0, 16] - [0, 22]
ERROR [0, 23] - [0, 26]
identifier [0, 23] - [0, 24]
ERROR [0, 27] - [0, 28]
number_literal [0, 27] - [0, 28]
ERROR [0, 29] - [0, 36]
identifier [0, 31] - [0, 36]
ERROR [0, 39] - [0, 40]

Expected Behavior/Parse Tree

The below code is compilable but leads to misparsing with error nodes in treesitter.

Repro

struct X{
    int _head;
};

int main()
{
    const typeof( ((struct X *)0)->_head ) x;
}
@ashamedbit ashamedbit added the bug label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant