separate (Find_Unit.Build_Ada_Compilation_Unit)
procedure Function_End_Unit (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  =
    -- the end of a function compilation unit. We will get the     =
    -- 'end' followed by an optional identifier or string followed =
    -- by a semicolon. If a syntax error is found, then raise the  =
    -- exception Build_Syntax_Error.                               =
    -- The grammar :                                               =
    --      <Function_End_Unit> =                                  =
    --         'END' [<Id>] ';'                                    =
    --                                                             =
    -- written  by  GER  with  help  from  b2  and  JM             =
    -- May 1985  at EVB Software Engineering                       =
    --==============================================================

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

begin
    -- Function_End_Unit

    -- Get the 'End' of the function compilation unit

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

    if Token_Package.Value_Of (Current_Token) = Token_Package.End_Token then
        Compilation_Unit.Add_Token_To_Compilation_Unit
           (Token_To_Add => Current_Token, Unit_To_Add_To => Current_Unit);
    else
        -- Not the end of the function compilation unit
        raise Build_Syntax_Error;
    end if;

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

    if Token_Package.Value_Of (Current_Token) =
       Token_Package.Semicolon_Token then

        -- End of the function compilation unit

        Compilation_Unit.Add_Token_To_Compilation_Unit
           (Token_To_Add => Current_Token, Unit_To_Add_To => Current_Unit);
    elsif Token_Package.Class_Of (Current_Token) = Token_Package.Identifier or
          Token_Package.Class_Of (Current_Token) =
             Token_Package.Standard_String_Literal or
          Token_Package.Class_Of (Current_Token) =
             Token_Package.Alternate_String_Literal then

        -- Add the designator to the compilation unit and look for
        -- the final semicolon

        Compilation_Unit.Add_Token_To_Compilation_Unit
           (Token_To_Add => Current_Token, Unit_To_Add_To => Current_Unit);
        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 end of the compilation unit or accept
            raise Build_Syntax_Error;
        end if;

    else
        -- Not the end of the function compilation unit
        raise Build_Syntax_Error;
    end if;

end Function_End_Unit;