python正则表达式,用来搜索Cpp文件中的函数头,并且提取类名和函数名
pat = re.compile( r'''
( #first gorup for the whole string
( #2nd group for class and function name
/w+::[/w~]+ # Class Name and function name
)
/([^/)]*/) # funciton parameters with braces
/s* # blank or CRLN
(?:[/w/s/(/):,/*=]+)?
# initialization list of constructor
# ? is used to disable group
{ # funtion block
)''', re.VERBOSE)
lstMatchRes = pat.findall(s) # s in content of cpp file
lstMatchRes will be a list of [("class_name::function_name1", ), ("class_name::function_name2", ) ]