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 - downloadIndex: ┃ B T ┃
Length: 3870 (0xf1e) Types: TextFile Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧
with Bounded_String; with Text_Io; package body Lex is package Look_Ahead is function Exist return Boolean; function Get return Character; procedure Set (To : Character); end Look_Ahead; package Automate is function Start return Token; function Get return Bounded_String.Variable_String; end Automate; package Convert is function From_Int_To_Natural (S : String) return Natural; function From_Based_To_Natural (S : String) return Natural; function From_Hour_To_Natural (S : String) return Natural; end Convert; The_File : Text_Io.File_Type; Current_Token : Token; Current_Line : Natural := 1; Current_Column : Natural := 1; -- -- function Current_Token_Is (T : Token) return Boolean is begin return Current_Token = T; end Current_Token_Is; -- -- function Current_Token_In (T : Tokens) return Boolean is Index : Natural := 1; begin loop if Current_Token_Is (T (Index)) then return True; else Index := Index + 1; end if; end loop; exception when Constraint_Error => return False; end Current_Token_In; -- -- function Get_Next_Character (The_File : Text_Io.File_Type) return Character is C : Character; begin if Look_Ahead.Exist then return Look_Ahead.Get; else if Text_Io.End_Of_File (File => The_File) then return Ascii.Eot; elsif Text_Io.End_Of_Line (File => The_File) then Text_Io.Skip_Line (File => The_File); return Ascii.Cr; else Text_Io.Get (File => The_File, Item => C); return C; end if; end if; end Get_Next_Character; -- -- function Is_A_Keyword (The_String : String) return Boolean is T : Token; begin T := Token'Value (The_String); return True; exception when Constraint_Error => return False; end Is_A_Keyword; -- -- procedure Open (Thename : String) is begin Text_Io.Open (File => The_File, Mode => Text_Io.In_File, Name => Thename, Form => ""); end Open; -- -- procedure Close is begin Text_Io.Close (File => The_File); end Close; -- -- function Value return Natural is begin case Get is when Int => return Convert.From_Int_To_Natural (Image); when Based => return Convert.From_Based_To_Natural (Image); when Hour => return Convert.From_Hour_To_Natural (Image); when others => return 0; end case; end Value; -- -- function Image return String is begin return Bounded_String.Image (Automate.Get); end Image; -- -- function Get return Token is begin return Current_Token; end Get; -- -- function Get_Line return Natural is begin return Current_Line; end Get_Line; -- -- function Get_Column return Natural is begin return Current_Column; end Get_Column; -- -- function At_End return Boolean is begin return Current_Token = Eof; end At_End; -- -- procedure Next is begin Current_Token := Automate.Start; if Current_Token = Identifier then if Is_A_Keyword (Image) then Current_Token := Token'Value (Image); end if; end if; end Next; -- -- package body Look_Ahead is separate; package body Automate is separate; package body Convert is separate; end Lex;