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

Parse failed when declare function signature in preprocess_if #63

Open
QthCN opened this issue Apr 6, 2021 · 0 comments
Open

Parse failed when declare function signature in preprocess_if #63

QthCN opened this issue Apr 6, 2021 · 0 comments

Comments

@QthCN
Copy link

QthCN commented Apr 6, 2021

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])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant