Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: regex 2 match C function

by jai (Sexton)
on Aug 14, 2003 at 06:33 UTC ( [id://283773]=note: print w/replies, xml ) Need Help??


in reply to Re: regex 2 match C function
in thread regex 2 match C function

hi, thanx for the code. actually i came up with the following.
foreach (@ARGV) { # Read file open(FF,"<$_") || die ("Cant open $_ : $!\n"); my $t=<FF>; close FF; $t=~s/((\**\s*\w+\s*)+\s*)(\((\s*\**\s*\w+,?)*\)?\s*{)/${\&do( +$1,$3)}/g; # Write file open (FF, ">$_.j") || die ("Cant open $_.j : $!\n"); print FF $t; close FF; } sub do($$) { my ($a,$b)=@_; my ($t1, $t2, @t3); $t1=$a,$t2=$b; $a=~s/\n/ /gm; $b=~s/\n//g; $b=~s/\s+/ /gm; $b=~s/[(\{)]/ /g; @t3=split /,/,$b; #@t3=map {"\n *$_\t : " } @t3; @t3=map{sprintf "\n *%-13s : ", $_} @t3; my $t=<<E; /* * Function : $a * * Inputs : \n *@t3 * * Author : * Date : */ $t1$t2 E }
I know urs is far better. as u said, it will match try, catch blocks and also constructs of type
#define add(x,y) {\
I'd like the monks to give suggestions on optimizations,..

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://283773]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (1)
As of 2024-04-24 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found