当前位置: 首页>>代码示例>>C#>>正文


C# CodeElementsParser类代码示例

本文整理汇总了C#中CodeElementsParser的典型用法代码示例。如果您正苦于以下问题:C# CodeElementsParser类的具体用法?C# CodeElementsParser怎么用?C# CodeElementsParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CodeElementsParser类属于命名空间,在下文中一共展示了CodeElementsParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateFunctionConditionParameter

 private DataConditionEntry CreateFunctionConditionParameter(CodeElementsParser.FunctionConditionParameterContext context)
 {
     var parameter = new DataConditionEntry();
     parameter.LevelNumber = CobolWordsBuilder.CreateIntegerValue(context.levelNumber().integerValue());
     parameter.DataName = CobolWordsBuilder.CreateConditionNameDefinition(context.conditionNameDefinition());
     SetConditionValues(parameter, context.valueClauseForCondition());
     return parameter;
 }
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:8,代码来源:TypeCobolCodeElementBuilder.cs

示例2: EnterFunctionReturningPhrase

 public override void EnterFunctionReturningPhrase(CodeElementsParser.FunctionReturningPhraseContext context)
 {
     var ce = (FunctionDeclarationHeader)CodeElement;
     ce.Returning = new SyntaxProperty<Passing.Mode>(Passing.Mode.Returning, ParseTreeUtils.GetTokenFromTerminalNode(context.RETURNING()));
     if (context.parameterDescription().functionDataParameter() != null) {
     var entry = CreateFunctionDataParameter(context.parameterDescription().functionDataParameter());
     ce.Profile.ReturningParameter = new ParameterDescription(entry);
     }
 }
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:9,代码来源:TypeCobolCodeElementBuilder.cs

