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

⟦5bbedf2f6⟧ TextFile

    Length: 5959 (0x1747)
    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 Package_Body (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  =
    -- a package body. This procedure will try to find nested      =
    -- compilation units, the end of the package body, or the      =
    -- beginning of the statement area in the package body. If any =
    -- errors are detected, then the exeption Build_Syntax_Error   =
    -- will be raised.                                             =
    -- The grammar :                                               =
    --     <Package_Body> =                                        =
    --         * {<Declaration> *} <End_Package_Body> |            =
    --         'SEPARATE' ';'                                      =
    --                                                             =
    -- written  by  GER  with  help  from  b2  and  JM             =
    -- May 1985  at EVB Software Engineering                       =
    --==============================================================

    Current_Token : Token_Package.Token;
    -- the current token read from the ada source code file
    Peek_Token : Token_Package.Token;
    -- A token that will later be gotten by
    -- Get_Next_Significant_Token
    End_Or_Begin_Found : Boolean := False;
    -- Set to true when either the end of package body or
    -- the 'begin' is found

begin
    -- Package_Body

    -- Set the peek back to the beginning

    Token_Package.Set_Peek_Back;

    -- Peek at the next significant token

    Peek_Next_Significant_Token (Significant_Token => Peek_Token);

    if Token_Package.Value_Of (Peek_Token) = Token_Package.Separate_Token then

        -- Found a Package body stub compilation unit, get 'Separate'

        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);

        -- Get the semicolon token

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

        if Token_Package.Value_Of (Current_Token) =
           Token_Package.Semicolon_Token then
            Compilation_Unit.Add_Token_To_Compilation_Unit
               (Token_To_Add => Current_Token, Unit_To_Add_To => Current_Unit);
        else
            -- Not the correct grammar
            raise Build_Syntax_Error;
        end if;

    else
        -- Must be a package body

        -- Parse tokens until either the end of the package body
        -- is found or a 'begin'. Any nested compilation units will
        -- cause the subprogram Declaration to be invoked.

        Search_For_End_Or_Begin:
            loop

                -- Is there a nested compilation unit ?

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

                        -- A possible nested compilation unit has been found

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

                        -- Found the beginning of statement area of a package
                        -- body

                        End_Or_Begin_Found := True;
                    when Token_Package.End_Token =>

                        -- See if this is really the end of compilation unit or
                        -- just a 'end record'

                        Peek_Next_Significant_Token
                           (Significant_Token => Peek_Token);

                        if Token_Package.Value_Of (Peek_Token) =
                           Token_Package.Semicolon_Token or
                           Token_Package.Class_Of (Peek_Token) =
                              Token_Package.Identifier then
                            End_Or_Begin_Found := True;
                        else
                            -- Not the end of the compilation unit yet
                            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);
                        end if;

                    when others =>
                        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);
                end case;

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

                exit Search_For_End_Or_Begin when End_Or_Begin_Found;

                -- Peek at the next significant token

                Peek_Next_Significant_Token (Significant_Token => Peek_Token);
            end loop Search_For_End_Or_Begin;

        End_Package_Body (Current_Unit => Current_Unit);

    end if;

end Package_Body;