|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 2801 (0xaf1)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
└─⟦d65440be7⟧ »DATA«
└─⟦this⟧
with File;
package body Lex is
subtype Alpha_L is Character range 'a' .. 'z';
subtype Alpha_U is Character range 'A' .. 'Z';
subtype Digit is Character range '0' .. '9';
type Class is (C_Space, C_Point, C_Digit, C_Alpha, C_Oper, C_Unk);
Transition : array (L_Ok .. L_Unk, C_Space .. C_Unk) of Token :=
-- C_*** ( SPACE , POINT , DIGIT , ALPHA , OPER , UNK )
((L_Ok, L_Ok, L_Ok, L_Ok, L_Unk, L_Ok), -- L_OK
(L_Start, L_Unk, L_Int, L_Id, L_Oper, L_Unk), -- L_START
(L_Ok, L_Real, L_Int, L_Ok, L_Ok, L_Ok), -- L_INT
(L_Ok, L_Ok, L_Real, L_Ok, L_Ok, L_Ok), -- L_REAL
(L_Ok, L_Ok, L_Ok, L_Ok, L_Ok, L_Ok), -- L_OPER
(L_Ok, L_Ok, L_Id, L_Id, L_Ok, L_Ok), -- L_ID
(L_Ok, L_Ok, L_Ok, L_Ok, L_Ok, L_Ok) -- L_UNK
);
Thefile : Integer;
function Classthechar (C : Character) return Class is
begin
if (C in Alpha_L) or (C in Alpha_U) then
return C_Alpha;
end if;
if C in Digit then
return C_Digit;
end if;
if C = ' ' then
return C_Space;
end if;
if (C = '+') or (C = '*') then
return C_Oper;
end if;
if C = '.' then
return C_Point;
end if;
return C_Unk;
end Classthechar;
procedure Lexopen (Afile : in out Integer) is
begin
Thefile := Afile;
File.Fileopen (Afile);
File.Filenext (Thefile);
end Lexopen;
procedure Lexnext is
Index : Positive range 1 .. 256;
Nextstate : Token;
begin
for I in Currentvalue'First .. Currentvalue'Last loop
Currentvalue (I) := ' ';
end loop;
Index := 1;
if not File.Fileatend (Thefile) then
Currenttoken := L_Start;
Nextstate := Transition (Currenttoken,
Classthechar (File.Filevalue (Thefile)));
loop
if Nextstate /= L_Start then
Currentvalue (Index) := File.Filevalue (Thefile);
Index := Index + 1;
end if;
File.Filenext (Thefile);
Currenttoken := Nextstate;
if not File.Fileatend (Thefile) then
Nextstate := Transition
(Currenttoken,
Classthechar (File.Filevalue (Thefile)));
else
Nextstate := L_Ok;
end if;
exit when Nextstate = L_Ok;
end loop;
else
Currenttoken := L_Eof;
end if;
end Lexnext;
end Lex;
-- fichier : lex_spe.ada
-- specifications du package LEX
-- auteur : Sebastien BROCHET
-- date : 31 octobre 1993