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 - metrics - download
Index: B T

⟦f5854ae25⟧ TextFile

    Length: 4698 (0x125a)
    Types: TextFile
    Names: »B«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

with Text_Io;
separate (Find_Unit.Build_Ada_Compilation_Unit)
procedure Unnamed_Block (Current_Unit : in out
                            Compilation_Unit.Ada_Compilation_Unit) is
    --==============================================================
    -- This procedure builds the next part of the grammar for an   =
    -- Ada compilation unit. Based on the next token, we will      =
    -- complete different productions. At present, we are          =
    -- parsing either an unnamed block statement or the rest of a  =
    -- named block statement. We will look at the next token to    =
    -- see where we are at in the block statement. If the token is =
    -- 'BEGIN', then we will take the first production. If the     =
    -- token is 'DECLARE', then we will take the second. If the    =
    -- token is neither, then we will raise syntax error.          =
    -- Grammar :                                                   =
    --         <Unnamed_Block> =                                   =
    -- <Begin_Statement> <End_Unit> |                              =
    -- 'DECLARE' * {<Declaration> * } <Begin_Statement> <End_Unit> =
    --                                                             =
    -- written  by  GER  with  help  from  b2  and  JM             =
    -- May 1985  EVB Software Engineering Inc.                     =
    --==============================================================

    Begin_Found : Boolean := False;
    -- Set to true when the beginning of statements is found

    Current_Token : Token_Package.Token;
    -- Holds the current token

    Peek_Token : Token_Package.Token;
    -- A token that will be gotten later

begin
    -- Unnamed_Block

    -- Set the peek back to the beginnning

    Token_Package.Set_Peek_Back;

    -- Parse either 'declare' or 'begin'

    Peek_Next_Significant_Token (Significant_Token => Peek_Token);

    case Token_Package.Value_Of (Peek_Token) is

        when Token_Package.Begin_Token =>
            Begin_Statement (Current_Unit => Current_Unit);
            End_Unit (Current_Unit => Current_Unit);

        when Token_Package.Declare_Token =>
            Get_Next_Significant_Token (Significant_Token => Current_Token,
                                        Current_Unit => Current_Unit);
            Compilation_Unit.Add_Token_To_Compilation_Unit
               (Token_To_Add => Current_Token, Unit_To_Add_To => Current_Unit);

            -- Look for nested compilation units followed
            -- by the statement section of the block statement

            Look_For_Nested_Compilation_Units:
                loop

                    -- Peek at the next token looking for nested
                    -- compilation units or 'BEGIN'

                    Peek_Next_Significant_Token
                       (Significant_Token => Peek_Token);

                    case Token_Package.Value_Of (Peek_Token) is
                        when Token_Package.Package_Token |
                             Token_Package.Procedure_Token |
                             Token_Package.Function_Token |
                             Token_Package.Task_Token |
                             Token_Package.Generic_Token =>

                            -- Parse a nested compilation unit ?

                            Declaration (Current_Unit => Current_Unit);
                        when Token_Package.Begin_Token =>

                            -- Found the beginning of statements, time to exit

                            Begin_Found := True;

                        when others =>

                            -- Not a nested compilation unit or the beginning
                            -- of the statement area

                            Get_Next_Significant_Token
                               (Significant_Token => Current_Token,
                                Current_Unit => Current_Unit);

                            if Token_Package.Class_Of (Current_Token) =
                               Token_Package.End_Of_File then
                                raise Build_Syntax_Error;
                            end if;

                            Compilation_Unit.Add_Token_To_Compilation_Unit
                               (Token_To_Add => Current_Token,
                                Unit_To_Add_To => Current_Unit);
                    end case;

                    exit Look_For_Nested_Compilation_Units when Begin_Found;
                end loop Look_For_Nested_Compilation_Units;

            Begin_Statement (Current_Unit => Current_Unit);
            End_Unit (Current_Unit => Current_Unit);

        when others =>
            raise Build_Syntax_Error;

    end case;

end Unnamed_Block;