DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦b57fe13ec⟧ TextFile

    Length: 2900 (0xb54)
    Types: TextFile
    Names: »B«

Derivation

└─⟦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⟧ 

TextFile

with Text_Io;
package body Lex is

    package Standard_String is
        type Object is private;

        procedure Clear (S : in out Standard_String.Object);
        procedure Append (C : Character; To : in out Standard_String.Object);
        function Get (From : Standard_String.Object) return String;
    private
        String_Size : constant := 80;

        type Object is
            record
                Length : Natural := 0;
                Content : String (1 .. String_Size);
            end record;
    end Standard_String;


    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 Standard_String.Object;
    end Automate;


    The_File : Text_Io.File_Type;  
    Current_Token : Token;



--
--
    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 Get_Value return String is
    begin
        return Standard_String.Get (From => Automate.Get);
    end Get_Value;



--
--
    function Get_Token return Token is
    begin
        return Current_Token;
    end Get_Token;



--
--
    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 = Id then
            if Is_A_Keyword (Get_Value) then
                Current_Token := Token'Value (Get_Value);
            end if;
        end if;
    end Next;



--
--
    package body Standard_String is separate;
    package body Look_Ahead is separate;
    package body Automate is separate;
end Lex;