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

⟦da649cf9b⟧ TextFile

    Length: 2884 (0xb44)
    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 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;


    The_File : Text_Io.File_Type;  
    Current_Token : Token;




--
--
    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 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 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;
end Lex;