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: Incorrect handling for TRUE statements #238

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

bug: Incorrect handling for TRUE statements #238

ashamedbit opened this issue Oct 15, 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.22.3

Describe the bug

When the argument TRUE is used it identifies it as a boolean when it could be an identifier.
Note; that stdbool defines only 'true' not 'TRUE'.

Steps To Reproduce/Bad Parse Tree

static const char TRUE = "a";
B312 = (SinCosSeries(TRUE, ssig2, csig2, Ca, 6 -1) -
SinCosSeries(TRUE, ssig1, csig1, Ca, 6 -1));

translation_unit [0, 0] - [3, 0]
declaration [0, 0] - [0, 29]
storage_class_specifier [0, 0] - [0, 6]
type_qualifier [0, 7] - [0, 12]
type: primitive_type [0, 13] - [0, 17]
declarator: init_declarator [0, 18] - [0, 28]
declarator: identifier [0, 18] - [0, 22]
value: string_literal [0, 25] - [0, 28]
string_content [0, 26] - [0, 27]
expression_statement [1, 0] - [2, 54]
assignment_expression [1, 0] - [2, 53]
left: identifier [1, 0] - [1, 4]
right: parenthesized_expression [1, 7] - [2, 53]
binary_expression [1, 8] - [2, 52]
left: call_expression [1, 8] - [1, 50]
function: identifier [1, 8] - [1, 20]
arguments: argument_list [1, 20] - [1, 50]
true [1, 21] - [1, 25]
identifier [1, 27] - [1, 32]
identifier [1, 34] - [1, 39]
identifier [1, 41] - [1, 43]
binary_expression [1, 45] - [1, 49]
left: number_literal [1, 45] - [1, 46]
right: number_literal [1, 48] - [1, 49]
right: call_expression [2, 10] - [2, 52]
function: identifier [2, 10] - [2, 22]
arguments: argument_list [2, 22] - [2, 52]
true [2, 23] - [2, 27]
identifier [2, 29] - [2, 34]
identifier [2, 36] - [2, 41]
identifier [2, 43] - [2, 45]
binary_expression [2, 47] - [2, 51]
left: number_literal [2, 47] - [2, 48]
right: number_literal [2, 50] - [2, 51]

Expected Behavior/Parse Tree

TRUE should be an identifier in this case

Repro

static const char TRUE = "a";
B312 = (SinCosSeries(TRUE, ssig2, csig2, Ca, 6 -1) -
          SinCosSeries(TRUE, ssig1, csig1, Ca, 6 -1));
@ashamedbit ashamedbit added the bug label Oct 15, 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