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

⟦318207d66⟧ Ada Source

    Length: 13312 (0x3400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Exprs, seg_047e9c

Derivation

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

E3 Source Code



with Lex, Error, Token_Pkg, Set_Of_Token, Element, Pieces, Objets,
     Directions, Element_Global, Struct_Component, String_Table, Donnee,
     Feuille, Text_Io, String_Utilities, Bounded_String, Actions, Int_Lib;
use Token_Pkg;
package body Exprs is
------------------------------------------------------------------------
-- <UNIT>        Exprs
------------------------------------------------------------------------
--
-- <DESCRIPTION>    This package defines an operation for parsing the
--                  grammatical expresssion : <Exprs>
--
-- <AUTHOR>         Barthe Raphael, Beck Didier, Kempe Laurent
-- <VERSION>        1.0
-- <DATE>           16-Jan-95
-- <MODIFY>         16-Jan-95
--
-- <PKG USED>       LEX, Token_Pkg, Error,
--
------------------------------------------------------------------------

    Unit_Donnee : Set_Of_Token.Object :=
       Set_Of_Token.Make ((T_Vrai, T_Faux, T_Ident, T_String, T_Integer));

    Unit_Element_Global : Set_Of_Token.Object :=
       Set_Of_Token.Make ((T_Objet, T_Pnj, T_Hero, T_Piece_Courante));

    procedure Parse (Tmptree : in out Feuille.Pcell;
                     Success : in out Boolean) is
------------------------------------------------------------------------
-- <SUBPROGRAM>
-- <UNIT>        Parse
--
-- <DESCRIPTION> Try to parse <Exprs> and return if it was a
--               success or not.
--
-- <EXCEPTIONS>  Nothing
--
------------------------------------------------------------------------
        Ok : Boolean := True;
        Found : Boolean;
        Indexverb : Natural := 0;
        Astring : String_Table.I_String;
        Tmptree2, Tmptree3 : Feuille.Pcell;
        Tmpiterstruct : Struct_Component.Liste_Structure.Listiter;
    begin
        case Lex.Gettoken is
            when T_Piece_Courante =>
                Tmptree2 := Feuille.Create (Feuille.Piece_Courante);
                Lex.Next;
                if Lex.Currenttoken_Is (T_Equ) then
                    Lex.Next;
                    Tmptree := Feuille.Create (Feuille.Egal);
                    Tmptree.Left := Tmptree2;
                    if Lex.Currenttoken_Is (T_Ident) then
                        Bounded_String.Copy
                           (Astring, String_Utilities.Upper_Case (Lex.Image));
                        Struct_Component.Is_Inside
                           (Lex.Image, Pieces.Liste, Tmpiterstruct, Found);
                        if not Found then
                            Error.Append (" : nom de piece inconnu !");
                            Success := False;
                        else
                            Tmptree3 := Feuille.Create
                                           (Feuille.Iter_S, Tmpiterstruct);
                            Tmptree.Right := Tmptree3;
                            Lex.Next;
                        end if;
                    else
                        Error.Append (" : un ident attendu !");
                        Success := False;
                    end if;
                else
                    Error.Append (" : '=' attendu !");
                    Success := False;
                end if;

            when T_Ident =>
                Element.Parse (Ok);
                Success := Success and Ok;
                if Lex.Currenttoken_Is (T_Equ) then
                    Tmptree3 := Feuille.Create (Feuille.Egal);
                    Tmptree3.Left := Element.Tmptree;
                    Lex.Next;
                    if Set_Of_Token.Is_Member
                          (Lex.Gettoken, Unit_Element_Global) then
                        Element_Global.Parse (Ok);
                        Success := Success and Ok;
                        Tmptree3.Right := Element_Global.Tmptree;
                    elsif Set_Of_Token.Is_Member
                             (Lex.Gettoken, Unit_Donnee) then
                        Donnee.Parse (Ok);
                        Success := Success and Ok;
                        Tmptree3.Right := Donnee.Tmptree;
                    else
                        Success := False;
                        Error.Append
                           (" : vrai ou faux ou ident ou entier ou objet ou direction" &
                            " ou hero ou piece_courante attendu !");
                    end if;  
                else
                    Success := False;
                    Error.Append (" : = attendu !");
                end if;

            when T_Obracket =>
                Lex.Next;
                if Lex.Currenttoken_Is (T_Ident) then
                    Bounded_String.Copy
                       (Astring, String_Utilities.Upper_Case (Lex.Image));

                    Indexverb := Int_Lib.Find (Actions.Table, Astring);
                    if Indexverb /= 0 then
                        Tmptree3 := Feuille.Create (Feuille.Verbe, Astring);
                        Lex.Next;
                        if Set_Of_Token.Is_Member
                              (Lex.Gettoken, Unit_Element_Global) then
                            Element_Global.Parse (Ok);
                            Success := Success and Ok;
                            Tmptree3.Left := Element_Global.Tmptree;
                        elsif Lex.Currenttoken_Is (T_Ident) then
                            Bounded_String.Copy
                               (Astring, String_Utilities.Upper_Case
                                            (Lex.Image));
                            Struct_Component.Is_Inside
                               (Bounded_String.Image (Astring),
                                Objets.Liste, Tmpiterstruct, Found);
                            if not Found then
                                Struct_Component.Is_Inside
                                   (Bounded_String.Image (Astring),
                                    Directions.Liste, Tmpiterstruct, Found);
                                if not Found then
                                    Error.Append (" : ident inconnu !");
                                    Success := False;
                                else
                                    Tmptree3.Left :=
                                       Feuille.Create
                                          (Feuille.Complement, Astring);  
                                    Lex.Next;
                                    if Lex.Currenttoken_Is (T_Ident) then
                                        Bounded_String.Copy
                                           (Astring, String_Utilities.Upper_Case
                                                        (Lex.Image));
                                        Tmptree3.Right :=
                                           Feuille.Create
                                              (Feuille.Complement, Astring);
                                        Lex.Next;
                                    end if;
                                end if;  
                            else
                                Tmptree3.Left :=
                                   Feuille.Create (Feuille.Complement, Astring);  
                                Lex.Next;
                                if Lex.Currenttoken_Is (T_Ident) then
                                    Bounded_String.Copy
                                       (Astring, String_Utilities.Upper_Case
                                                    (Lex.Image));
                                    Tmptree3.Right :=
                                       Feuille.Create
                                          (Feuille.Complement, Astring);
                                    Lex.Next;
                                end if;
                            end if;
                        end if;
                    else
                        Error.Append
                           (" : le verbe utilise n`a pas ete declare !");
                        Success := False;
                    end if;
                else
                    Success := False;
                    Error.Append (" : ident attendu !");  
                end if;

                if Lex.Currenttoken_Is (T_Cbracket) then
                    Lex.Next;
                else
                    Success := False;
                    Error.Append (" : ) attendu !");  
                end if;

            when others =>
                Success := False;
                Error.Append (" : ident ou ( attendu !");
        end case;

        if Lex.Currenttoken_Is (T_Et) then
            Lex.Next;
            Tmptree := Feuille.Create (Feuille.Et);
            Tmptree.Left := Tmptree3;
            Tmptree2 := Feuille.Create (Feuille.Unk);
            Exprs.Parse (Tmptree2, Ok);
            Success := Success and Ok;
            Tmptree.Right := Tmptree2;
        else
            Tmptree := Tmptree3;
        end if;
    end Parse;

end Exprs;

E3 Meta Data

    nblk1=c
    nid=0
    hdr6=18
        [0x00] rec0=1a rec1=00 rec2=01 rec3=038
        [0x01] rec0=01 rec1=00 rec2=05 rec3=00c
        [0x02] rec0=1a rec1=00 rec2=0a rec3=026
        [0x03] rec0=00 rec1=00 rec2=06 rec3=006
        [0x04] rec0=13 rec1=00 rec2=09 rec3=02a
        [0x05] rec0=0d rec1=00 rec2=07 rec3=00a
        [0x06] rec0=14 rec1=00 rec2=08 rec3=008
        [0x07] rec0=14 rec1=00 rec2=03 rec3=02a
        [0x08] rec0=10 rec1=00 rec2=0c rec3=088
        [0x09] rec0=11 rec1=00 rec2=02 rec3=036
        [0x0a] rec0=19 rec1=00 rec2=04 rec3=024
        [0x0b] rec0=13 rec1=00 rec2=0b rec3=000
    tail 0x2174bc38c86577d3cb7cd 0x42a00088462060003