/// <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) : base(textSourceInfo, initialTextLines, compilerOptions, processedTokensDocumentProvider) { // Initialize performance stats PerfStatsForCodeElementsParser = new PerfStatsForCompilationStep(CompilationStep.CodeElementsParser); PerfStatsForProgramClassParser = new PerfStatsForCompilationStep(CompilationStep.ProgramClassParser); }
// --- Initialization --- /// <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 CompilationDocument(TextSourceInfo textSourceInfo, IEnumerable<ITextLine> initialTextLines, TypeCobolOptions compilerOptions, IProcessedTokensDocumentProvider processedTokensDocumentProvider) { TextSourceInfo = textSourceInfo; CompilerOptions = compilerOptions; 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 PerfStatsForCompilationStep(CompilationStep.Preprocessor); }