package body Compilation_Unit is

    function "=" (Left : in Token_Package.Token_Value;
                  Right : in Token_Package.Token_Value) return Boolean
        renames Token_Package."=";

    function "=" (Left : in Token_Package.Token_Class;
                  Right : in Token_Package.Token_Class) return Boolean
        renames Token_Package."=";

    --** 11/10/1985 JM
    Max_Length : constant := 256;
    subtype Length_Type is Natural range 0 .. Max_Length;
    type Program_Unit_Name (Length : Length_Type := 0) is
        record
            Value : String (1 .. Length);
        end record;

    -- Current_Block_ID keeps track of the number of
    -- unnamed blocks found during Produce_Metrics.
    -- It is modified by GET_BLOCK_NAME.
    Current_Block_Id : Positive := 1;

    procedure Get_Block_Name (Out_Name : out Program_Unit_Name) is separate;
    -- gets the next label for unnamed block. This label will
    -- be in the format "UNNAMED_BLOCK_xxx" where xxx is a
    -- unique positive number.

    function String_To_Name (This_String : in String)
                            return Program_Unit_Name is separate;
    -- converts a given string to program unit name

    function Seek (Origin : in Ada_Compilation_Unit; Offset : in Integer)
                  return Ada_Compilation_Unit is separate;
    -- allows a user to locate the position of Nth SIGNIFICANT
    -- token from the current token location (N is equal to
    -- Offet, current token location is equal to Origin). If
    -- the desired token does not exist, exception SYNTAX_ERROR
    -- will be raised. SIGNIFICANT tokens are tokens other than
    -- BLANK_LINEs, COMMENTs, or NEW_LINEs.

    function Peek (From : in Ada_Compilation_Unit; Offset : in Integer := 1)
                  return Token_Package.Token is separate;
    -- allows a user to peek at the Nth SIGNIFICANT
    -- token from the current token location (N is equal to
    -- Offet, current token location is equal to From). If
    -- the desired token does not exist, exception SYNTAX_ERROR
    -- will be raised. SIGNIFICANT tokens are tokens other than
    -- BLANK_LINEs, COMMENTs, or NEW_LINEs.

    function Concatenate (First_Token_Location : in Ada_Compilation_Unit;
                          Last_Token_Location : in Ada_Compilation_Unit)
                         return String is separate;
    -- appends one or more SIGNIFICANT tokens starting from
    -- First_Token_Location up to and including Last_Token_Location.
    -- If Last_Token_Location is behind First_Token_Location,
    -- the exception SYNTAX_ERROR will be raised.

    procedure Initialize_Compilation_Unit
                 (Initialized_Unit : in out Ada_Compilation_Unit) is separate;
    -- initializes a given compilation unit to a null list;
    -- if the given compilation unit is NOT empty, the contents
    -- will be destroyed.

    procedure Add_Token_To_Compilation_Unit
                 (Token_To_Add : in Token_Package.Token;
                  Unit_To_Add_To : in out Ada_Compilation_Unit) is separate;
    -- appends a token at the end of a given compilation unit.

    procedure Add_Compilation_Units
                 (Added_Unit : in Ada_Compilation_Unit;
                  Unit_To_Add_To : in out Ada_Compilation_Unit) is separate;
    -- appends Added_Unit at the end of Unit_To_Add_To

    procedure Produce_Metrics (This_Compilation_Unit : in out
                                  Ada_Compilation_Unit) is separate;
    -- calculates the complexity of a given Ada compilation unit
    -- and reports the results to the user. It "parses" the given
    -- Ada compilation unit and changes various metrics based on
    -- one or more tokens. If a SYNTAX_ERROR is found, the
    -- exception SYNTAX_ERROR will be raised. Produce_Metrics
    -- will report the results to the user when :
    --    1. a SYNTAX_ERROR is found, or
    --    2. no more tokens to "parse"

end Compilation_Unit;