示例3: EnterLibraryCopy

 public override void EnterLibraryCopy(CodeElementsParser.LibraryCopyContext context)
 {
     var copy = new LibraryCopyCodeElement();
     if (context.UserDefinedWord() != null) { // TCRFUN_LIBRARY_COPY
     var value = CobolWordsBuilder.CreateAlphanumericValue(context.UserDefinedWord());
     copy.Name = new SymbolDefinition(value, SymbolType.FileName);//TODO#278 eww!
     }
     Context = context;
     CodeElement = copy;
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:10,代码来源:TypeCobolCodeElementBuilder.cs

示例4: EnterAcceptStatement

 // --- ACCEPT ---
 public override void EnterAcceptStatement(CodeElementsParser.AcceptStatementContext context)
 {
     Context = context;
     if (context.acceptDataTransfer() != null) {
         CodeElement = CobolStatementsBuilder.CreateAcceptDataTransferStatement(context.acceptDataTransfer());
     } else
     if(context.acceptSystemDateTime() != null) {
         CodeElement = CobolStatementsBuilder.CreateAcceptSystemDateTime(context.acceptSystemDateTime());
     }
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:11,代码来源:CobolCodeElementBuilder.cs

示例5: EnterFunctionDeclarationHeader

 public override void EnterFunctionDeclarationHeader(CodeElementsParser.FunctionDeclarationHeaderContext context)
 {
     var visibility = context.PUBLIC() != null ? AccessModifier.Public : AccessModifier.Private;
     QualifiedName name = null;
     if (context.UserDefinedWord() != null) {
     var token = ParseTreeUtils.GetTokenFromTerminalNode(context.UserDefinedWord());
     name = new URI(token.Text);
     }
     Context = context;
     CodeElement = new FunctionDeclarationHeader(name, visibility);
 }
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:11,代码来源:TypeCobolCodeElementBuilder.cs

示例6: CreateAlphanumericVariable

 internal AlphanumericVariable CreateAlphanumericVariable(CodeElementsParser.AlphanumericVariable1Context context)
 {
     if (context.identifier() != null)
     {
         return new AlphanumericVariable(
             CreateIdentifier(context.identifier()));
     }
     else
     {
         return new AlphanumericVariable(
             CobolWordsBuilder.CreateAlphanumericValue(context.alphanumericValue3()));
     }
 }
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:13,代码来源:CobolExpressionsBuilder.cs

示例7: EnterAddStatement

 ////////////////
 // PARAGRAPHS //
 ////////////////
 // STATEMENTS
 ////////////////
 // --- ARITHMETIC STATEMENTS ---
 public override void EnterAddStatement(CodeElementsParser.AddStatementContext context)
 {
     Context = context;
     if(context.addSimple() != null) {
         CodeElement = CobolStatementsBuilder.CreateAddStatement(context.addSimple());
     } else
     if (context.addGiving() != null) {
         CodeElement = CobolStatementsBuilder.CreateAddGivingStatement(context.addGiving());
     } else
     if (context.addCorresponding() != null) {
         CodeElement = CobolStatementsBuilder.CreateAddCorrespondingStatement(context.addCorresponding());
     }
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:19,代码来源:CobolCodeElementBuilder.cs

示例8: 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 {
     parameter.CustomType = CobolWordsBuilder.CreateAlphanumericValue(context.cobol2002TypeClause());
     parameter.DataType = DataType.CreateCustom(parameter.CustomType.Value);
     }
     //TODO#245: subphrases
     return parameter;
 }
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:15,代码来源:TypeCobolCodeElementBuilder.cs

示例9: CreateAddressOfSpecialRegister

 internal StorageArea CreateAddressOfSpecialRegister(CodeElementsParser.AddressOfSpecialRegisterContext context)
 {
     var specialRegister = new StorageAreaPropertySpecialRegister(
         ParseTreeUtils.GetFirstToken(context.ADDRESS()),
         CreateStorageAreaReference(context.storageAreaReference()));
     if (specialRegister.DataDescriptionEntry != null)
     {
         var dataDescription = specialRegister.DataDescriptionEntry;
         CobolWordsBuilder.symbolInformationForTokens[specialRegister.DataDescriptionEntry.DataName.NameLiteral.Token] = specialRegister.DataDescriptionEntry.DataName;
     }
     if (specialRegister.SymbolReference != null)
     {
         CobolWordsBuilder.symbolInformationForTokens[specialRegister.SymbolReference.NameLiteral.Token] = specialRegister.SymbolReference;
     }
     return specialRegister;
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:16,代码来源:CobolExpressionsBuilder.cs

示例10: EnterFunctionDeclarationHeader

        public override void EnterFunctionDeclarationHeader(CodeElementsParser.FunctionDeclarationHeaderContext context)
        {
            var type = FunctionType.Undefined;
            if (context.PROCEDURE() != null) type = FunctionType.Procedure;
            if (context.FUNCTION()  != null) type = FunctionType.Function;

            // TCRFUN_NO_DEFAULT_ACCESS_MODIFIER
            // As the grammar enforces that there must be one least one of the PUBLIC or PRIVATE keywords,
            // there will be a syntax error if there is neither of these two keywords.
            // So, the fact of considering a function PRIVATE by default does not break this rule.
            var visibility = context.PUBLIC() != null ? AccessModifier.Public : AccessModifier.Private;

            SymbolDefinition name = null;
            if (context.functionNameDefinition() != null) {
            name = CobolWordsBuilder.CreateFunctionNameDefinition(context.functionNameDefinition());
            }
            Context = context;
            CodeElement = new FunctionDeclarationHeader(name, visibility, type);
        }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:19,代码来源:TypeCobolCodeElementBuilder.cs

示例11: EnterEnvironmentDivisionHeader

 //////////////////////////
 // ENVIRONMENT DIVISION //
 //////////////////////////
 public override void EnterEnvironmentDivisionHeader(CodeElementsParser.EnvironmentDivisionHeaderContext context)
 {
     Context = context;
     CodeElement = new EnvironmentDivisionHeader();
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:8,代码来源:CobolCodeElementBuilder.cs

示例12: EnterFileDescriptionEntry

        // FILE DESCRIPTION ENTRY
        ////////////////////////////
        public override void EnterFileDescriptionEntry(CodeElementsParser.FileDescriptionEntryContext context)
        {
            var entry = new FileDescriptionEntry();

            if (context.FD() != null)
                entry.LevelIndicator = new SyntaxProperty<FileDescriptionType>(FileDescriptionType.File, ParseTreeUtils.GetFirstToken(context.FD()));
            else
            if (context.SD() != null)
                entry.LevelIndicator = new SyntaxProperty<FileDescriptionType>(FileDescriptionType.SortMergeFile, ParseTreeUtils.GetFirstToken(context.SD()));

            entry.FileName = CobolWordsBuilder.CreateFileNameReference(context.fileNameReference());

            if (context.externalClause() != null && context.externalClause().Length > 0) {
                var externalClauseContext = context.externalClause()[0];
                entry.IsExternal = new SyntaxProperty<bool>(true, ParseTreeUtils.GetFirstToken(externalClauseContext.EXTERNAL()));
            }
            if (context.globalClause() != null && context.globalClause().Length > 0) {
                var globalClauseContext = context.globalClause()[0];
                entry.IsGlobal = new SyntaxProperty<bool>(true, ParseTreeUtils.GetFirstToken(globalClauseContext.GLOBAL()));
            }
            if (context.blockContainsClause() != null && context.blockContainsClause().Length > 0) {
                var blockContainsClauseContext = context.blockContainsClause()[0];
                entry.MaxBlockSize = CobolWordsBuilder.CreateIntegerValue(blockContainsClauseContext.maxNumberOfBytes);
                if (blockContainsClauseContext.minNumberOfBytes != null) {
                    entry.MinBlockSize = CobolWordsBuilder.CreateIntegerValue(blockContainsClauseContext.minNumberOfBytes);
                }
                if (blockContainsClauseContext.CHARACTERS() != null) {
                    entry.BlockSizeUnit = new SyntaxProperty<BlockSizeUnit>(BlockSizeUnit.Characters,
                        ParseTreeUtils.GetFirstToken(blockContainsClauseContext.CHARACTERS()));
                } else
                if (blockContainsClauseContext.RECORDS() != null) {
                    entry.BlockSizeUnit = new SyntaxProperty<BlockSizeUnit>(BlockSizeUnit.Records, ParseTreeUtils.GetFirstToken(blockContainsClauseContext.RECORDS()));
                }
            }
            if (context.recordClause() != null && context.recordClause().Length > 0) {
                var recordClauseContext = context.recordClause()[0];
                if (recordClauseContext.numberOfBytes != null) {
                    entry.MinRecordSize = CobolWordsBuilder.CreateIntegerValue(recordClauseContext.numberOfBytes);
                    entry.MaxRecordSize = entry.MinRecordSize;
                } else
                if (recordClauseContext.minNumberOfBytes != null) {
                    entry.MinRecordSize = CobolWordsBuilder.CreateIntegerValue(recordClauseContext.minNumberOfBytes);
                    entry.MaxRecordSize = CobolWordsBuilder.CreateIntegerValue(recordClauseContext.maxNumberOfBytes);
                } else
                if (recordClauseContext.VARYING() != null) {
                    if (recordClauseContext.fromNumberOfBytes != null)
                        entry.MinRecordSize = CobolWordsBuilder.CreateIntegerValue(recordClauseContext.fromNumberOfBytes);
                    if (recordClauseContext.toNumberOfBytes != null)
                        entry.MaxRecordSize = CobolWordsBuilder.CreateIntegerValue(recordClauseContext.toNumberOfBytes);
                    if (recordClauseContext.dataNameReference() != null)
                        entry.RecordSizeDependingOn = CobolWordsBuilder.CreateDataNameReference(recordClauseContext.dataNameReference());
                }
            }
            if (context.labelRecordsClause() != null && context.labelRecordsClause().Length > 0) {
                var labelRecordClauseContext = context.labelRecordsClause()[0];
                if (labelRecordClauseContext.STANDARD() != null) {
                    entry.LabelRecordType = new SyntaxProperty<LabelRecordType>(LabelRecordType.StandardLabels, ParseTreeUtils.GetFirstToken(labelRecordClauseContext.STANDARD()));
                }
                if (labelRecordClauseContext.OMITTED() != null) {
                    entry.LabelRecordType = new SyntaxProperty<LabelRecordType>(LabelRecordType.Omitted, ParseTreeUtils.GetFirstToken(labelRecordClauseContext.OMITTED()));
                } else
                if (labelRecordClauseContext.dataNameReference() != null && labelRecordClauseContext.dataNameReference().Length > 0) {
                    entry.LabelRecords = new SymbolReference[labelRecordClauseContext.dataNameReference().Length];
                    for (int i = 0; i < labelRecordClauseContext.dataNameReference().Length; i++)
                        entry.LabelRecords[i] = CobolWordsBuilder.CreateDataNameReference(labelRecordClauseContext.dataNameReference()[i]);
                }
            }
            if (context.valueOfClause() != null && context.valueOfClause().Length > 0) {
                var valueOfClauseContext = context.valueOfClause()[0];
                entry.ValueOfLabelRecords = new Dictionary<SymbolReference, Variable>();
                for (int i = 0; i < valueOfClauseContext.qualifiedDataName().Length; i++) {
                    entry.ValueOfLabelRecords.Add(
                        CobolWordsBuilder.CreateQualifiedDataName(valueOfClauseContext.qualifiedDataName()[i]),
                        CobolExpressionsBuilder.CreateVariable(valueOfClauseContext.variable5()[i]));
                }
            }
            if (context.dataRecordsClause() != null && context.dataRecordsClause().Length > 0) {
                var dataRecordClauseContext = context.dataRecordsClause()[0];
                entry.DataRecords = new SymbolReference[dataRecordClauseContext.dataNameReference().Length];
                for (int i = 0; i < dataRecordClauseContext.dataNameReference().Length; i++)
                    entry.DataRecords[i] = CobolWordsBuilder.CreateDataNameReference(dataRecordClauseContext.dataNameReference()[i]);
            }
            if (context.linageClause() != null && context.linageClause().Length > 0) {
                var linageClauseContext = context.linageClause()[0];
                if (linageClauseContext.numberOfLinesInPage != null)
                    entry.LogicalPageBodyLineCount = CobolExpressionsBuilder.CreateIntegerVariable(linageClauseContext.numberOfLinesInPage);
                if (linageClauseContext.firstLineNumberOfFootingArea != null)
                    entry.LogicalPageFootingLineNumber = CobolExpressionsBuilder.CreateIntegerVariable(linageClauseContext.firstLineNumberOfFootingArea);
                if (linageClauseContext.numberOfLinesInTopMargin != null)
                    entry.LogicalPageTopMarginLineCount = CobolExpressionsBuilder.CreateIntegerVariable(linageClauseContext.numberOfLinesInTopMargin);
                if (linageClauseContext.numberOfLinesInBottomMargin != null)
                    entry.LogicalPageBottomMarginLineCount = CobolExpressionsBuilder.CreateIntegerVariable(linageClauseContext.numberOfLinesInBottomMargin);
            }
            if (context.recordingModeClause() != null && context.recordingModeClause().Length > 0) {
                var recordingModeClauseContext = context.recordingModeClause()[0];
                entry.RecordingMode = CobolWordsBuilder.CreateRecordingMode(recordingModeClauseContext.recordingMode());
            }

//.........这里部分代码省略.........
开发者ID:osmedile,项目名称:TypeCobol,代码行数:101,代码来源:CobolCodeElementBuilder.cs

示例13: EnterFileControlParagraphHeader

 public override void EnterFileControlParagraphHeader(CodeElementsParser.FileControlParagraphHeaderContext context)
 {
     Context = context;
     CodeElement = new FileControlParagraphHeader();
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:5,代码来源:CobolCodeElementBuilder.cs

示例14: EnterDivideStatement

 public override void EnterDivideStatement(CodeElementsParser.DivideStatementContext context)
 {
     Context = context;
     if (context.divideSimple() != null) {
         CodeElement = CobolStatementsBuilder.CreateDivideStatement(context.divideSimple());
     } else
     if (context.divideGiving() != null) {
         CodeElement = CobolStatementsBuilder.CreateDivideGivingStatement(context.divideGiving());
     } else
     if (context.divideRemainder() != null) {
         CodeElement = CobolStatementsBuilder.CreateDivideRemainderStatement(context.divideRemainder());
     }
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:13,代码来源:CobolCodeElementBuilder.cs

示例15: EnterFileControlEntry

        public override void EnterFileControlEntry(CodeElementsParser.FileControlEntryContext context)
        {
            var entry = new FileControlEntry();

            if (context.selectClause() != null)
            {
                entry.FileName = CobolWordsBuilder.CreateFileNameDefinition(context.selectClause().fileNameDefinition());
                if (context.selectClause().OPTIONAL() != null)
                {
                    entry.IsOptional = new SyntaxProperty<bool>(true,
                        ParseTreeUtils.GetFirstToken(context.selectClause().OPTIONAL()));
                }
            }
            if (context.assignClause() != null && context.assignClause().Length > 0)
            {
                var assignClauseContext = context.assignClause()[0];
                entry.ExternalDataSet = CobolWordsBuilder.CreateAssignmentName(assignClauseContext.assignmentName()[0]);
            }
            if (context.reserveClause() != null && context.reserveClause().Length > 0)
            {
                var reserveClauseContext = context.reserveClause()[0];
                entry.ReserveIOBuffersCount = CobolWordsBuilder.CreateIntegerValue(reserveClauseContext.integerValue());
            }
            if (context.accessModeClause() != null && context.accessModeClause().Length > 0)
            {
                var accessModeClauseContext = context.accessModeClause()[0];
                if (accessModeClauseContext.SEQUENTIAL() != null)
                {
                    entry.AccessMode = new SyntaxProperty<FileAccessMode>(FileAccessMode.Sequential,
                        ParseTreeUtils.GetFirstToken(accessModeClauseContext.SEQUENTIAL()));
                }
                else if (accessModeClauseContext.RANDOM() != null)
                {
                    entry.AccessMode = new SyntaxProperty<FileAccessMode>(FileAccessMode.Random,
                        ParseTreeUtils.GetFirstToken(accessModeClauseContext.RANDOM()));
                }
                else if (accessModeClauseContext.DYNAMIC() != null)
                {
                    entry.AccessMode = new SyntaxProperty<FileAccessMode>(FileAccessMode.Dynamic,
                        ParseTreeUtils.GetFirstToken(accessModeClauseContext.DYNAMIC()));
                }
            }
            if (context.fileStatusClause() != null && context.fileStatusClause().Length > 0)
            {
                var fileStatusClauseContext = context.fileStatusClause()[0];
                entry.FileStatus = CobolExpressionsBuilder.CreateStorageArea(fileStatusClauseContext.fileStatus);
                if (fileStatusClauseContext.vsamReturnCode != null)
                {
                    entry.VSAMReturnCode = CobolExpressionsBuilder.CreateStorageArea(fileStatusClauseContext.vsamReturnCode);
                }
            }

            SyntaxProperty<FileRecordsOrganization> recordsOrganization = null;
            CharacterVariable paddingCharacter = null;
            Token recordDelimiter = null;
            SymbolReference recordKey = null;
            AlternateRecordKey[] alternateRecordKeys = null;
            SymbolReference relativeKey = null;
            SymbolReference password = null;
            if (context.organizationClause() != null && context.organizationClause().Length > 0)
            {
                var organizationClauseContext = context.organizationClause()[0];
                if (organizationClauseContext.SEQUENTIAL() != null)
                {
                    recordsOrganization = new SyntaxProperty<FileRecordsOrganization>(FileRecordsOrganization.Sequential,
                        ParseTreeUtils.GetFirstToken(organizationClauseContext.SEQUENTIAL()));
                }
                else if (organizationClauseContext.INDEXED() != null)
                {
                    recordsOrganization = new SyntaxProperty<FileRecordsOrganization>(FileRecordsOrganization.Indexed,
                        ParseTreeUtils.GetFirstToken(organizationClauseContext.INDEXED()));
                }
                else if (organizationClauseContext.RELATIVE() != null)
                {
                    recordsOrganization = new SyntaxProperty<FileRecordsOrganization>(FileRecordsOrganization.Relative,
                        ParseTreeUtils.GetFirstToken(organizationClauseContext.RELATIVE()));
                }
                if (organizationClauseContext.LINE() != null)
                {
                    recordsOrganization = new SyntaxProperty<FileRecordsOrganization>(FileRecordsOrganization.LineSequential,
                        ParseTreeUtils.GetFirstToken(organizationClauseContext.LINE()));
                }
            }
            if (context.paddingCharacterClause() != null && context.paddingCharacterClause().Length > 0)
            {
                var paddingCharacterClauseContext = context.paddingCharacterClause()[0];
                paddingCharacter = CobolExpressionsBuilder.CreateCharacterVariable(paddingCharacterClauseContext.characterVariable());
            }
            if (context.recordDelimiterClause() != null && context.recordDelimiterClause().Length > 0)
            {
                var recordDelimiterClauseContext = context.recordDelimiterClause()[0];
                if (recordDelimiterClauseContext.STANDARD_1() != null)
                {
                    recordDelimiter = ParseTreeUtils.GetFirstToken(recordDelimiterClauseContext.STANDARD_1());
                }
                else if (recordDelimiterClauseContext.literalOrUserDefinedWordOReservedWordExceptCopy() != null)
                {
                    recordDelimiter = ParseTreeUtils.GetFirstToken(recordDelimiterClauseContext.literalOrUserDefinedWordOReservedWordExceptCopy());
                }
            }
//.........这里部分代码省略.........
开发者ID:osmedile,项目名称:TypeCobol,代码行数:101,代码来源:CobolCodeElementBuilder.cs


注:本文中的CodeElementsParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。