本文整理汇总了C#中ProgramClassParser.ProcedureDivisionHeader方法的典型用法代码示例。如果您正苦于以下问题:C# ProgramClassParser.ProcedureDivisionHeader方法的具体用法?C# ProgramClassParser.ProcedureDivisionHeader怎么用?C# ProgramClassParser.ProcedureDivisionHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgramClassParser
的用法示例。
在下文中一共展示了ProgramClassParser.ProcedureDivisionHeader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnterProcedureDivision
public override void EnterProcedureDivision(ProgramClassParser.ProcedureDivisionContext context)
{
var terminal = context.ProcedureDivisionHeader();
var header = terminal != null? (ProcedureDivisionHeader)terminal.Symbol : null;
Enter(new ProcedureDivision(header), context);
}
示例2: EnterFunctionProcedureDivision
/// <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);
}