|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 12288 (0x3000)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Lexical, seg_048c08
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with String_Utilities;
with Compiler_Token;
use Compiler_Token;
package body Lexical is
-- package Our_String is new Unbounded_String (1);
Current_Value : Our_String.Variable_String;
Current_Token : Token;
function Keyword_To_Token
(The_Keywords : Keywords; The_String : String) return Token is
A_String : String (1 .. Compiler_Token.Max_String_Keyword) :=
(others => ' ');
begin
if The_String'Last <= Compiler_Token.Max_String_Keyword then
A_String (The_String'Range) := The_String;
String_Utilities.Upper_Case (A_String);
for I in The_Keywords'Range loop
if A_String = The_Keywords (I).The_Name then
return The_Keywords (I).The_Token;
end if;
end loop;
else
return L_Id;
end if;
return L_Id;
end Keyword_To_Token;
procedure Open (A_File : Text_Io.File_Type) is
begin
Text_Io.Set_Input (A_File);
File.Open (Text_Io.Current_Input);
end Open;
procedure Create_Error_Report is
begin
File.Create_Error_Report ("Error_Report");
end Create_Error_Report;
function At_End return Boolean is
begin
return File.At_End (Text_Io.Current_Input);
end At_End;
procedure Next is
C : Character;
The_State : State;
E_O_F : constant Character := Ascii.Nul;
begin
if not File.At_End (Text_Io.Current_Input) then
Our_String.Free (Current_Value);
The_State := St_Normal;
Recherche:
loop
if not File.At_End_Of_Line (Text_Io.Current_Input) then
if The_State /= St_Found then
File.Next (Text_Io.Current_Input);
C := File.Value (Text_Io.Current_Input);
end if;
else
C := E_O_F;
end if;
case The_State is
when St_Normal =>
case C is
when E_O_F =>
Current_Token := L_Eof;
while (not File.At_End
(Text_Io.Current_Input)) and
(C = E_O_F or C = ' ' or
C = Ascii.Ff or C = Ascii.Lf) loop
File.Next (Text_Io.Current_Input);
C := File.Value (Text_Io.Current_Input);
end loop;
File.Unget (Text_Io.Current_Input);
File.New_Line_Error_Report;
when ' ' | Ascii.Ff | Ascii.Lf =>
null;
when '<' =>
Our_String.Append (Current_Value, C);
Current_Token := L_Less;
The_State := St_Found;
when '>' =>
Our_String.Append (Current_Value, C);
Current_Token := L_Great;
The_State := St_Found;
when '=' =>
Our_String.Append (Current_Value, C);
Current_Token := L_Equal;
The_State := St_Found;
when ',' =>
Our_String.Append (Current_Value, C);
Current_Token := L_Comma;
The_State := St_Found;
when '"' =>
The_State := St_Litt;
when 'a' .. 'z' | 'A' .. 'Z' =>
Our_String.Append (Current_Value, C);
The_State := St_Word;
when '0' .. '9' =>
Our_String.Append (Current_Value, C);
The_State := St_Number;
when others =>
Current_Token := L_Unk;
The_State := St_Found;
end case;
when St_Word =>
if C in 'a' .. 'z' or C in 'A' .. 'Z' or
C in '0' .. '9' or C = '_' then
Our_String.Append (Current_Value, C);
else
if C /= E_O_F then
File.Unget (Text_Io.Current_Input);
end if;
Current_Token :=
Keyword_To_Token
(The_Keywords, Our_String.Image
(Current_Value));
The_State := St_Found;
end if;
when St_Litt =>
if C = '"' then
Current_Token := L_Str;
The_State := St_Found;
else
Our_String.Append (Current_Value, C);
end if;
when St_Number =>
if C in '0' .. '9' then
Our_String.Append (Current_Value, C);
else
if C /= E_O_F then
File.Unget (Text_Io.Current_Input);
end if;
Current_Token := L_Nbr;
The_State := St_Found;
end if;
when St_Found =>
if Current_Token = L_Str then
File.Save_Error_Report
('"' & Our_String.Image (Current_Value) &
'"' & " ");
else
File.Save_Error_Report
(Our_String.Image (Current_Value) & " ");
end if;
if File.At_End_Of_Line (Text_Io.Current_Input) then
File.New_Line_Error_Report;
end if;
exit Recherche;
end case;
end loop Recherche;
else
Current_Token := L_Eof;
The_State := St_Found;
end if;
end Next;
function Get_Token return Token is
begin
return Current_Token;
end Get_Token;
function Get_Value return String is
begin
return Our_String.Image (Current_Value);
end Get_Value;
end Lexical;
nblk1=b
nid=b
hdr6=12
[0x00] rec0=1f rec1=00 rec2=01 rec3=018
[0x01] rec0=21 rec1=00 rec2=06 rec3=02e
[0x02] rec0=12 rec1=00 rec2=08 rec3=03e
[0x03] rec0=0c rec1=00 rec2=09 rec3=03e
[0x04] rec0=10 rec1=00 rec2=03 rec3=05c
[0x05] rec0=02 rec1=00 rec2=0a rec3=030
[0x06] rec0=12 rec1=00 rec2=05 rec3=066
[0x07] rec0=14 rec1=00 rec2=02 rec3=01a
[0x08] rec0=1c rec1=00 rec2=07 rec3=000
[0x09] rec0=1c rec1=00 rec2=07 rec3=000
[0x0a] rec0=1c rec1=00 rec2=07 rec3=000
tail 0x2154619e2865a85e5eaec 0x42a00088462060003
Free Block Chain:
0xb: 0000 00 04 00 0e 80 0b 20 20 20 20 20 20 20 20 20 20 ┆ ┆
0x4: 0000 00 00 00 08 80 05 20 4b 65 79 77 05 20 20 20 20 ┆ Keyw ┆