DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦0c68ca81e⟧ Ada Source

    Length: 11264 (0x2c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Lex_Inter, seg_047fb1

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Our_String;
package body Lex_Inter is

    subtype Digit is Character range '0' .. '9';
    subtype Lower is Character range 'a' .. 'z';
    subtype Upper is Character range 'A' .. 'Z';
    subtype Unuseful_Word is Token range Le .. Sous;

    type State is (Normal, Found, Identifier);



    Command_Line : String (1 .. 80);
    Command_Line_Length : Natural;
    Index : Natural;
    Look_Ahead : Boolean;
    Current_Value : Our_String.Variable_String;
    Current_Token : Token;


    function Unuseful_Word_To_Token (A_Id : in String) return Token is
        A_Token : Unuseful_Word;
    begin
        A_Token := Unuseful_Word'Value (A_Id);
        return Token'Value ("unuseful");

    exception

        when Constraint_Error =>
            return Identifier;
    end Unuseful_Word_To_Token;

    procedure Init is

    begin
        Our_String.Free (Current_Value);
        Look_Ahead := False;
        Index := Command_Line'First - 1;
        Command_Line (1) := ' ';


    end Init;

    procedure Prompt is

    begin  
        Text_Io.Put ("go on! > ");
        Text_Io.Get_Line (Command_Line, Command_Line_Length);
    end Prompt;


    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;

    function Is_At_End return Boolean is

    begin
        return (Index > Command_Line_Length);
    end Is_At_End;


    procedure Next is

        Current_Char : Character;
        Current_State : State;
    begin
        Our_String.Free (Current_Value);

        Current_State := Normal;
        loop
            if not (Look_Ahead) then

                Index := Index + 1;

            else

                Look_Ahead := False;

            end if;
            Current_Char := Command_Line (Index);

            case Current_State is
                when Normal =>
                    case Current_Char is
                        when ' ' | Ascii.Cr =>
                            null;


                        when Lower | Upper =>
                            Our_String.Append (Current_Value, Current_Char);
                            Current_State := Identifier;

                        when others =>


                            Current_Token := Unknown;
                            Current_State := Found;

                    end case;


                when Identifier =>
                    if Is_At_End then
                        Current_Token := Unuseful_Word_To_Token
                                            (Our_String.Image (Current_Value));
                        Current_State := Found;
                    elsif

                          Current_Char in Upper or
                          Current_Char in Lower or Current_Char = '_' then
                        Our_String.Append (Current_Value, Current_Char);


                    else
                        Look_Ahead := True;
                        Current_Token := Unuseful_Word_To_Token
                                            (Our_String.Image (Current_Value));
                        Current_State := Found;
                    end if;
                when Found =>
                    null;
            end case;
            exit when Current_State = Found;
        end loop;

    end Next;


end Lex_Inter;

E3 Meta Data

    nblk1=a
    nid=6
    hdr6=8
        [0x00] rec0=27 rec1=00 rec2=01 rec3=03e
        [0x01] rec0=33 rec1=00 rec2=03 rec3=02a
        [0x02] rec0=1e rec1=00 rec2=09 rec3=044
        [0x03] rec0=14 rec1=00 rec2=02 rec3=000
        [0x04] rec0=14 rec1=00 rec2=09 rec3=000
        [0x05] rec0=0c rec1=00 rec2=06 rec3=000
        [0x06] rec0=17 rec1=00 rec2=07 rec3=018
        [0x07] rec0=07 rec1=00 rec2=03 rec3=000
        [0x08] rec0=07 rec1=00 rec2=03 rec3=000
        [0x09] rec0=1a rec1=00 rec2=06 rec3=001
    tail 0x21749ff5a86527b4f769a 0x42a00088462060003
Free Block Chain:
  0x6: 0000  00 07 02 69 80 24 20 69 6e 20 4c 6f 77 65 72 20  ┆   i $ in Lower ┆
  0x7: 0000  00 0a 03 fc 80 0c 20 20 20 65 6e 64 20 49 6e 69  ┆         end Ini┆
  0xa: 0000  00 04 03 fc 80 21 20 20 20 20 20 20 69 66 20 43  ┆     !      if C┆
  0x4: 0000  00 08 03 fc 80 05 72 65 61 74 3b 05 00 23 20 20  ┆      reat;  #  ┆
  0x8: 0000  00 05 00 2c 80 29 20 20 20 20 20 20 20 20 20 20  ┆   , )          ┆
  0x5: 0000  00 00 00 14 80 02 6c 3b 02 00 0c 20 20 20 20 20  ┆      l;        ┆