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

⟦45fbc477f⟧ TextFile

    Length: 2278 (0x8e6)
    Types: TextFile
    Names: »B«

Derivation

└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Scanner;
with Object;  
with Value;
with Class_Integer, Class_String;  --Class_Block
with Bounded_String;

package body Primary is

    type Node_Structure is
        record
            Rule : Natural range 0 .. 4 := 0;
            Obj : Object.Reference := Object.Void_Reference;
            Ident : Object.Unary;
            Val : Value.Node := Value.Empty_Node;
            -- Block : Block.Node := Block.Empty_Node;
        end record;

    procedure Parse (N : in out Node; Error : out Boolean) is
        Failed : Boolean := False;
    begin  
        N := new Node_Structure;
        case Scanner.Get_Token is
            when Scanner.Integer =>
                N.Rule := 0;
                N.Obj := Class_Integer.Value (Scanner.Get_Value);
                Scanner.Next;
            when Scanner.String =>
                N.Rule := 1;  
                N.Obj := Class_String.Create (Scanner.Get_Value);
                Scanner.Next;
            when Scanner.Identifier =>
                N.Rule := 2;
                Object.Put (Scanner.Get_Value, N.Ident);
                Scanner.Next;
            when Scanner.Special =>
                N.Rule := 3;  
                if Bounded_String.Image (Scanner.Get_Value) = "(" then
                    Scanner.Next;
                    Value.Parse (N.Val, Failed);
                    Scanner.Next; -- tester si ')'
                end if;
            when others =>
                null;
        end case;
        null;
        Error := Failed;
    end Parse;

    function Is_First (T : Scanner.Token) return Boolean is
        use Scanner;
    begin
        return T = Scanner.Integer or else T = Scanner.String or else
                  T = Scanner.Special; --Block.Is_First (T);
    end Is_First;

    function Interpret (N : Node) return Object.Reference is
        Result : Object.Reference;
    begin
        case N.Rule is
            when 0 =>
                Result := N.Obj;
            when 1 =>
                Result := N.Obj;
            when 2 =>
                null; --Result := Symbol.Get (Object.Get (N.Ident));
            when 3 =>
                Result := Value.Interpret (N.Val);
            when 4 =>
                null;
        end case;
        return Result;
    end Interpret;
end Primary;