[Israel.pm] regex question
Dovalle Yankelovich
dovalle at smlink.com
Sun Jan 25 06:16:43 PST 2004
Yuval,
You should distinguish between whether or not the "On Error" statement fits Subs & Functions.
#Now for same statement
* While parsing each file rise a flag while the line starts with Sub/function # e.g. $fInsideFunc = 1
* Write each line to another file
* If "On error" statement appears - rise another flag # e.g. $fOnError = 1
* If "End.." statement appears check the flags status
o In case both =1 make them to be 0 and continue
o In case only the first =1 write the " On error " statement, make them = 0 and continue
Don't forget to close both files
If you have 2 "On error statements" you should define 2 variables e.g. $fInsideFunc, $fInsideSub and basically do the same.
If the "on error" statement cant be the last command before "end" please spread a little about your requirements...
Regards,
Dovalle
-----Original Message-----
From: Yuval Zaltz [mailto:Yuval.Zaltz at Tescom.co.il]
Sent: Sunday, January 25, 2004 15:48
To: perl at perl.org.il
Subject: [Israel.pm] regex question
Hi,
I need to parse a VB file that contains Functions and Subs.
In each subroutine and function I need to identify if the string "On Error" exists
and if not add it.
what is the most efficient way to do this in regex?
Thanks Yuval
The file looks like this :
.
.
.
Function x
.
On Error ...
.
.
End Function
.
.
Sub y
.
.
.
End Sub
.
.
.
Function z
.
.
End Function
.
.
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://www.perl.org.il/mailman/listinfo/perl
YAPC::Israel::2004
http://www.perl.org.il/YAPC/2004/
More information about the Perl
mailing list