Press enter to see results or esc to cancel.

Processing Declarations

This procedure processes Pascal declarations: Constants, Types, Variables, Procedures, Functions, and if declarations are not in the Interface part of the unit, also Lables, Constructors and Destructors are processed. Before declarations are processes, statement compiler switches are reset to module compiler switches. This procedure is called from program compilation, unit interface and implementation compilation and Procedure/Function compilation.

Procedure ProcessDeclarations;
begin
  Repeat
    StatementCompilerSwitches := ModuleCompilerSwitches;
    Case Token of
      Token_CONST:     ProcessConstantDeclarations;
      Token_TYPE:      ProcessTypeDeclarations;
      Token_VAR:       ProcessVariableDeclarations;
      Token_PROCEDURE: ProcessProcedureDeclaration;
      Token_FUNCTION:  ProcessProcedureDeclaration;
      else If SourceType <> stUnitInterface then
        Case Token of
          Token_LABEL:       ProcessLabelDeclarations;
          Token_CONSTRUCTOR: ProcessProcedureDeclaration;
          Token_DESTRUCTOR:  ProcessProcedureDeclaration;
          else Exit;
        end else Exit;
    end;
  until False;
end;