-
-
Notifications
You must be signed in to change notification settings - Fork 116
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: Comma operator in conditional_expression #187
Comments
Also to be able to parse preprocessed
|
With all the above changes the remaining problem to parse preprocessed
And it seems that is something related with
Grammar:
|
Also the
|
I found the problem with
|
Also adding a rule for
|
I don't think we want to consider preprocessed code files, that's just asking to handle too much with compiler intrinsics, line markers, etc |
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)tree-sitter 0.20.9 (df1fe842eb08232f4119deba7aae973b7782530d)
Describe the bug
While testing this parser with
sqlite3.c
preprocessed I found this problem and also this related issue #31 and following it's solution I changed the grammar like shown bellow and got it to parse (probably the same apply to several other places).Steps To Reproduce/Bad Parse Tree
tree-sitter parse test-cond.c
Expected Behavior/Parse Tree
(translation_unit [0, 0] - [1, 0]
(expression_statement [0, 0] - [0, 20]
(assignment_expression [0, 0] - [0, 19]
left: (identifier [0, 0] - [0, 1])
right: (conditional_expression [0, 4] - [0, 19]
condition: (identifier [0, 4] - [0, 7])
consequence: (comma_expression [0, 10] - [0, 15]
left: (assignment_expression [0, 10] - [0, 13]
left: (identifier [0, 10] - [0, 11])
right: (number_literal [0, 12] - [0, 13]))
right: (number_literal [0, 14] - [0, 15]))
alternative: (number_literal [0, 18] - [0, 19])))))
Repro
The text was updated successfully, but these errors were encountered: