Skip to content

bug: wrong parse tree for new array of pointers #289

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

Open
2 tasks done
uriyay-jfrog opened this issue Sep 18, 2024 · 0 comments
Open
2 tasks done

bug: wrong parse tree for new array of pointers #289

uriyay-jfrog opened this issue Sep 18, 2024 · 0 comments
Labels

Comments

@uriyay-jfrog
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-cpp

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

No response

Describe the bug

Currently parsing of:
int** arrayOfPointers = new int*[10];
is wrong.
Since declarator can only be new_declarator and not a list of declarators which one of them is new_declarator

Steps To Reproduce/Bad Parse Tree

declaration [0, 0] - [0, 37]
type: primitive_type [0, 0] - [0, 3]
declarator: init_declarator [0, 3] - [0, 31]
declarator: pointer_declarator [0, 3] - [0, 21]
declarator: pointer_declarator [0, 4] - [0, 21]
declarator: identifier [0, 6] - [0, 21]
value: new_expression [0, 24] - [0, 31]
type: primitive_type [0, 28] - [0, 31]
ERROR [0, 31] - [0, 36]
lambda_capture_specifier [0, 32] - [0, 36]
number_literal [0, 33] - [0, 35]

Expected Behavior/Parse Tree

Maybe add more declarators for new_expression besides new_declarator?

Repro

int** arrayOfPointers = new int*[10];
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