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

⟦e112eb7c1⟧ TextFile

    Length: 7664 (0x1df0)
    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

separate (Find_Unit.Build_Ada_Compilation_Unit)
procedure Get_Compilation_Unit (Current_Unit : in out
                                   Compilation_Unit.Ada_Compilation_Unit) is
    --==============================================================
    -- This procedure builds the next part of the grammer for an   =
    -- Ada compilation unit. Based on the next token, we will      =
    -- complete different productions. At present, we do not know  =
    -- which type of compilation unit this is. We will search for  =
    -- a generic, package, task, subprogram, or a block statement. =
    -- Different operations will be invoked depending on which     =
    -- compilation unit is found.                                  =
    -- The grammar :                                               =
    --               <Compilation_Unit> =                          =
    --                          <Generic_Unit>                     =
    --                        | <Package_Unit>                     =
    --                        | <Task_Unit>                        =
    --                        | <Block_Statement                   =
    --                        | <Subprogram>                       =
    --                                                             =
    -- written  by  GER  with  help  from  b2  and  JM             =
    -- May 1985  at EVB Software Engineering                       =
    --==============================================================

    Next_Token : Token_Package.Token;
    -- the current token read from the ada source code file

    Peek_Token : Token_Package.Token;
    -- A token that will be only peeked at

    Begin_Compilation_Unit : Boolean := False;
    -- This object is used to tell when we've seen the start of
    -- a compilation unit. The object will be set to true if
    -- we see any tokens besides a comment or a blank line.

    Found_Compilation_Unit : Boolean := False;
    -- True if the end of the compilation unit is found, false
    -- otherwise

begin
    -- Get_Compilation_Unit

    -- Stuff begin compilation unit token onto the current
    -- compilation unit

    Compilation_Unit.Add_Token_To_Compilation_Unit
       (Token_To_Add => Token_Package.Start_Of_Compilation_Unit,
        Unit_To_Add_To => Current_Unit);

    -- Set the peek ahead to the beginning. This is required if
    -- Build_Ada_Compilation_Unit is invoked recursively

    Token_Package.Set_Peek_Back;

    -- While a compilation unit has not been found, get
    -- tokens and put them in the compilation unit

    Looking_For_Compilation_Unit:
        while not Found_Compilation_Unit loop

            -- Peek ahead at the next token

            Peek_Next_Significant_Token (Significant_Token => Peek_Token);

            -- Look at the peek ahead token to see if it is the
            -- start of a compilation unit, or the end of file,
            -- or a token to stuff onto the compilation unit

            case Token_Package.Value_Of (Peek_Token) is

                when Token_Package.Generic_Token =>
                    Generic_Unit (Current_Unit => Current_Unit);

                    Found_Compilation_Unit := True;

                when Token_Package.Package_Token =>
                    Package_Unit (Current_Unit => Current_Unit);

                    Found_Compilation_Unit := True;

                when Token_Package.Task_Token =>
                    Task_Unit (Current_Unit => Current_Unit);

                    Found_Compilation_Unit := True;

                when Token_Package.Function_Token =>
                    Subprogram (Current_Unit => Current_Unit);

                    Found_Compilation_Unit := True;

                when Token_Package.Procedure_Token =>
                    Subprogram (Current_Unit => Current_Unit);

                    Found_Compilation_Unit := True;

                when Token_Package.Declare_Token =>
                    Block_Statement (Current_Unit => Current_Unit);

                    Found_Compilation_Unit := True;

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

                    Found_Compilation_Unit := True;

                when others =>

                    case Token_Package.Class_Of (Peek_Token) is

                        when Token_Package.Identifier =>

                            -- Peek ahead at the next token

                            Peek_Next_Significant_Token
                               (Significant_Token => Peek_Token);


                            -- if the token is a ':', then look for block
                            -- statement, else get next significant token

                            case Token_Package.Value_Of (Peek_Token) is

                                when Token_Package.Colon_Token =>
                                    Block_Statement
                                       (Current_Unit => Current_Unit);

                                    Found_Compilation_Unit := True;

                                when others =>
                                    -- else not a named block statement
                                    Get_Next_Significant_Token
                                       (Significant_Token => Next_Token,
                                        Current_Unit => Current_Unit);

                                    Compilation_Unit.
                                       Add_Token_To_Compilation_Unit
                                       (Token_To_Add => Next_Token,
                                        Unit_To_Add_To => Current_Unit);

                                    Found_Compilation_Unit := False;

                            end case;

                        when Token_Package.End_Of_File =>
                            --** flush the buffer
                            Get_Next_Significant_Token
                               (Significant_Token => Next_Token,
                                Current_Unit => Current_Unit);


                            -- If there has been some significant tokens seen so
                            -- far, but not a complete complation unit, then error.

                            if Begin_Compilation_Unit then
                                raise Build_Syntax_Error;
                            else
                                raise No_More_Compilation_Units;
                            end if;

                        when others =>

                            -- Doesn't match a compilation unit or an identifer
                            Get_Next_Significant_Token
                               (Significant_Token => Next_Token,
                                Current_Unit => Current_Unit);
                            Compilation_Unit.Add_Token_To_Compilation_Unit
                               (Token_To_Add => Next_Token,
                                Unit_To_Add_To => Current_Unit);

                            Found_Compilation_Unit := False;

                    end case;

            end case;

            -- This is the start of a compilation unit

            Begin_Compilation_Unit := True;

        end loop Looking_For_Compilation_Unit;

    -- Add all the insignificant tokens to the compilation unit
    -- ( Blank lines, comments, and new lines )

    Add_On_Insignificant_Tokens (Current_Unit => Current_Unit);

    -- Stuff the end compilation unit token onto the current
    -- compilation unit

    Compilation_Unit.Add_Token_To_Compilation_Unit
       (Token_To_Add => Token_Package.End_Of_Compilation_Unit,
        Unit_To_Add_To => Current_Unit);

end Get_Compilation_Unit;