Regular expression to match calls (C)

Does anyone have a regex to match function calls in C programs?

+3
source share
3 answers

After a bit more searching, I decided to give the compiler hard work.

Get a compiler to create a Register Transfer Language (RTL) file using the -dr gcc options.

The resulting RTL file has the suffix .rtl or .expand.

This file is much easier to parse because function calls are already identified.

+2
source

Since C is not a regular language , and calls to C functions may contain arbitrary argument expressions, I am afraid that the answer to your question will be no.

+3

I doubt that you can find a regular expression that matches all (and only) function calls in some source code. But perhaps you could use a tool like Understand or your IDE to view your code.

+1
source

Source: https://habr.com/ru/post/1696636/


All Articles