tree-sitter-c
tree-sitter-c copied to clipboard
Parse failed when declare function signature in preprocess_if
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, 0] - [5, 6]
name: (identifier [1, 8] - [1, 23])
(declaration [2, 0] - [2, 33]
(storage_class_specifier [2, 0] - [2, 6])
type: (type_identifier [2, 7] - [2, 14])
declarator: (function_declarator [2, 15] - [2, 33]
declarator: (identifier [2, 15] - [2, 22])
parameters: (parameter_list [2, 22] - [2, 33]
(parameter_declaration [2, 23] - [2, 32]
type: (type_identifier [2, 23] - [2, 30])
declarator: (identifier [2, 31] - [2, 32])))))
alternative: (preproc_else [3, 0] - [4, 32]
(declaration [4, 0] - [4, 32]
(storage_class_specifier [4, 0] - [4, 6])
type: (type_identifier [4, 7] - [4, 14])
declarator: (function_declarator [4, 15] - [4, 32]
declarator: (identifier [4, 15] - [4, 21])
parameters: (parameter_list [4, 21] - [4, 32]
(parameter_declaration [4, 22] - [4, 31]
type: (type_identifier [4, 22] - [4, 29])
declarator: (identifier [4, 30] - [4, 31])))))))
(compound_statement [6, 0] - [8, 1]))
/tmp/aa.c 0 ms (MISSING ";" [2, 33] - [2, 33])