예제 #1
0
        public ImportedToken(Token originalToken, CopyDirective copyDirective)
            : base(originalToken.TokenType, originalToken.StartIndex, originalToken.StopIndex, originalToken.UsesVirtualSpaceAtEndOfLine, originalToken.TokensLine,
                  originalToken.HasOpeningDelimiter, originalToken.HasClosingDelimiter, originalToken.ExpectedClosingDelimiter)
        {
            this.OriginalToken = originalToken;
            this.CopyDirective = copyDirective;

            HasError = originalToken.HasError;
            UsesDelimiters = originalToken.UsesDelimiters;
            LiteralValue = originalToken.LiteralValue;
        }
        /// <summary>
        /// Implement COPY REPLACING on top of an underlying tokens line iterator
        /// </summary>
        public ReplaceTokensLinesIterator(ITokensLinesIterator sourceIterator, CopyDirective copyReplacingDirective)
        {
            this.sourceIterator = sourceIterator;
            this.CopyReplacingDirective = copyReplacingDirective;

            if(copyReplacingDirective.ReplaceOperations.Count > 0)
            {
                if(copyReplacingDirective.ReplaceOperations.Count == 1)
                {
                    currentPosition.ReplaceOperation = copyReplacingDirective.ReplaceOperations[0];
                }
                else
                {
                    currentPosition.ReplaceOperations = copyReplacingDirective.ReplaceOperations;
                }
            }
        }
예제 #3
0
 public ImportedTokensDocument(CopyDirective copyDirective, ProcessedTokensDocument importedDocumentSource)
 {
     CopyDirective = copyDirective;
     SourceDocument = importedDocumentSource;
     HasReplacingDirective = copyDirective.ReplaceOperations.Count > 0;
 }
 public override void EnterCopyCompilerStatement(CobolCompilerDirectivesParser.CopyCompilerStatementContext context)
 {
     CompilerDirective = new CopyDirective(CompilerDirectiveType.COPY);
 }
        public override void EnterExecSqlIncludeStatement(CobolCompilerDirectivesParser.ExecSqlIncludeStatementContext context)
        {
            var copyDirective = new CopyDirective(CompilerDirectiveType.EXEC_SQL_INCLUDE);
            CompilerDirective = copyDirective;

            if (context.copyCompilerStatementBody() != null)
            {
                var textNameContext = context.copyCompilerStatementBody().qualifiedTextName().textName();
                if (textNameContext != null)
                {
                    string textName = GetTextName(textNameContext);
                    copyDirective.TextName = textName;
                    copyDirective.TextNameSymbol = ParseTreeUtils.GetFirstToken(textNameContext);
                }

                var libraryNameContext = context.copyCompilerStatementBody().qualifiedTextName().libraryName();
                if (libraryNameContext != null)
                {
                    copyDirective.LibraryName = GetLibraryName(libraryNameContext);
                    copyDirective.LibraryNameSymbol = ParseTreeUtils.GetFirstToken(libraryNameContext);
                }
            }
        }