dos_compilers/Digital Research PLI-86 v1/FSCAN.PLI
2024-06-30 12:01:25 -07:00

51 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/******************************************************/
/* This program tests the procedure called GNT, which */
/* is a free-field scanner (parser) that reads a line */
/* of input and breaks it into individual parts. */
/******************************************************/
fscan:
procedure options(main);
%replace
true by '1'b;
declare
token character(80) varying
static initial('');
gnt:
procedure;
declare
i fixed,
line character(80) varying
static initial('');
line = substr(line,length(token)+1);
do while(true);
if line = '' then
get edit(line) (a);
i = verify(line,' ');
if i = 0 then
line = '';
else
do;
line = substr(line,i);
i = verify(line,'0123456789.');
if i = 0 then
token = line;
else
if i = 1 then
token = substr(line,1,1);
else
token = substr(line,1,i-1);
return;
end;
end;
end gnt;
do while(true);
call gnt;
put edit(''''!!token!!'''') (x(1),a);
end;
end fscan;