public override void EnterProcedureDivision(ProgramClassParser.ProcedureDivisionContext context)
 {
     var terminal = context.ProcedureDivisionHeader();
     var header = terminal != null? (ProcedureDivisionHeader)terminal.Symbol : null;
     Enter(new ProcedureDivision(header), context);
 }
 /// <summary>Parent node: DECLARE FUNCTION</summary>
 /// <param name="context">PROCEDURE DIVISION</param>
 public override void EnterFunctionProcedureDivision(ProgramClassParser.FunctionProcedureDivisionContext context)
 {
     var header = (ProcedureDivisionHeader)context.ProcedureDivisionHeader().Symbol;
     if (header.UsingParameters != null && header.UsingParameters.Count > 0)
         DiagnosticUtils.AddError(header, "TCRFUN_DECLARATION_NO_USING");//TODO#249
     var declaration = (FunctionDeclarationHeader)CurrentNode.CodeElement;
     foreach(var parameter in declaration.Profile.InputParameters) {
         parameter.SymbolTable = CurrentNode.SymbolTable;
         CurrentNode.SymbolTable.AddVariable(parameter);
     }
     foreach(var parameter in declaration.Profile.OutputParameters) {
         parameter.SymbolTable = CurrentNode.SymbolTable;
         CurrentNode.SymbolTable.AddVariable(parameter);
     }
     foreach(var parameter in declaration.Profile.InoutParameters) {
         parameter.SymbolTable = CurrentNode.SymbolTable;
         CurrentNode.SymbolTable.AddVariable(parameter);
     }
     if (declaration.Profile.ReturningParameter != null) {
         declaration.Profile.ReturningParameter.SymbolTable = CurrentNode.SymbolTable;
         CurrentNode.SymbolTable.AddVariable(declaration.Profile.ReturningParameter);
     } else
     if (header.ReturningParameter != null) {
         // we might have a RETURNING parameter to convert, but only if there is neither
         // PICTURE nor TYPE clause for the returning parameter in the function declaration.
         // however, this is as syntax error.
         var pentry = new ParameterDescriptionEntry();
         var data = header.ReturningParameter.StorageArea as DataOrConditionStorageArea;
         if (data != null) pentry.DataName = new SymbolDefinition(data.SymbolReference.NameLiteral, data.SymbolReference.Type);
         // pentry.Picture will remain empty, we can't do anything about it
         pentry.DataType = DataType.Unknown;
         declaration.Profile.ReturningParameter = new ParameterDescription(pentry);
     }
     Enter(new ProcedureDivision(header), context);
 }