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: Error nodes when va_arg is used with pointer types #229

Open
2 tasks done
ashamedbit opened this issue Sep 7, 2024 · 1 comment
Open
2 tasks done

bug: Error nodes when va_arg is used with pointer types #229

ashamedbit opened this issue Sep 7, 2024 · 1 comment
Labels

Comments

@ashamedbit
Copy link

ashamedbit commented Sep 7, 2024

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.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 *);
}
@ashamedbit ashamedbit added the bug label Sep 7, 2024
@ObserverOfTime
Copy link
Member

It's not the pointer type, it's the type. The parser does not consider types to be valid function arguments.

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

2 participants