mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-26 09:54:20 +00:00
62 lines
1.1 KiB
Plaintext
62 lines
1.1 KiB
Plaintext
scan:
|
||
proc(n);
|
||
%replace
|
||
true by '1'b,
|
||
false by '0'b;
|
||
dcl
|
||
n fixed,
|
||
accum char (128) var external,
|
||
line char (128) var static init('');
|
||
dcl
|
||
c char(1),
|
||
i fixed;
|
||
|
||
tracer:
|
||
proc;
|
||
put edit(n,' scan: ',accum) (skip,f(3),2a);
|
||
end;
|
||
|
||
do while(true);
|
||
if length(line) = 0 then
|
||
get edit(line) (a);
|
||
else
|
||
line = substr(line,length(accum)+1);
|
||
i = verify(line,' ');
|
||
if i = 0 then
|
||
line = '';
|
||
else
|
||
do;
|
||
line = substr(line,i);
|
||
accum = substr(line,1,1);
|
||
if index('[]->;().,"',accum) ~= 0 then
|
||
do;
|
||
call tracer();
|
||
return;
|
||
end;
|
||
do i = 2 to length(line);
|
||
c = substr(line,i,1);
|
||
if index(' []->;().,"',c) ~= 0 then
|
||
do;
|
||
accum = substr(line,1,i-1);
|
||
if c ~= '.' then
|
||
do;
|
||
call tracer();
|
||
return;
|
||
end;
|
||
if verify(accum,'0123456789') ~= 0 then
|
||
do;
|
||
call tracer();
|
||
return;
|
||
end;
|
||
end;
|
||
end;
|
||
accum = line;
|
||
do;
|
||
call tracer();
|
||
return;
|
||
end;
|
||
end;
|
||
end;
|
||
call tracer();
|
||
end scan;
|
||
|