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

⟦4828c29d3⟧ TextFile

    Length: 3730 (0xe92)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

separate (Syntaxe_1)
function Parse_Operation return Boolean is
    Tmp_Val : Personnal_String.Pstring;
    Tmp_Token : Token.Object;

    procedure Parse_Expr;

    procedure Parse_Fact is
    begin
        case Lex.Lex_Get_Token is

            when Token.L_Parentheseg =>
                if Tds.Mknode_Priorite (Token.L_Parentheseg) then
                    Lex.Lex_Next;
                    Parse_Expr;
                    if Token.Object'Pos (Lex.Lex_Get_Token) =
                       Token.Object'Pos (Token.L_Parenthesed) then
                        if Tds.Mknode_Priorite (Token.L_Parenthesed) then
                            Lex.Lex_Next;
                        else
                            raise Error;
                        end if;
                    else
                        raise Error;
                    end if;
                else
                    raise Error;
                end if;

            when others =>
                if Parse_Operande then
                    Tmp_Val := Lex.Lex_Get_Value;
                    Tmp_Token := Lex.Lex_Get_Token;
                    Lex.Lex_Next;
                else
                    raise Error;
                end if;

        end case;
    end Parse_Fact;

    procedure Parse_Term is
        T_Token : Token.Object;
    begin
        Parse_Fact;
        T_Token := Lex.Lex_Get_Token;
        while Token.Object'Pos (T_Token) = Token.Object'Pos (Token.L_Star) or
                 Token.Object'Pos (T_Token) =
                    Token.Object'Pos (Token.L_Slash) loop
            case T_Token is
                when Token.L_Star =>
                    if Tds.Mknode_Eval (Tmp_Val, Tmp_Token, Token.L_Star) then
                        Lex.Lex_Next;
                        Parse_Fact;
                    else
                        raise Error;
                    end if;

                when Token.L_Slash =>
                    if Tds.Mknode_Eval (Tmp_Val, Tmp_Token, Token.L_Slash) then
                        Lex.Lex_Next;
                        Parse_Fact;
                    else
                        raise Error;
                    end if;

                when others =>
                    if not Tds.Mknode_Eval (Tmp_Val, Tmp_Token) then
                        raise Error;
                    end if;

            end case;
            T_Token := Lex.Lex_Get_Token;
        end loop;
    end Parse_Term;

    procedure Parse_Expr is
        T_Token : Token.Object;
    begin
        Parse_Term;
        T_Token := Lex.Lex_Get_Token;
        while Token.Object'Pos (T_Token) = Token.Object'Pos (Token.L_Plus) or
                 Token.Object'Pos (T_Token) =
                    Token.Object'Pos (Token.L_Moins) loop
            case T_Token is

                when Token.L_Plus =>
                    if Tds.Mknode_Eval (Tmp_Val, Tmp_Token, Token.L_Plus) then
                        Lex.Lex_Next;
                        Parse_Term;
                    else
                        raise Error;
                    end if;

                when Token.L_Moins =>
                    if Tds.Mknode_Eval (Tmp_Val, Tmp_Token, Token.L_Moins) then
                        Lex.Lex_Next;
                        Parse_Term;
                    else
                        raise Error;
                    end if;

                when others =>
                    if not Tds.Mknode_Eval (Tmp_Val, Tmp_Token) then
                        raise Error;
                    end if;

            end case;
            T_Token := Lex.Lex_Get_Token;
        end loop;
    end Parse_Expr;


begin
    Parse_Expr;
    return Tds.Mknode_Eval (Tmp_Val, Tmp_Token);

exception
    when Error =>
        return False;
end Parse_Operation;