how to get the function declaration or definitions using regex

后端 未结 7 1032
野的像风
野的像风 2020-12-16 06:43

I want to get only function prototypes like

int my_func(char, int, float)
void my_func1(void)
my_func2()

from C files using regex and pytho

7条回答
  •  情书的邮戳
    2020-12-16 07:09

    The regular expression below consider also the definition of destructor or const functions:

    ^\s*\~{0,1}[\w_][\w\d_]*\s*.*\s*[\w_][\w\d_]*\s*\(.*\)\s*(const){0,1}$
    

提交回复
热议问题