in reply to Re: C/C++ function parsing
in thread C/C++ function parsing
Thanks for the quick response.
The solution helped me only little, but I have learnt how to exclude some characters :)..
The code which I have written for parsing is as below.
May be with this you could help me out in a better way..
my @matches2; my $sw_test; my $func_name; my $func_start; my $func_full; my $print; my $count=0; Functionparser(); sub FunctionParser { my $linenum =0; open FILE2, $ARGV[0] or die $!; while(<FILE2>) { $linenum++; if(!$sw_test && (/([:\w]+)\((.*\))/) ) { print "first\n"; $func_name=$1; $func_start=$.; $func_full= $_; $sw_test=1; print "$linenum) $_\n"; $linenum1 = $linenum; $print=1; next; } $count++ if $sw_test && /\{/; $count-- if $sw_test && /\}/; if($sw_test && $count==0) { if($print) { push(@matches2, { 'Start' => $linenum1, 'End' => $line +num, 'FuncName' => $func_full}); $print=0; } $sw_test=0; } } close FILE2; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: C/C++ function parsing
by ImJustAFriend (Scribe) on Jan 13, 2014 at 12:56 UTC | |
|
Re^3: C/C++ function parsing
by kcott (Archbishop) on Jan 13, 2014 at 13:41 UTC | |
by ssriganesh (Initiate) on Jan 15, 2014 at 06:55 UTC |