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

⟦ad6d14697⟧ TextFile

    Length: 6414 (0x190e)
    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 String_Utilities;

separate (Lexical)
package body Simulated_Automate is

    type State is (St_Start, St_Let, St_Minus, St_Comm, St_Less,
                   St_Great, St_Nbr, St_Word, St_Found);

    subtype Low_Alpha is Character range 'a' .. 'z';
    subtype Upp_Alpha is Character range 'A' .. 'Z';
    subtype Digit is Character range '0' .. '9';

    package Keywords is
        function Is_Keyword (The_Lexeme : Lexeme) return Boolean;
        function Lexeme_To_Token (From : Lexeme) return Token;
    end Keywords;

    package body Keywords is separate;

    procedure File_Next_Char (C : in out Character) is
    begin  
        if At_End then
            C := Ascii.Eot;
        else
            if Text_Io.End_Of_Line (The_File) then
                Text_Io.Skip_Line (The_File);
                C := Ascii.Lf;
            else
                if Look_Ahead.Is_Existing then
                    C := Look_Ahead.Value;
                else
                    Text_Io.Get (The_File, C);
                end if;
            end if;
        end if;
    end File_Next_Char;

    procedure Next is  
        Current_State : State;  
        Current_Char : Character;
    begin
        if not At_End then
            Bounded_String.Free (Current_Value);
            Current_State := St_Start;
            loop
                File_Next_Char (Current_Char);
                case Current_State is
                    when St_Start =>
                        case Current_Char is
                            when Ascii.Eot =>
                                Current_Token := L_Eof;
                                Current_State := St_Found;

                            when ' ' | Ascii.Lf | Ascii.Ht =>
                                null;

                            when '(' =>
                                Current_Token := L_Open;
                                Current_State := St_Found;

                            when ')' =>  
                                Current_Token := L_Close;
                                Current_State := St_Found;

                            when ',' =>  
                                Current_Token := L_Comma;
                                Current_State := St_Found;

                            when '.' =>  
                                Current_Token := L_Point;
                                Current_State := St_Found;

                            when ':' =>
                                Current_State := St_Let;

                            when '+' =>  
                                Current_Token := L_Plus;
                                Current_State := St_Found;

                            when '-' =>
                                Current_State := St_Minus;

                            when '*' =>  
                                Current_Token := L_Star;
                                Current_State := St_Found;

                            when '/' =>  
                                Current_Token := L_Slash;
                                Current_State := St_Found;

                            when '=' =>  
                                Current_Token := L_Equ;
                                Current_State := St_Found;

                            when '<' =>
                                Current_State := St_Less;

                            when '>' =>
                                Current_State := St_Great;

                            when Digit =>
                                Bounded_String.Append
                                   (Current_Value, Current_Char);
                                Current_State := St_Nbr;

                            when Low_Alpha | Upp_Alpha | '_' =>
                                Bounded_String.Append
                                   (Current_Value, Current_Char);
                                Current_State := St_Word;

                            when others =>  
                                Current_Token := L_Unk;
                                Current_State := St_Found;
                        end case;

                    when St_Let =>
                        if Current_Char = '=' then
                            Current_Token := L_Affect;
                            Current_State := St_Found;
                        else
                            Current_Token := L_Unk;
                            Current_State := St_Found;
                        end if;

                    when St_Minus =>
                        if Current_Char = '-' then
                            Current_State := St_Comm;
                        else  
                            Look_Ahead.Affect (Current_Char);
                            Current_Token := L_Minus;
                            Current_State := St_Found;
                        end if;

                    when St_Comm =>
                        if Current_Char = Ascii.Lf then
                            Current_State := St_Start;
                        end if;

                    when St_Nbr =>
                        if Current_Char in Digit then
                            Bounded_String.Append (Current_Value, Current_Char);
                        else
                            Look_Ahead.Affect (Current_Char);
                            Current_Token := L_Nbr;
                            Current_State := St_Found;
                        end if;

                    when St_Less =>
                        null;

                    when St_Great =>  
                        null;

                    when St_Word =>
                        case Current_Char is
                            when Low_Alpha | Upp_Alpha | '_' | Digit =>
                                Bounded_String.Append
                                   (Current_Value, Current_Char);

                            when others =>
                                Look_Ahead.Affect (Current_Char);
                                Current_Token :=
                                   Keywords.Lexeme_To_Token (Lexical.Value);
                                Current_State := St_Found;
                        end case;

                    when St_Found =>
                        null;
                end case;
                exit when Current_State = St_Found;
            end loop;
        else
            Current_Token := L_Eof;
        end if;
    end Next;

end Simulated_Automate;