本文整理汇总了C#中CodeElementsParser.cobol2002TypeClause方法的典型用法代码示例。如果您正苦于以下问题:C# CodeElementsParser.cobol2002TypeClause方法的具体用法?C# CodeElementsParser.cobol2002TypeClause怎么用?C# CodeElementsParser.cobol2002TypeClause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeElementsParser
的用法示例。
在下文中一共展示了CodeElementsParser.cobol2002TypeClause方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFunctionDataParameter
public ParameterDescriptionEntry CreateFunctionDataParameter(CodeElementsParser.FunctionDataParameterContext context)
{
var parameter = new ParameterDescriptionEntry();
parameter.LevelNumber = new GeneratedIntegerValue(1);
parameter.DataName = CobolWordsBuilder.CreateDataNameDefinition(context.dataNameDefinition());
if (context.pictureClause() != null) {
parameter.Picture = CobolWordsBuilder.CreateAlphanumericValue(context.pictureClause().pictureCharacterString);
parameter.DataType = DataType.Create(parameter.Picture.Value);
} else if(context.cobol2002TypeClause() != null) {
parameter.UserDefinedDataType = CobolWordsBuilder.CreateDataTypeNameReference(context.cobol2002TypeClause().dataTypeNameReference());
parameter.DataType = DataType.CreateCustom(parameter.UserDefinedDataType.Name);
}
//TODO#245: subphrases
return parameter;
}
示例2: EnterDataDescriptionEntry
public override void EnterDataDescriptionEntry(CodeElementsParser.DataDescriptionEntryContext context)
{
if (context.dataRenamesEntry() != null || context.dataConditionEntry() != null) {
// For levels 66 and 88, the DataDefinitionEntry is created by the following methods
// - EnterDataRenamesEntry
// - EnterDataConditionEntry
return;
}
if (context.redefinesClause() != null) {
// Redefines clause is not a separate rule in the grammar for optimization puroposes,
// but we pretend here that it is a separate rule
EnterDataRedefinesEntry(context);
return;
}
DataDescriptionEntry entry;
// [COBOL 2002]
if (context.cobol2002TypedefClause() != null) {
var typedef = new DataTypeDescriptionEntry();
typedef.DataTypeName = CobolWordsBuilder.CreateDataTypeNameDefinition(context.dataNameDefinition());
var strong = context.cobol2002TypedefClause().STRONG();
typedef.Strong = new SyntaxProperty<bool>(strong != null, ParseTreeUtils.GetFirstToken(strong));
entry = typedef;
entry.DataName = typedef.DataTypeName;
entry.DataType = new DataType(typedef.DataTypeName.Name, typedef.IsStrong);
}
// [/COBOL 2002]
else {
entry = new DataDescriptionEntry();
entry.DataName = CobolWordsBuilder.CreateDataNameDefinition(context.dataNameDefinition());
entry.DataType = DataType.Unknown;
}
if (context.levelNumber() != null)
entry.LevelNumber = CobolWordsBuilder.CreateIntegerValue(context.levelNumber().integerValue());
if (context.FILLER() != null) entry.Filler = new SyntaxProperty<bool>(true, ParseTreeUtils.GetFirstToken(context.FILLER()));
else entry.Filler = new SyntaxProperty<bool>(entry.DataName == null, null);
if (context.pictureClause() != null && context.pictureClause().Length > 0) {
var pictureClauseContext = context.pictureClause()[0];
entry.Picture = CobolWordsBuilder.CreateAlphanumericValue(pictureClauseContext.pictureCharacterString);
if (entry.DataType == DataType.Unknown) // only for a basic TYPEDEF <typename> PIC <picture>
entry.DataType = DataType.Create(entry.Picture.Value);
}
// [COBOL 2002]
if (context.cobol2002TypeClause() != null && context.cobol2002TypeClause().Length > 0) {
entry.UserDefinedDataType = CobolWordsBuilder.CreateDataTypeNameReference(context.cobol2002TypeClause()[0].dataTypeNameReference());
entry.DataType = DataType.CreateCustom(entry.UserDefinedDataType.Name);
}
// [/COBOL 2002]
if (context.blankWhenZeroClause() != null && context.blankWhenZeroClause().Length > 0)
{
var blankClauseContext = context.blankWhenZeroClause()[0];
Token zeroToken = null;
if (blankClauseContext.ZERO() != null)
{
zeroToken = ParseTreeUtils.GetFirstToken(blankClauseContext.ZERO());
}
else if (blankClauseContext.ZEROS() != null)
{
zeroToken = ParseTreeUtils.GetFirstToken(blankClauseContext.ZEROS());
}
else
{
zeroToken = ParseTreeUtils.GetFirstToken(blankClauseContext.ZEROES());
}
entry.IsBlankWhenZero = new SyntaxProperty<bool>(true, zeroToken);
}
if (context.externalClause() != null && context.externalClause().Length > 0) {
entry.External = new SyntaxProperty<bool>(true, ParseTreeUtils.GetFirstToken(context.externalClause()[0].EXTERNAL()));
}
if (context.globalClause() != null && context.globalClause().Length > 0) {
entry.Global = new SyntaxProperty<bool>(true, ParseTreeUtils.GetFirstToken(context.globalClause()[0].GLOBAL()));
}
if (context.justifiedClause() != null && context.justifiedClause().Length > 0)
{
var justifiedClauseContext = context.justifiedClause()[0];
Token justifiedToken = null;
if (justifiedClauseContext.JUSTIFIED() != null)
{
justifiedToken = ParseTreeUtils.GetFirstToken(justifiedClauseContext.JUSTIFIED());
}
else
{
justifiedToken = ParseTreeUtils.GetFirstToken(justifiedClauseContext.JUST());
}
entry.IsJustified = new SyntaxProperty<bool>(true, justifiedToken);
}
if (context.groupUsageClause() != null && context.groupUsageClause().Length > 0)
{
var groupUsageClauseContext = context.groupUsageClause()[0];
entry.IsJustified = new SyntaxProperty<bool>(true,
ParseTreeUtils.GetFirstToken(groupUsageClauseContext.NATIONAL()));
}
if (context.occursClause() != null && context.occursClause().Length > 0)
{
var occursClauseContext = context.occursClause()[0];
//.........这里部分代码省略.........