tree-sitter / tree-sitter-c

C grammar for tree-sitter
MIT License
237 stars 106 forks source link

Parse tree misinterprets typedefs as function definitions when using extension keyword #160

Closed nikitam95 closed 1 year ago

nikitam95 commented 1 year ago

When parsing C code that uses the __extension__ keyword, the parse tree generated by Tree-sitter C language incorrectly treat typedef declarations as function definitions.

To Reproduce
Parse the following C code:

__extension__ typedef struct {  
  long long int quot;  
  long long int rem;  
} lldiv_t;  

Expected behavior The parse tree should correctly recognize that this is a typedef declaration and not a function definition.

amaanq commented 1 year ago

It's a gnu extension that we don't have added atm (__extension__ that is), feel free to PR support for it or I can in a bit