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

⟦b2fc1f77f⟧ TextFile

    Length: 41177 (0xa0d9)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Lex2;
with Follow;
with Token;
with Text_Io;
use Token;
use Follow;

package body Parse is

    -- date de creation : 24/11/93
    -- MAJ : 1/12/93 par Olivier Martin Parse simple
    -- date de derniere MAJ : 13/12/93 par Emmanuel PRATZ Parse + rec
    -- en mode panic

    procedure Parse_Les_Ordres (Ok : out Boolean);
    procedure Parse_Facteur (Ok : out Boolean);
    procedure Parse_Expression (Ok : out Boolean);

    procedure Parse_Error (Ensemble : Token_Set.Set) is
    begin
        Text_Io.Put_Line ("erreur de syntaxe");
        -- Lex2.Next;
        while not Token_Set.Is_Member (Ensemble, Lex2.Get_Token) loop
            Text_Io.Put_Line ("tentative de synchronisation");
            Lex2.Next;
        end loop;

    end Parse_Error;


    procedure Parse_Variable (Ok : out Boolean) is
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_variable");
        case Lex2.Get_Token is
            when L_Id | L_Nbr =>
                Lex2.Next;
            when others =>
                Ok := False;
        end case;
    end Parse_Variable;

    procedure Parse_Dans_Suite (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_dans_suite");
        while Lex2.Get_Token /= L_Fin loop
            if Lex2.Get_Token = L_Puis then
                Lex2.Next;
                while Lex2.Get_Token /= L_Fin loop
                    Parse_Les_Ordres (Ok1);
                    if not Ok1 then
                        Parse_Error (Les_Ordres_Follow);
                    end if;
                end loop;
                Lex2.Next;
                if Lex2.Get_Token = L_Puis then
                    Lex2.Next;
                else
                    Ok := False;
                    exit;
                end if;
            else
                Ok := False;
                exit;
            end if;
        end loop;
    end Parse_Dans_Suite;

    procedure Parse_Attendre (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_attendre");
        if Lex2.Get_Token = L_Attendre then
            Lex2.Next;
            Parse_Expression (Ok1);
            if not Ok1 then
                Parse_Error (Expr_Follow);
            end if;
        else
            Ok := False;
        end if;
    end Parse_Attendre;

    procedure Parse_Pour (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_pour");
        if Lex2.Get_Token = L_Pour then
            Lex2.Next;
            if Lex2.Get_Token = L_Id then
                Lex2.Next;
                if Lex2.Get_Token = L_Parmi then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Id then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Faire then
                            Lex2.Next;
                            Parse_Les_Ordres (Ok1);
                            if not Ok1 then
                                Parse_Error (Les_Ordres_Follow);
                            end if;
                            if Lex2.Get_Token = L_Fin then
                                Lex2.Next;
                                if Lex2.Get_Token = L_Pour then
                                    Lex2.Next;
                                else
                                    Ok := False;
                                end if;
                            else
                                Ok := False;
                            end if;
                        else
                            Ok := False;
                        end if;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Pour;

    procedure Parse_Relation (Ok : out Boolean) is
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_relation");
        case Lex2.Get_Token is
            when L_Inf | L_Sup | L_Egal | L_Pas_Egal |
                 L_Inf_Ou_Egal | L_Sup_Ou_Egal =>
                Lex2.Next;
            when others =>
                Ok := False;
        end case;
    end Parse_Relation;

    procedure Parse_Condition (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_condition");
        Parse_Expression (Ok1);
        if not Ok1 then
            Parse_Error (Expr_Follow);
        end if;
        Parse_Relation (Ok1);
        if not Ok1 then
            Parse_Error (Relation_Follow);
        end if;
        Parse_Expression (Ok1);
        if not Ok1 then
            Parse_Error (Expr_Follow);
        end if;
    end Parse_Condition;

    procedure Parse_Tant_Que (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_tant_que");
        if Lex2.Get_Token = L_Tantque then
            Lex2.Next;
            Parse_Condition (Ok1);
            if not Ok1 then
                Parse_Error (Condition_Follow);
            end if;
            if Lex2.Get_Token = L_Faire then
                Lex2.Next;
                Parse_Les_Ordres (Ok1);
                if not Ok1 then
                    Parse_Error (Les_Ordres_Follow);
                end if;
                if Lex2.Get_Token = L_Fin then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Tantque then
                        Lex2.Next;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Tant_Que;

    procedure Parse_Repeter (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_repeter");
        if Lex2.Get_Token = L_Repeter then
            Lex2.Next;
            Parse_Variable (Ok1);
            if not Ok1 then
                Parse_Error (Variable_Follow);
            end if;
            if Lex2.Get_Token = L_Fois then
                Lex2.Next;
                Parse_Les_Ordres (Ok1);
                if not Ok1 then
                    Parse_Error (Les_Ordres_Follow);
                end if;
                if Lex2.Get_Token = L_Fin then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Repeter then
                        Lex2.Next;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Repeter;

    procedure Parse_Debut (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_debut");
        if Lex2.Get_Token = L_Debut then
            Lex2.Next;
            Parse_Les_Ordres (Ok1);
            if not Ok1 then
                Parse_Error (Les_Ordres_Follow);
            end if;
            if Lex2.Get_Token = L_Fin then
                Lex2.Next;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Debut;

    procedure Parse_Activer (Ok : out Boolean) is
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_activer");
        if Lex2.Get_Token = L_Activer then
            Lex2.Next;
            if Lex2.Get_Token = L_Id then
                Lex2.Next;
                if Lex2.Get_Token = L_Point then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Id then
                        Lex2.Next;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Activer;

    procedure Parse_Desactiver (Ok : out Boolean) is
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_desactiver");
        if Lex2.Get_Token = L_Desact then
            Lex2.Next;
            if Lex2.Get_Token = L_Id then
                Lex2.Next;
                if Lex2.Get_Token = L_Point then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Id then
                        Lex2.Next;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Desactiver;

    procedure Parse_Changer (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_changer");
        if Lex2.Get_Token = L_Changer then
            Lex2.Next;
            if Lex2.Get_Token = L_Ouvrante then
                Lex2.Next;
                if Lex2.Get_Token = L_Id then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Point then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Id then
                            Lex2.Next;
                            if Lex2.Get_Token = L_Virgule then
                                Lex2.Next;
                                Parse_Variable (Ok1);
                                if not Ok1 then
                                    Parse_Error (Variable_Follow);
                                end if;
                                if Lex2.Get_Token = L_Fermante then
                                    Lex2.Next;
                                end if;
                            else
                                Ok := False;
                            end if;
                        else
                            Ok := False;
                        end if;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Changer;

    procedure Parse_Evoluer (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_evoluer");
        if Lex2.Get_Token = L_Evoluer then
            Lex2.Next;
            if Lex2.Get_Token = L_Ouvrante then
                Lex2.Next;
                if Lex2.Get_Token = L_Id then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Point then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Id then
                            Lex2.Next;
                            if Lex2.Get_Token = L_Virgule then
                                Lex2.Next;
                                Parse_Variable (Ok1);
                                if not Ok1 then
                                    Parse_Error (Variable_Follow);
                                end if;
                                if Lex2.Get_Token = L_Virgule then
                                    Lex2.Next;
                                    Parse_Variable (Ok1);
                                    if not Ok1 then
                                        Parse_Error (Variable_Follow);
                                    end if;
                                    if Lex2.Get_Token = L_Fermante then
                                        Lex2.Next;
                                    else
                                        Ok := False;
                                    end if;
                                else
                                    Ok := False;
                                end if;
                            else
                                Ok := False;
                            end if;
                        else
                            Ok := False;
                        end if;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Evoluer;

    procedure Parse_Affectation (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_affectation");
        if Lex2.Get_Token = L_Id then
            Lex2.Next;
            if Lex2.Get_Token = L_Affect then
                Lex2.Next;
                Parse_Expression (Ok1);
                if not Ok1 then
                    Parse_Error (Expr_Follow);
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Affectation;

    procedure Parse_Groupe (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_groupe");
        Parse_Expression (Ok1);
        if not Ok1 then
            Parse_Error (Expr_Follow);
        end if;
        while Lex2.Get_Token /= L_Crochet_Fermant loop
            if Lex2.Get_Token = L_Virgule then
                Lex2.Next;
                Parse_Expression (Ok1);
                if not Ok1 then
                    Parse_Error (Expr_Follow);
                end if;
            else
                Ok := False;
                exit;
            end if;
        end loop;
    end Parse_Groupe;

    procedure Parse_Facteur (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_facteur");
        case Lex2.Get_Token is
            when L_Ouvrante =>
                Lex2.Next;
                Parse_Expression (Ok1);
                if not Ok1 then
                    Parse_Error (Expr_Follow);
                end if;
                if Lex2.Get_Token = L_Fermante then
                    Lex2.Next;
                else
                    Ok := False;
                end if;
            when L_Id | L_Nbr =>
                Lex2.Next;
            when L_Crochet_Ouvrant =>
                Lex2.Next;
                Parse_Groupe (Ok1);
                if not Ok1 then
                    Parse_Error (Groupe_Follow);
                end if;
                if Lex2.Get_Token = L_Crochet_Fermant then
                    Lex2.Next;
                else
                    Ok := False;
                end if;
            when others =>
                Ok := False;
        end case;
    end Parse_Facteur;

    procedure Parse_Terme (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_terme");
        Parse_Facteur (Ok1);
        if not Ok1 then
            Parse_Error (Facteur_Follow);
        end if;
        while not Token_Set.Is_Member (Term_Follow, Lex2.Get_Token) loop
            case Lex2.Get_Token is
                when L_Mult | L_Div =>
                    Lex2.Next;
                    Parse_Facteur (Ok1);
                    if not Ok1 then
                        Parse_Error (Facteur_Follow);
                    end if;
                when others =>
                    Ok := False;
                    exit;
            end case;
        end loop;
    end Parse_Terme;

    procedure Parse_Expression (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_expression");
        Parse_Terme (Ok1);
        if not Ok1 then
            Parse_Error (Term_Follow);
        end if;
        while not Token_Set.Is_Member (Expr_Follow, Lex2.Get_Token) loop
            case Lex2.Get_Token is
                when L_Plus | L_Moins =>
                    Lex2.Next;
                    Parse_Terme (Ok1);
                    if not Ok1 then
                        Parse_Error (Term_Follow);
                    end if;
                when others =>
                    Ok := False;
                    exit;
            end case;
        end loop;
    end Parse_Expression;

    procedure Parse_Dans (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_Dans");
        if Lex2.Get_Token = L_Dans then
            Lex2.Next;
            Parse_Variable (Ok1);
            if not Ok1 then
                Parse_Error (Variable_Follow);
            end if;
            if Lex2.Get_Token = L_Faire then
                Lex2.Next;
                Parse_Les_Ordres (Ok1);
                if not Ok1 then
                    Parse_Error (Les_Ordres_Follow);
                end if;
                Parse_Dans_Suite (Ok1);
                if not Ok1 then
                    Parse_Error (Dans_Suite_Follow);
                end if;
                if Lex2.Get_Token = L_Fin then
                    Lex2.Next;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Dans;

    procedure Parse_Un_Parametre_Reel (Ok : out Boolean) is
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_un_paramatre_reel");
        case Lex2.Get_Token is
            when L_Id | L_Nbr =>
                Lex2.Next;
            when others =>
                Ok := False;
        end case;
    end Parse_Un_Parametre_Reel;

    procedure Parse_Autre_Parametre_Reel (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_autre_parametre_reel");
        while Lex2.Get_Token /= L_Fermante loop
            if Lex2.Get_Token = L_Virgule then
                Lex2.Next;
                Parse_Variable (Ok1);
                if not Ok1 then
                    Parse_Error (Variable_Follow);
                end if;
            end if;
        end loop;
    end Parse_Autre_Parametre_Reel;

    procedure Parse_Parametres_Reels (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_appel_pararmetres_reels");
        if Lex2.Get_Token = L_Ouvrante then
            Lex2.Next;
            Parse_Variable (Ok1);
            if not Ok1 then
                Parse_Error (Variable_Follow);
            end if;
            Parse_Autre_Parametre_Reel (Ok1);
            if not Ok1 then
                Parse_Error (Autre_Parametre_Reel_Follow);
            end if;
            if Lex2.Get_Token = L_Fermante then
                Lex2.Next;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Parametres_Reels;

    procedure Parse_Appel_Effet (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_appel_effet");
        if Lex2.Get_Token = L_Appel_Effet then
            Lex2.Next;
            if Lex2.Get_Token = L_Id then
                Lex2.Next;
                Parse_Parametres_Reels (Ok1);
                if not Ok1 then
                    Parse_Error (Parametres_Follow);
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Appel_Effet;

    procedure Parse_Appel_Scene (Ok : out Boolean) is
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_appel_scene");
        if Lex2.Get_Token = L_Lancer_Scene then
            Lex2.Next;
            if Lex2.Get_Token = L_Id then
                Lex2.Next;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Appel_Scene;

    procedure Parse_Les_Ordres (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_les_ordres");
        while Lex2.Get_Token /= L_Puis and Lex2.Get_Token /= L_Fin loop
            case Lex2.Get_Token is
                when L_Dans =>
                    Parse_Dans (Ok1);
                    if not Ok1 then
                        Parse_Error (Dans_Follow);
                    end if;
                when L_Tantque =>
                    Parse_Tant_Que (Ok1);
                    if not Ok1 then
                        Parse_Error (Tant_Que_Follow);
                    end if;
                when L_Attendre =>
                    Parse_Attendre (Ok1);
                    if not Ok1 then
                        Parse_Error (Attendre_Follow);
                    end if;
                when L_Pour =>
                    Parse_Pour (Ok1);
                    if not Ok1 then
                        Parse_Error (Pour_Follow);
                    end if;
                when L_Repeter =>
                    Parse_Repeter (Ok1);
                    if not Ok1 then
                        Parse_Error (Repeter_Follow);
                    end if;
                when L_Debut =>
                    Parse_Debut (Ok1);
                    if not Ok1 then
                        Parse_Error (Debut_Follow);
                    end if;
                when L_Activer =>
                    Parse_Activer (Ok1);
                    if not Ok1 then
                        Parse_Error (Activer_Follow);
                    end if;
                when L_Desact =>
                    Parse_Desactiver (Ok1);
                    if not Ok1 then
                        Parse_Error (Desactiver_Follow);
                    end if;
                when L_Changer =>
                    Parse_Changer (Ok1);
                    if not Ok1 then
                        Parse_Error (Changer_Follow);
                    end if;
                when L_Evoluer =>
                    Parse_Evoluer (Ok1);
                    if not Ok1 then
                        Parse_Error (Evoluer_Follow);
                    end if;
                when L_Id =>
                    Parse_Affectation (Ok1);
                    if not Ok1 then
                        Parse_Error (Affectation_Follow);
                    end if;
                when L_Appel_Effet =>
                    Parse_Appel_Effet (Ok1);
                    if not Ok1 then
                        Parse_Error (Appel_Effet_Follow);
                    end if;
                when L_Lancer_Scene =>
                    Parse_Appel_Scene (Ok1);
                    if not Ok1 then
                        Parse_Error (Appel_Scene_Follow);
                    end if;
                when others =>
                    Ok := False;
                    exit;
            end case;
        end loop;
    end Parse_Les_Ordres;

    procedure Parse_Scenes (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_scenes");
        while Lex2.Get_Token /= L_Debut loop
            if Lex2.Get_Token = L_Scene then
                Lex2.Next;
                if Lex2.Get_Token = L_Id then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Est then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Constitue then
                            Lex2.Next;
                            Parse_Les_Ordres (Ok1);
                            if not Ok1 then
                                Parse_Error (Les_Ordres_Follow);
                            end if;
                            if Lex2.Get_Token = L_Fin then
                                Lex2.Next;
                                if Lex2.Get_Token = L_Scene then
                                    Lex2.Next;
                                else
                                    Ok := False;
                                    exit;
                                end if;
                            else
                                Ok := False;
                                exit;
                            end if;
                        else
                            Ok := False;
                            exit;
                        end if;
                    else
                        Ok := False;
                        exit;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
                exit;
            end if;
        end loop;
    end Parse_Scenes;

    procedure Parse_Spectacle (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_spectacle");
        if Lex2.Get_Token = L_Spectacle then
            Lex2.Next;
            if Lex2.Get_Token = L_Est then
                Lex2.Next;
                if Lex2.Get_Token = L_Constitue then
                    Lex2.Next;
                    Parse_Scenes (Ok1);
                    if not Ok1 then
                        Parse_Error (Scenes_Follow);
                    end if;
                    if Lex2.Get_Token = L_Debut then
                        Lex2.Next;
                        Parse_Les_Ordres (Ok1);
                        if not Ok1 then
                            Parse_Error (Les_Ordres_Follow);
                        end if;
                        if Lex2.Get_Token = L_Fin then
                            Lex2.Next;
                            if Lex2.Get_Token = L_Fin then
                                Lex2.Next;
                                if Lex2.Get_Token = L_Spectacle then
                                    Lex2.Next;
                                else
                                    Ok := False;
                                end if;
                            else
                                Ok := False;
                            end if;
                        else
                            Ok := False;
                        end if;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Spectacle;

    procedure Parse_Autre_Parametre (Ok : out Boolean) is
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_autre_parametres");
        while Lex2.Get_Token /= L_Fermante loop
            if Lex2.Get_Token = L_Virgule then
                Lex2.Next;
                if Lex2.Get_Token = L_Id then
                    Lex2.Next;
                else
                    Ok := False;
                    exit;
                end if;
            else
                Ok := False;
                exit;
            end if;
        end loop;
    end Parse_Autre_Parametre;

    procedure Parse_Parametres (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_parametres");
        if Lex2.Get_Token /= L_Est then
            if Lex2.Get_Token = L_Ouvrante then
                Lex2.Next;
                if Lex2.Get_Token = L_Id then
                    Lex2.Next;
                    Parse_Autre_Parametre (Ok1);
                    if not Ok1 then
                        Parse_Error (Autre_Parametre_Follow);
                    end if;
                    if Lex2.Get_Token = L_Fermante then
                        Lex2.Next;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        end if;
    end Parse_Parametres;

    procedure Parse_Les_Experiences (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_lex_experiences");
        while Lex2.Get_Token /= L_Fin loop
            if Lex2.Get_Token = L_Effet then
                Lex2.Next;
                if Lex2.Get_Token = L_Id then
                    Lex2.Next;
                    Parse_Parametres (Ok1);
                    if not Ok1 then
                        Parse_Error (Parametre_Follow);
                    end if;
                    if Lex2.Get_Token = L_Est then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Constitue then
                            Lex2.Next;
                            Parse_Les_Ordres (Ok1);
                            if not Ok1 then
                                Parse_Error (Les_Ordres_Follow);
                            end if;
                            if Lex2.Get_Token = L_Fin then
                                Lex2.Next;
                                if Lex2.Get_Token = L_Effet then
                                    Lex2.Next;
                                else
                                    Ok := False;
                                    exit;
                                end if;
                            else
                                Ok := False;
                                exit;
                            end if;
                        else
                            Ok := False;
                            exit;
                        end if;
                    else
                        Ok := False;
                        exit;
                    end if;
                else
                    Ok := False;
                    exit;
                end if;
            else
                Ok := False;
                exit;
            end if;
        end loop;
    end Parse_Les_Experiences;

    procedure Parse_Experience (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_experience");
        if Lex2.Get_Token = L_Exp then
            Lex2.Next;
            if Lex2.Get_Token = L_Est then
                Lex2.Next;
                if Lex2.Get_Token = L_Collection then
                    Lex2.Next;
                    Parse_Les_Experiences (Ok1);
                    if not Ok1 then
                        Parse_Error (Les_Experiences_Follow);
                    end if;
                    if Lex2.Get_Token = L_Fin then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Exp then
                            Lex2.Next;
                        else
                            Ok := False;
                        end if;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Experience;

    procedure Parse_Stations (Ok : out Boolean) is
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_stations");
        while Lex2.Get_Token /= L_Fin loop
            if Lex2.Get_Token = L_Id then
                Lex2.Next;
                if Lex2.Get_Token = L_2points then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Station then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Ouvrante then
                            Lex2.Next;
                            if Lex2.Get_Token = L_Id then
                                Lex2.Next;
                                if Lex2.Get_Token = L_Virgule then
                                    Lex2.Next;
                                    if Lex2.Get_Token = L_Adresse then
                                        Lex2.Next;
                                        if Lex2.Get_Token = L_Fermante then
                                            Lex2.Next;
                                        else
                                            Ok := False;
                                            exit;
                                        end if;
                                    else
                                        Ok := False;
                                        exit;
                                    end if;
                                else
                                    Ok := False;
                                    exit;
                                end if;
                            else
                                Ok := False;
                                exit;
                            end if;
                        else
                            Ok := False;
                            exit;
                        end if;
                    else
                        Ok := False;
                        exit;
                    end if;
                else
                    Ok := False;
                    exit;
                end if;
            else
                Ok := False;
                exit;
            end if;
        end loop;
    end Parse_Stations;

    procedure Parse_Theatre (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_theatre");
        if Lex2.Get_Token = L_Theatre then
            Lex2.Next;
            if Lex2.Get_Token = L_Est then
                Lex2.Next;
                if Lex2.Get_Token = L_Collection then
                    Lex2.Next;
                    Parse_Stations (Ok1);
                    if not Ok1 then
                        Parse_Error (Stations_Follow);
                    end if;
                    if Lex2.Get_Token = L_Fin then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Theatre then
                            Lex2.Next;
                        else
                            Ok := False;
                        end if;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Theatre;

    procedure Parse_Type_Actor (Ok : out Boolean) is
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_type_actor");
        case Lex2.Get_Token is
            when L_Binaire | L_Discret | L_Fugitif | L_Temporel =>
                Lex2.Next;
            when others =>
                Ok := False;
        end case;
    end Parse_Type_Actor;

    procedure Parse_Acteurs (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_acteurs");
        while Lex2.Get_Token /= L_Fin loop
            Text_Io.Put_Line ("pepe");
            if Lex2.Get_Token = L_Id then
                Lex2.Next;
                if Lex2.Get_Token = L_2points then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Acteur then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Ouvrante then
                            Lex2.Next;
                            Parse_Type_Actor (Ok1);
                            if not Ok1 then
                                Parse_Error (Type_Actor_Follow);
                            end if;
                            Text_Io.Put_Line ("type acteur fini");
                            if Lex2.Get_Token = L_Virgule then
                                Lex2.Next;
                                if Lex2.Get_Token = L_Nbr then
                                    Lex2.Next;
                                    if Lex2.Get_Token = L_Fermante then
                                        Lex2.Next;
                                    else
                                        Ok := False;
                                        exit;
                                    end if;
                                else
                                    Ok := False;
                                    exit;
                                end if;
                            else
                                Ok := False;
                                exit;
                            end if;
                        else
                            Ok := False;
                            exit;
                        end if;
                    else
                        Ok := False;
                        exit;
                    end if;
                else
                    Ok := False;
                    exit;
                end if;
            else
                Ok := False;
                exit;
            end if;
        end loop;
    end Parse_Acteurs;

    procedure Parse_Corps_Materiel (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_corps_materiel");
        while Lex2.Get_Token /= L_Fin loop
            Text_Io.Put_Line ("fiotte");
            if Lex2.Get_Token = L_Id then
                Lex2.Next;
                if Lex2.Get_Token = L_Est then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Constitue then
                        Lex2.Next;
                        Parse_Acteurs (Ok1);
                        if not Ok1 then
                            Parse_Error (Acteurs_Follow);
                        end if;
                        if Lex2.Get_Token = L_Fin then
                            Lex2.Next;
                        else
                            Ok := False;
                            exit;
                        end if;
                    else
                        Ok := False;
                        exit;
                    end if;
                else
                    Ok := False;
                    exit;
                end if;
            else
                Ok := False;
                exit;
            end if;
        end loop;
    end Parse_Corps_Materiel;

    procedure Parse_Materiel (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        Text_Io.Put_Line ("parse_materiel");
        if Lex2.Get_Token = L_Materiel then
            Lex2.Next;
            if Lex2.Get_Token = L_Est then
                Lex2.Next;
                if Lex2.Get_Token = L_Collection then
                    Lex2.Next;
                    Parse_Corps_Materiel (Ok1);
                    if not Ok1 then
                        Parse_Error (Corps_Materiel_Follow);
                    end if;
                    if Lex2.Get_Token = L_Fin then
                        Lex2.Next;
                        if Lex2.Get_Token = L_Materiel then
                            Lex2.Next;
                        else
                            Ok := False;
                        end if;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Materiel;

    procedure Parse_Start (Ok : out Boolean) is
        Ok1 : Boolean := True;
    begin
        Ok := True;
        if Lex2.Get_Token = L_Repres then
            Lex2.Next;
            if Lex2.Get_Token = L_Id then
                Lex2.Next;
                Parse_Materiel (Ok1);
                if not Ok1 then
                    Parse_Error (Materiel_Follow);
                end if;
                Parse_Theatre (Ok1);
                if not Ok1 then
                    Parse_Error (Theatre_Follow);
                end if;
                Parse_Experience (Ok1);
                if not Ok1 then
                    Parse_Error (Experience_Follow);
                end if;
                Parse_Spectacle (Ok1);
                if not Ok1 then
                    Parse_Error (Spectacle_Follow);
                end if;
                if Lex2.Get_Token = L_Fin then
                    Lex2.Next;
                    if Lex2.Get_Token = L_Repres then
                        Lex2.Next;
                    else
                        Ok := False;
                    end if;
                else
                    Ok := False;
                end if;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Parse_Start;

    procedure Go is
        Fichier : constant String := ("bidon");
        Ok : Boolean := True;
    begin
        Lex2.Open (Fichier);
        Init_Set;
        loop
            Lex2.Next;
            Parse_Start (Ok);
            if not Ok then
                Parse_Error (Start_Follow);
            end if;
            exit when Lex2.At_End;
        end loop;
        Lex2.Close;
    end Go;


end Parse;