tree-sitter-c
tree-sitter-c copied to clipboard
C grammar for tree-sitter
Versions: ``` [email protected] [email protected] ``` Code to reproduce this issue: ```c #include int main() { int i; scanf("%d", &i); if (i > 10) { printf("big\n"); } #ifdef ONE_MORE_CHANCE else {...
Currently parser is only able to successfully parse terminated statements, like: ```c const char * myarray[25]; ``` But if you feed something like ```c const char * [25] ``` or...
I'm using this string: `"#define a \n"`. The following is a list representation of the parse tree including the unnamed nodes: ```lisp (:TRANSLATION-UNIT ((0 0) (0 1)) ((:PREPROC-DEF ((0 0)...
C codes: ``` #ifndef LTC_CLEAN_STACK static ulong32 _g_func(ulong32 x) #else static ulong32 g_func(ulong32 x) #endif { } ``` tree-sitter parse output: ``` (translation_unit [1, 0] - [9, 0] (preproc_ifdef [1,...
Based on https://github.com/tree-sitter/tree-sitter-cpp/issues/105 When parsing C or C++ it is mostly possible to reconstruct semantically equivalent code by printing the content of leaf nodes with appropriate whitespace. However during this...
The parse trees for certain expressions involving `sizeof ` and the ternary conditional operator are wrong. Consider the following examples: For `sizeof`, this... ``` void f(void) { int a; a...
When run on a C standard header which defines `size_t`: ```c typedef unsigned long size_t; ``` Output is: ``` translation_unit [0, 0] - [1, 0]) type_definition [0, 0] - [0,...
For example from [libclipboard.h](https://github.com/jtanx/libclipboard/blob/master/include/libclipboard.h): ```c LCB_API clipboard_c *LCB_CC clipboard_new(clipboard_opts *cb_opts); ``` Here, LCB_API is a preprocessor attribute: ```c #ifdef LIBCLIPBOARD_BUILD_SHARED # ifdef clipboard_EXPORTS /* Defined by CMake when we're compiling...
It would be useful to have a list of repos and their parsing status, similar to the "Java grammar finish line" here https://github.com/tree-sitter/tree-sitter-java/issues/27. I've tried following repositories using the `"(ERROR)...
The following three cases create `cast_expression` nodes. ```c enum { a = ((char)(2)) }; ``` ```c enum { a = ((char)2) }; ``` ```c enum { a = ((abc)2) };...