I'm attempting to use tree-sitter as the parser for a project, and running into some issues where #if/#elif/#else/#endif directives exist. One of the particular code patterns that seems to throw things off is (ignore the nonsensical logic, this is syntactically correct):
The XML output for tree-sitter-parser.py has an ERROR node in the resulting AST at the two else nodes within the #if directives, which causes the subsequent GumTreeDiff tree generation to fail. The cgum and srcML parsers seem to handle these just fine ~so I'm assuming there's something not handled correctly in the tree-sitter-to-XML conversion.~
I'm attempting to use
tree-sitter
as the parser for a project, and running into some issues where#if/#elif/#else/#endif
directives exist. One of the particular code patterns that seems to throw things off is (ignore the nonsensical logic, this is syntactically correct):The XML output for
tree-sitter-parser.py
has anERROR
node in the resulting AST at the twoelse
nodes within the #if directives, which causes the subsequent GumTreeDiff tree generation to fail. Thecgum
andsrcML
parsers seem to handle these just fine ~so I'm assuming there's something not handled correctly in the tree-sitter-to-XML conversion.~Update: Didn't think to look in the tree-sitter-c repo first, and it looks like this may be a known issue: https://github.com/tree-sitter/tree-sitter-c/issues/70
Closing since it's clearly not an issue with the XML generation wrapper.