Closed leath-dub closed 3 months ago
this is a known limitation of the C parser - unfortunately macros require too much contextual info for them to be parsable
this is a known limitation of the C parser - unfortunately macros require too much contextual info for them to be parsable
Yeah as I was writing this, I realised it is not really feasibly possible to account for arbitrary string replacement in a parser. Very understandable
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)0.22.1
Describe the bug
On my system (Fedora 38), when you run
tree-sitter parse
on a basic c standard library header, for examplestdio.h
. You will find quite a lot of syntax errors related to macros like this:This causes a syntax error in the c parser when parsing the usage of
FOO
. This is problematic for my project as I extract any syntax errors and raise them generically if not handled in my program. With this I can't even parsestdio.h
without needed to add weird edge cases on where to ignore syntax errors.Steps To Reproduce/Bad Parse Tree
tree-sitter parse
on the following minimal source:Expected Behavior/Parse Tree
I would expect it to have no errors
Repro