Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
tree-sitter 0.25.4 (726dcd1e872149d95de581589fc408fb8ea9cb0b)
Describe the bug
The C base prefixes '0', '0x' and '0b' seem to be mentioned twice in the grammar and hence for some combinations, something with two prefixes parses as a valid number_literal. For example, this passes the tests
=====
Bogus
=====
double a = {
0x0xAC00,
0x0b1010001,
0b0xabc00ull
};
-----
(translation_unit
(declaration
(primitive_type)
(init_declarator
(identifier)
(initializer_list
(number_literal)
(number_literal)
(number_literal)))))
Note that 0x0b1010001 is a valid C literal, it's hex B1010001. The others however are not.
Expected Behavior/Parse Tree
Expected an error.
Repro
run the above with `tree-sitter test -r`
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version)tree-sitter 0.25.4 (726dcd1e872149d95de581589fc408fb8ea9cb0b)
Describe the bug
The C base prefixes '0', '0x' and '0b' seem to be mentioned twice in the grammar and hence for some combinations, something with two prefixes parses as a valid number_literal. For example, this passes the tests
Note that 0x0b1010001 is a valid C literal, it's hex B1010001. The others however are not.
Expected Behavior/Parse Tree
Expected an error.
Repro