jai has asked for the wisdom of the Perl Monks concerning the following question:
hi,
I have to write a perl program that lists out all the functions in a given C source file & prints the functions called by each of them. To match the called functions, I first had the regex
if((err=func1(a,b))!=0).
So I modified it to
(/([a-zA-Z][a-zA-Z0-9_-]*)\s*\([^)(]*\)/).
Still, it fails for functions called like this.
if((err=func1(a,b,(*c)()).
Is there any way to reliably parse them ? any help would be greatly appreciated.
jai
I have to write a perl program that lists out all the functions in a given C source file & prints the functions called by each of them. To match the called functions, I first had the regex
.But this failed to match the following:(/([a-zA-Z][a-zA-Z0-9_-]*)\s*\([^)]*\)/)
if((err=func1(a,b))!=0).
So I modified it to
(/([a-zA-Z][a-zA-Z0-9_-]*)\s*\([^)(]*\)/).
Still, it fails for functions called like this.
if((err=func1(a,b,(*c)()).
Is there any way to reliably parse them ? any help would be greatly appreciated.
jai
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: regex 2 find C function dependencies
by kvale (Monsignor) on Sep 19, 2003 at 05:44 UTC | |
Re: regex 2 find C function dependencies
by Abigail-II (Bishop) on Sep 19, 2003 at 09:55 UTC | |
Re: regex 2 find C function dependencies
by Zaxo (Archbishop) on Sep 19, 2003 at 07:37 UTC | |
Re: regex 2 find C function dependencies
by jmcnamara (Monsignor) on Sep 19, 2003 at 08:38 UTC | |
Re: regex 2 find C function dependencies
by Cody Pendant (Prior) on Sep 19, 2003 at 06:32 UTC | |
by Abigail-II (Bishop) on Sep 19, 2003 at 06:59 UTC | |
by Cody Pendant (Prior) on Sep 19, 2003 at 23:31 UTC | |
by Abigail-II (Bishop) on Sep 20, 2003 at 00:02 UTC | |
Re: regex 2 find C function dependencies
by Anonymous Monk on Sep 19, 2003 at 06:55 UTC | |
Re: regex 2 find C function dependencies
by perlmonkey (Hermit) on Sep 20, 2003 at 06:16 UTC |
Back to
Seekers of Perl Wisdom