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

⟦85d0d5e06⟧ TextFile

    Length: 29040 (0x7170)
    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

-- !!!!
-- !!!!
-- version temporaire  :  declarer les function en separate
-- !!!!
-- !!!!

with Text_Io;
with Lexical;  
use Lexical;
package body Parser is

    function Parse_Corps_Scene
                return Boolean; --prototype,declaration incomplete

    function Parse_Prog_Principal return Boolean is
    begin
        if Lexical.Get = L_Debut then
            Lexical.Next;
            if Parse_Corps_Scene then
                if Lexical.Get = L_Fin then
                    Lexical.Next;
                    return True;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Prog_Principal;

    function Parse_Terme return Boolean; --prototype,declaration incomplete
    function Parse_Facteur return Boolean; --prototype,declaration incomplete

    function Parse_Expression return Boolean is
        The_Token : Lexical.Token;
        Parse_Ok : Boolean := True;
    begin
        if Parse_Terme then  
            while Lexical.Get = L_Plus or else Lexical.Get = L_Minus loop
                The_Token := Lexical.Get;
                case The_Token is
                    when L_Plus =>
                        Lexical.Next;
                        Parse_Ok := Parse_Terme;
                    when L_Minus =>  
                        Text_Io.Put_Line (Token'Image (Get));
                        Lexical.Next;
                        Text_Io.Put_Line (Token'Image (Get));
                        Parse_Ok := Parse_Terme;
                    when others =>
                        Parse_Ok := False;
                end case;
                exit when not Parse_Ok;
            end loop;  
            return Parse_Ok;
        else
            return False;
        end if;
    end Parse_Expression;

    function Parse_Terme return Boolean is
        The_Token : Lexical.Token;  
        Parse_Ok : Boolean := True;
    begin
        if Parse_Facteur then
            while Lexical.Get = L_Star or else
                     Lexical.Get = L_Slash or else Lexical.Get = L_Mod loop

                The_Token := Lexical.Get;
                case The_Token is
                    when L_Star =>
                        Lexical.Next;
                        Parse_Ok := Parse_Facteur;
                    when L_Slash =>
                        Lexical.Next;
                        Parse_Ok := Parse_Facteur;
                    when L_Mod =>
                        Lexical.Next;
                        Parse_Ok := Parse_Facteur;
                    when others =>
                        Parse_Ok := False;
                end case;
                exit when not Parse_Ok;
            end loop;  
            return Parse_Ok;
        else
            return False;
        end if;
    end Parse_Terme;

    function Parse_Facteur return Boolean is
        The_Token : Lexical.Token;
    begin
        The_Token := Lexical.Get;
        case The_Token is
            when L_Open =>
                Lexical.Next;  
                if Parse_Expression then
                    if Lexical.Get = L_Close then
                        Lexical.Next;
                        return True;
                    else  
                        return False;  
                    end if;
                else
                    return False;
                end if;
            when L_Id =>  
                Lexical.Next;
                return True;
            when L_Nbr =>
                Lexical.Next;
                return True;
            when others =>
                return False;
        end case;
    end Parse_Facteur;

    function Parse_Evoluer return Boolean is
    begin
        if Lexical.Get = L_Id then
            Lexical.Next;
            if Lexical.Get = L_Point then
                Lexical.Next;
                if Lexical.Get = L_Id then
                    Lexical.Next;
                    if Lexical.Get = L_Jusqua then
                        Lexical.Next;
                        if Parse_Expression then
                            if Lexical.Get = L_En then
                                Lexical.Next;
                                if Parse_Expression then
                                    return True;
                                else
                                    return False;
                                end if;
                            else
                                return False;
                            end if;
                        else
                            return False;
                        end if;
                    else
                        return False;
                    end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Evoluer;

    function Parse_Modifier return Boolean is
    begin
        if Lexical.Get = L_Id then
            Lexical.Next;
            if Lexical.Get = L_Point then
                Lexical.Next;
                if Lexical.Get = L_Id then
                    Lexical.Next;

                    --   if Lexical.Get = L_Avec then
                    --       Lexical.Next;
                    -- !!!! prevoir token l_avec dans itf lexical

                    if Parse_Expression then
                        return True;
                    else
                        return False;
                    end if;
                    --  else
                    --      return False;
                    --  end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Modifier;

    function Parse_Desactiver return Boolean is
    begin
        if Lexical.Get = L_Id then
            Lexical.Next;
            if Lexical.Get = L_Point then
                Lexical.Next;
                if Lexical.Get = L_Id then
                    Lexical.Next;
                    return True;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Desactiver;

    function Parse_Activer return Boolean is
    begin
        if Lexical.Get = L_Id then
            Lexical.Next;
            if Lexical.Get = L_Point then
                Lexical.Next;  
                if Lexical.Get = L_Id then
                    Lexical.Next;
                    return True;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Activer;

    function Parse_Corps_Effet return Boolean is
        The_Token : Lexical.Token;
        Parse_Ok : Boolean := False;
    begin  
        while Lexical.Get = L_Activer or else Lexical.Get = L_Desactiver or else  
                 Lexical.Get = L_Modifier or else Lexical.Get = L_Evoluer loop

            -- !!!! prevoir table des first !!!!

            The_Token := Lexical.Get;
            case The_Token is
                when L_Activer =>
                    Lexical.Next;
                    Parse_Ok := Parse_Activer;
                when L_Desactiver =>
                    Lexical.Next;
                    Parse_Ok := Parse_Desactiver;
                when L_Modifier =>
                    Lexical.Next;
                    Parse_Ok := Parse_Modifier;
                when L_Evoluer =>
                    Lexical.Next;
                    Parse_Ok := Parse_Evoluer;
                when others =>
                    Parse_Ok := False;
            end case;
            exit when not Parse_Ok;

        end loop;
        return Parse_Ok;
    end Parse_Corps_Effet;

    function Parse_Liste_Param return Boolean is
        Parse_Ok : Boolean := True;
    begin  
        if Lexical.Get = L_Id then
            Lexical.Next;
            while Lexical.Get = L_Comma loop
                Lexical.Next;
                if Lexical.Get = L_Id then
                    Lexical.Next;
                    Parse_Ok := True;
                else
                    Parse_Ok := False;
                    exit;
                end if;
            end loop;
            return Parse_Ok;
        else
            return False;
        end if;
    end Parse_Liste_Param;

    function Parse_Bloc_Param return Boolean is
    begin  
        if Lexical.Get = L_Open then
            Lexical.Next;
            if Parse_Liste_Param then
                if Lexical.Get = L_Close then
                    Lexical.Next;
                    return True;
                else
                    return False;
                end if;
            else
                return False;
            end if;  
        else
            return True; -- autorise aucun "param" declare
        end if;
    end Parse_Bloc_Param;

    function Parse_Effet return Boolean is
    begin  
        if Lexical.Get = L_Id then
            Lexical.Next;
            if Parse_Bloc_Param then
                if Lexical.Get = L_Est then
                    Lexical.Next;
                    if Parse_Corps_Effet then
                        if Lexical.Get = L_Fin then
                            Lexical.Next;
                            if Lexical.Get = L_Effet then
                                Lexical.Next;
                                return True;
                            else
                                return False;
                            end if;
                        else
                            return False;
                        end if;  
                    else
                        return False;
                    end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;  
        else
            return False;
        end if;  
    end Parse_Effet;

    function Parse_Faire return Boolean is
    begin
        if Lexical.Get = L_Id then
            Lexical.Next;
            return Parse_Bloc_Param;
        else
            return False;
        end if;
    end Parse_Faire;

    function Parse_Repeter return Boolean is
    begin
        if Parse_Expression then
            if Lexical.Get = L_Fois then
                Lexical.Next;
                if Parse_Corps_Scene then
                    if Lexical.Get = L_Fin then
                        Lexical.Next;
                        if Lexical.Get = L_Repeter then
                            Lexical.Next;
                            return True;
                        else
                            return False;
                        end if;  
                    else
                        return False;
                    end if;  
                else
                    return False;
                end if;
            else
                return False;
            end if;  
        else
            return False;
        end if;

    end Parse_Repeter;

    function Parse_Sinon return Boolean is
    begin  
        if Lexical.Get = L_Sinon then
            Lexical.Next;
            if Lexical.Get = L_Faire then
                Lexical.Next;
                return Parse_Corps_Scene;
            else
                return False;
            end if;
        else
            return True; -- autorise l absence d un "sinon"
        end if;
    end Parse_Sinon;

    function Parse_Suite_Condition return Boolean is
        The_Token : Lexical.Token;
    begin  
        The_Token := Lexical.Get;
        case The_Token is  
            when L_Equ =>  
                Lexical.Next;
                return Parse_Expression;
            when L_Neq =>  
                Lexical.Next;
                return Parse_Expression;
            when L_Gt =>
                Lexical.Next;
                return Parse_Expression;
            when L_Lt =>
                Lexical.Next;
                return Parse_Expression;
            when L_Geq =>
                Lexical.Next;
                return Parse_Expression;
            when L_Leq =>
                Lexical.Next;
                return Parse_Expression;
            when others =>
                return False;
        end case;
    end Parse_Suite_Condition;

    function Parse_Condition return Boolean is
    begin
        if Parse_Expression then
            return Parse_Suite_Condition;
        else
            return False;
        end if;
    end Parse_Condition;

    function Parse_Si return Boolean is
    begin
        if Parse_Condition then
            if Lexical.Get = L_Alors then  
                Lexical.Next;
                if Lexical.Get = L_Faire then
                    Lexical.Next;
                    if Parse_Corps_Scene then
                        if Parse_Sinon then
                            if Lexical.Get = L_Fin then
                                Lexical.Next;
                                if Lexical.Get = L_Si then
                                    Lexical.Next;
                                    return True;
                                else
                                    return False;
                                end if;  
                            else
                                return False;
                            end if;  
                        else
                            return False;
                        end if;  
                    else
                        return False;
                    end if;  
                else
                    return False;
                end if;
            else
                return False;
            end if;  
        else
            return False;
        end if;
    end Parse_Si;

    function Parse_Autemps return Boolean is
    begin
        if Parse_Expression then  
            if Lexical.Get = L_Faire then
                Lexical.Next;
                if Parse_Corps_Scene then
                    if Lexical.Get = L_Fin then
                        Lexical.Next;
                        if Lexical.Get = L_Autemps then
                            Lexical.Next;
                            return True;  
                        else
                            return False;
                        end if;  
                    else
                        return False;
                    end if;  
                else
                    return False;
                end if;
            else
                return False;
            end if;  
        else
            return False;
        end if;
    end Parse_Autemps;

    function Parse_Ensequence return Boolean is
    begin
        if Lexical.Get = L_Faire then
            Lexical.Next;
            if Parse_Corps_Scene then
                if Lexical.Get = L_Fin then
                    Lexical.Next;
                    if Lexical.Get = L_Ensequence then
                        Lexical.Next;
                        return True;
                    else
                        return False;
                    end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Ensequence;

    function Parse_Pendant return Boolean is
    begin
        if Parse_Expression then
            if Lexical.Get = L_Faire then
                Lexical.Next;
                if Parse_Corps_Scene then
                    if Lexical.Get = L_Fin then
                        Lexical.Next;
                        if Lexical.Get = L_Pendant then
                            Lexical.Next;
                            return True;
                        else
                            return False;
                        end if;
                    else
                        return False;
                    end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;

    end Parse_Pendant;

    function Parse_Attendre return Boolean is
    begin
        return Parse_Expression;
    end Parse_Attendre;

    function Parse_Corps_Scene return Boolean is
        The_Token : Lexical.Token;
        Parse_Ok : Boolean := False;
    begin
        while Lexical.Get = L_Activer or else Lexical.Get = L_Desactiver or else
                 Lexical.Get = L_Modifier or else
                 Lexical.Get = L_Faire or else Lexical.Get = L_Evoluer or else
                 Lexical.Get = L_Id or else Lexical.Get = L_Repeter or else
                 Lexical.Get = L_Si or else Lexical.Get = L_Autemps or else
                 Lexical.Get = L_Ensequence or else
                 Lexical.Get = L_Pendant or else Lexical.Get = L_Attendre loop

            -- !!!! prevoir table des first !!!!

            The_Token := Lexical.Get;
            case The_Token is
                when L_Activer =>
                    Lexical.Next;  
                    Parse_Ok := Parse_Activer;
                when L_Desactiver =>
                    Lexical.Next;  
                    Parse_Ok := Parse_Desactiver;
                when L_Modifier =>
                    Lexical.Next;  
                    Parse_Ok := Parse_Modifier;
                when L_Evoluer =>
                    Lexical.Next;  
                    Parse_Ok := Parse_Evoluer;
                when L_Id =>
                    Lexical.Next;
                    if Lexical.Get = L_Affect then
                        Lexical.Next;
                        if Parse_Expression then
                            Parse_Ok := True;
                        else
                            Parse_Ok := False;
                        end if;
                    else
                        Parse_Ok := False;
                    end if;
                when L_Faire =>
                    Lexical.Next;
                    Parse_Ok := Parse_Faire;
                when L_Repeter =>
                    Lexical.Next;  
                    Parse_Ok := Parse_Repeter;
                when L_Si =>
                    Lexical.Next;
                    Parse_Ok := Parse_Si;
                when L_Autemps =>
                    Lexical.Next;  
                    Parse_Ok := Parse_Autemps;
                when L_Ensequence =>
                    Lexical.Next;
                    Parse_Ok := Parse_Ensequence;
                when L_Pendant =>  
                    Lexical.Next;
                    Parse_Ok := Parse_Pendant;
                when L_Attendre =>
                    Lexical.Next;
                    Parse_Ok := Parse_Attendre;
                when others =>
                    Parse_Ok := False;
            end case;  
            exit when not Parse_Ok;
        end loop;
        return Parse_Ok;
    end Parse_Corps_Scene;

    function Parse_Scene return Boolean is
    begin
        if Lexical.Get = L_Id then
            Lexical.Next;
            if Parse_Bloc_Param then
                if Lexical.Get = L_Est then
                    Lexical.Next;
                    if Parse_Corps_Scene then
                        if Lexical.Get = L_Fin then
                            Lexical.Next;
                            if Lexical.Get = L_Scene then
                                Lexical.Next;
                                return True;
                            else
                                return False;
                            end if;
                        else
                            return False;
                        end if;
                    else
                        return False;
                    end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Scene;

    function Parse_Corps_Experience return Boolean is
        The_Token : Lexical.Token;
        Parse_Ok : Boolean := True;
    begin  
        while Lexical.Get = L_Effet or else Lexical.Get = L_Scene loop
            The_Token := Lexical.Get;
            case The_Token is
                when L_Effet =>
                    Lexical.Next;
                    Parse_Ok := Parse_Effet;
                when L_Scene =>  
                    Lexical.Next;
                    Parse_Ok := Parse_Scene;
                when others =>
                    Parse_Ok := False;
            end case;
            exit when not Parse_Ok;
        end loop;  
        return Parse_Ok;
    end Parse_Corps_Experience;

    function Parse_Bloc_Experience return Boolean is
    begin
        if Lexical.Get = L_Experience then
            Lexical.Next;
            if Lexical.Get = L_Est then
                Lexical.Next;
                if Parse_Corps_Experience then
                    if Lexical.Get = L_Fin then
                        Lexical.Next;
                        if Lexical.Get = L_Experience then
                            Lexical.Next;  
                            return True;
                        else
                            return False;
                        end if;
                    else
                        return False;
                    end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else  
            return True; -- autorise aucun bloc "experience" declare
        end if;
    end Parse_Bloc_Experience;

    function Parse_Corps_Implantation return Boolean is  
        Parse_Ok : Boolean := False;
    begin
        while Lexical.Get = L_Id loop
            Lexical.Next;
            if Lexical.Get = L_Est then
                Lexical.Next;
                if Lexical.Get = L_Id then
                    Lexical.Next;
                    if Lexical.Get = L_En then
                        Lexical.Next;
                        if Lexical.Get = L_Nbr then
                            Lexical.Next;
                            Parse_Ok := True;
                        else
                            Parse_Ok := False;
                            exit;
                        end if;
                    else
                        Parse_Ok := False;
                        exit;
                    end if;
                else
                    Parse_Ok := False;
                    exit;
                end if;
            else
                Parse_Ok := False;
                exit;
            end if;
        end loop;
        return Parse_Ok;
    end Parse_Corps_Implantation;

    function Parse_Bloc_Implantation return Boolean is
    begin
        if Lexical.Get = L_Implantation then
            Lexical.Next;
            if Lexical.Get = L_Est then
                Lexical.Next;
                if Parse_Corps_Implantation then
                    if Lexical.Get = L_Fin then
                        Lexical.Next;
                        if Lexical.Get = L_Implantation then
                            Lexical.Next;
                            return True;
                        else
                            return False;
                        end if;
                    else
                        return False;
                    end if;  
                else
                    return False;
                end if;  
            else
                return False;
            end if;
        else
            return False;
        end if;


    end Parse_Bloc_Implantation;

    function Parse_Type return Boolean is
        The_Token : Lexical.Token;
        Parse_Ok : Boolean;
    begin
        The_Token := Lexical.Get;
        case The_Token is
            when L_Binaire =>
                Lexical.Next;
                Parse_Ok := True;
            when L_Temporel =>
                Lexical.Next;
                Parse_Ok := True;
            when L_Fugitif =>
                Lexical.Next;
                Parse_Ok := True;
            when L_Discret =>
                Lexical.Next;
                Parse_Ok := True;
            when others =>
                Parse_Ok := False;
        end case;
        return Parse_Ok;
    end Parse_Type;


    function Parse_Liste_D_Acteurs_Types return Boolean is
        Parse_Ok : Boolean := False;
    begin  
        while Lexical.Get = L_Id loop
            Lexical.Next;
            if Parse_Type then
                Parse_Ok := True;
            else
                Parse_Ok := False;
                exit;
            end if;
        end loop;
        return Parse_Ok;
    end Parse_Liste_D_Acteurs_Types;


    function Parse_Corps_Materiel return Boolean is
        Parse_Ok : Boolean := False;
    begin  
        while Lexical.Get = L_Categorie loop
            Lexical.Next;
            if Lexical.Get = L_Id then
                Lexical.Next;
                if Lexical.Get = L_Est then
                    Lexical.Next;
                    if Parse_Liste_D_Acteurs_Types then
                        if Lexical.Get = L_Fin then
                            Lexical.Next;
                            if Lexical.Get = L_Categorie then
                                Lexical.Next;
                                Parse_Ok := True;
                            else
                                Parse_Ok := False;
                                exit;
                            end if;
                        else
                            Parse_Ok := False;
                            exit;
                        end if;
                    else
                        Parse_Ok := False;
                        exit;
                    end if;
                else
                    Parse_Ok := False;
                    exit;
                end if;
            else
                Parse_Ok := False;
                exit;
            end if;
        end loop;
        return Parse_Ok;
    end Parse_Corps_Materiel;

    function Parse_Bloc_Materiel return Boolean is
    begin  
        if Lexical.Get = L_Materiel then
            Lexical.Next;
            if Lexical.Get = L_Est then
                Lexical.Next;
                if Parse_Corps_Materiel then
                    if Lexical.Get = L_Fin then
                        Lexical.Next;
                        if Lexical.Get = L_Materiel then
                            Lexical.Next;
                            return True;
                        else
                            return False;
                        end if;
                    else
                        return False;
                    end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Bloc_Materiel;


    function Parse_Corps_Spectacle return Boolean is
    begin
        if Parse_Bloc_Materiel then
            if Parse_Bloc_Implantation then
                if Parse_Bloc_Experience then
                    if Parse_Prog_Principal then
                        return True;
                    else
                        return False;
                    end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Corps_Spectacle;

    function Parse_Show return Boolean is
    begin
        if Lexical.Get = L_Spectacle then
            Lexical.Next;
            if Lexical.Get = L_Est then
                Lexical.Next;
                if Parse_Corps_Spectacle then
                    if Lexical.Get = L_Fin then
                        Lexical.Next;
                        if Lexical.Get = L_Spectacle then
                            Lexical.Next;
                            return Lexical.Get = L_Eof;
                        else
                            return False;
                        end if;
                    else
                        return False;
                    end if;
                else
                    return False;
                end if;
            else
                return False;
            end if;
        else
            return False;
        end if;
    end Parse_Show;

    procedure Parse (File_Name : in String) is

    begin
        Lexical.Open (File_Name);
        Lexical.Next;
        if Parse_Show then
            Text_Io.Put_Line ("file is ok");
        else
            Text_Io.Put_Line ("file is not ok");
        end if;

    end Parse;

end Parser;