home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
rexx
/
rdebug
/
rmatch.kex
< prev
next >
Wrap
Text File
|
1993-03-25
|
2KB
|
77 lines
/*H* RMATCH.KEX 02-10-93 14:07*/
/* test seperately
signal on error
signal on halt
signal on syntax
*/
Parse source sys .
if sys='OS/2' then sys='OS2'
else if sys='PCDOS' then sys='DOS'
if (sys='DOS') + (sys='OS2')>0 then pc?=1
me='rMATCH'
If arg(1)='?' Then Exit tell(me)
Arg m1
/*check For matching quotes and comments and mark their location*/
/*with . labels such as .1 .2 .3, etc.*/
'COMMAND EXTRACT /LINE/WRAP/SIZE/MSGMODE';
':0 COMMAND SET WRAP OFF';
'COMMAND SET MSGMODE OFF';
'COMMAND SET MSGLINE ON 3 10 O';
p=0; sq="'"; dq='"'
If line.1=0 Then line.1 = 1
start=line.1; '-1'
Do k=1
If pc? Then Do
'COMMAND LOCATE @'sq'@|@'dq'@|@/*@'
If rc<>0 Then Leave; End
Else Do
'COMMAND LOCATE @'sq'@│@'dq'@│@/*@'
If rc<>0 Then Leave; End
if k//10 = 0 then 'COMMAND REFRESH'
'COMMAND extract /curline/line/';
string=curline.3;
Do Forever
Parse Value pos(sq,str) pos(dq,str) pos('/*',str),
With h i j
If h=0 Then h=256
If i=0 Then i=256
If j=0 Then j=256
j=min(h,i,j)
If j=256 Then Leave
Parse Value 1 substr(str,j,1) With width delimiter
If delimiter='/' Then Parse Value '*/' 2 With delimiter width
Parse Value substr(str,1,j-1)'!'substr(str,j+width),
With temp'!'str
j=pos(delimiter,str)
If j>0 Then str=temp substr(str,j+width)
Else Do;str=temp;leave;end
If j=0 Then Do
p=p+1
'COMMAND POINT .'p 'off'
'COMMAND POINT .'p
Leave;
End;
string=temp substr(string,j+width)
End
'+1'
End;
'COMMAND POINT .'p+1 'off'
'COMMAND LOCATE :'start;
'COMMAND SET MSGMODE ON'
If p=0
Then message='** no lines tagged **'
Else message='Missing delimiter at points .1 To .'p;
'COMMAND EMSG' message
'COMMAND REFRESH'
'COMMAND SET MSGMODE' msgmode.1
'COMMAND SET WRAP' wrap.1;
Exit rc
ERROR: return -7 0 sigl rdbmsg(810 rc 'in line:' sigl' of' me)
HALT: return -7 0 sigl rdbmsg(820 'in line:' sigl' of' me)
SYNTAX: return -7 0 sigl rdbmsg(830 rc 'in line:' sigl' of' me)