bug: Error nodes when va_arg is used with pointer types
Did you check existing issues?
- [X] I have read all the tree-sitter docs if it relates to using the parser
- [X] I have searched the existing issues of tree-sitter-c
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
0.23.0
Describe the bug
Using va_arg with a pointer type results in error nodes
Steps To Reproduce/Bad Parse Tree
translation_unit [0, 0] - [6, 0] preproc_include [0, 0] - [1, 0] path: system_lib_string [0, 9] - [0, 19] function_definition [2, 0] - [5, 1] type: primitive_type [2, 0] - [2, 3] declarator: function_declarator [2, 4] - [2, 10] declarator: identifier [2, 4] - [2, 8] parameters: parameter_list [2, 8] - [2, 10] body: compound_statement [2, 10] - [5, 1] declaration [3, 4] - [3, 17] type: type_identifier [3, 4] - [3, 11] declarator: identifier [3, 12] - [3, 16] expression_statement [4, 4] - [4, 31] call_expression [4, 4] - [4, 30] function: identifier [4, 4] - [4, 10] arguments: argument_list [4, 10] - [4, 30] identifier [4, 11] - [4, 15] identifier [4, 17] - [4, 22] ERROR [4, 23] - [4, 29] identifier [4, 23] - [4, 27]
Expected Behavior/Parse Tree
No error nodes in the tree. The code is compilable C code
Repro
#include <stdarg.h>
int main(){
va_list args;
va_arg(args, const char *);
}
It's not the pointer type, it's the type. The parser does not consider types to be valid function arguments.
Should tree sitter handle va_arg as a special node similar to sizeof and offsetof? It is a builtin C language feature.