The regular expression string in c_cplusplus.uew to find C++ functions is:
/TGFindStr = "[ ^t]++^([a-z_][a-z_0-9]++::[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)[~;]
"
This regular expression means simplified:
- Find a string starting at beginning of a line or anywhere else after a space or tab character,
- which begins with a letter or an underscore (first character of class name),
- consists further of only letters, digits and underscores (other characters of class name),
- then :: must follow,
- the next character must be a letter or an underscore or ~ (first character of function name or destructor operator),
- consists further of only letters, digits and underscores (other characters of function name),
- and zero or more spaces, tabs or line terminators follow the function name,
- then an opening and closing round bracket must be found with lots of possible characters inside (function parameters and block comments),
- and the next character after the closing round bracket must not be a semicolon.
All these requirements are fulfilled by
CRobot::Drive() inside the string printed with printf function. The expression does not evaluate what is left the class name. This is important for example for
CRobot::CRobot() where nothing is left the function definition. Other functions have a return type which should be ignored for finding the function definitions. Also what is right after closing round bracket and the following character is not analyzed further because many programmers write comments there which can contain everything.
You could use following 2 lines instead of the single line above:
/TGFindStr = "%[ ^t]++^([a-z_][a-z_0-9]++::[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)[~;]"
/TGFindStr = "%[a-z0-9_*&]+[ ^t]+^([a-z_][a-z_0-9]++::[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)[~;]"
Now only ClassName::FunctionName at begining of a line after optional preceding whitespaces (first expression) or after a return type consisting only of letters, digits, underscores, asterisk or ampersand are found (second expression). That excludes the ClassName::FunctionName string inside the printf function. But something like
int * ClassName::FunctionName1()
is now also excluded while
int* ClassName::FunctionName2()
is found and displayed in the function list view. To find also ClassName::FunctionName1 one more regular expression string is needed:
/TGFindStr = "%[a-z0-9_]+[ ^t]+^*[ ^t]+^([a-z_][a-z_0-9]++::[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)[~;]"
You see, there is no single regular expression which works for everyone for every C/C++ file. The function definition variants are too much. It is good practice to adapt all the regular expression strings in the wordfile to personal coding style with as less regular expression strings as possible.