Does anyone have a regular expression for matching function calls in C programs ?
+3
A:
Since C isn't a regular language and C function calls can contain arbitrary argument expressions, I fear the answer to your question is “no.”
Konrad Rudolph
2008-09-02 13:10:49
+1
A:
I doubt you can find a regex that matches all (and only) the function calls in some source code. But maybe you could use a tool like Understand, or your IDE, to browse your code.
Xavier Nodet
2008-09-02 14:53:00
+2
A:
After a bit more searching I decided to let the compiler do the hard work.
Get the compiler to produce a Register Transfer Language (RTL) file using the -dr options of gcc.
The produced RTL file has the suffix .rtl or .expand.
This file is far easier to parse as the functions calls are already identified.
David
2008-09-02 17:29:06