Ejemplo n.º 1
0
        public CompilationDocument(TextSourceInfo textSourceInfo, IEnumerable <ITextLine> initialTextLines, TypeCobolOptions compilerOptions, IProcessedTokensDocumentProvider processedTokensDocumentProvider,
                                   [CanBeNull] MultilineScanState scanState, List <RemarksDirective.TextNameVariation> copyTextNameVariations)
        {
            TextSourceInfo          = textSourceInfo;
            CompilerOptions         = compilerOptions;
            CopyTextNamesVariations = copyTextNameVariations ?? new List <RemarksDirective.TextNameVariation>();
            MissingCopies           = new List <CopyDirective>();

            this.processedTokensDocumentProvider = processedTokensDocumentProvider;

            // Initialize the compilation document lines
            compilationDocumentLines = ImmutableList <CodeElementsLine> .Empty.ToBuilder();

            // ... with the initial list of text lines received as a parameter
            if (initialTextLines != null)
            {
                // Insert Cobol text lines in the internal tree structure
                compilationDocumentLines.AddRange(initialTextLines.Select(textLine => CreateNewDocumentLine(textLine, textSourceInfo.ColumnsLayout)));
            }

            // Initialize document views versions
            currentTextLinesVersion   = new DocumentVersion <ICobolTextLine>(this);
            currentTokensLinesVersion = new DocumentVersion <ITokensLine>(this);

            // Initialize performance stats
            PerfStatsForText         = new PerfStatsForCompilationStep(CompilationStep.Text);
            PerfStatsForScanner      = new PerfStatsForCompilationStep(CompilationStep.Scanner);
            PerfStatsForPreprocessor = new PerfStatsForParsingStep(CompilationStep.Preprocessor);

            initialScanStateForCopy = scanState;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new compilation document from a list of text lines.
 /// This method does not scan the inserted text lines to produce tokens.
 /// You must explicitely call UpdateTokensLines() to start an initial scan of the document.
 /// </summary>
 public CompilationUnit(TextSourceInfo textSourceInfo, IEnumerable <ITextLine> initialTextLines, TypeCobolOptions compilerOptions, IProcessedTokensDocumentProvider processedTokensDocumentProvider, List <RemarksDirective.TextNameVariation> copyTextNameVariations) :
     base(textSourceInfo, initialTextLines, compilerOptions, processedTokensDocumentProvider, copyTextNameVariations)
 {
     // Initialize performance stats
     PerfStatsForCodeElementsParser = new PerfStatsForParsingStep(CompilationStep.CodeElementsParser);
     PerfStatsForProgramClassParser = new PerfStatsForParsingStep(CompilationStep.ProgramClassParser);
 }