Example #1
0
        private void DoScan(SlidingWindowReader reader, ICodeFormatter formatter, bool writeAsynchronously)
        {
            ArgumentValidator.ThrowIfNull(formatter, "formatter");
            this.Reader = reader;

            if (this.m_isFirstRun)
            {
                this.m_scopeStack      = new List <Scope>(8);
                this.m_modes           = new List <KeyValuePair <int, HighlightMode> >(64);
                this.m_possibleKeyword = new StringBuilder(this.m_syntaxDefinition.MaxKeywordLength + 1);
                this.m_isFirstRun      = false;
            }
            else
            {
                this.m_scopeStack.Clear();
                this.m_modes.Clear();
                this.m_possibleKeyword.Length = 0;
            }

            this.m_pendingMatch = new MatchResult();
            this.m_pendingMatch.PosMatchStart = int.MaxValue;
            this.m_posDontMatchUntil          = -1;
            this.m_posAfterKeepend            = int.MaxValue;

            this.m_scopeStack.Add(Scope.BuildBackgroundScope(this.m_syntaxDefinition.MainContext.TopItems));
            this.BuildHighlightModes();

            this.m_outputWriter = new HighlightedOutputWriter(formatter, writeAsynchronously);
            this.LoadInputWindow(this.Reader.CurrentWindow);
            this.Vrooom();
        }
Example #2
0
        private void DoScan(SlidingWindowReader reader, ICodeFormatter formatter, bool writeAsynchronously)
        {
            ArgumentValidator.ThrowIfNull(formatter, "formatter");
            this.Reader = reader;

            if (this.m_isFirstRun) {
                this.m_scopeStack = new List<Scope>(8);
                this.m_modes = new List<KeyValuePair<int, HighlightMode>>(64);
                this.m_possibleKeyword = new StringBuilder(this.m_syntaxDefinition.MaxKeywordLength + 1);
                this.m_isFirstRun = false;
            } else {
                this.m_scopeStack.Clear();
                this.m_modes.Clear();
                this.m_possibleKeyword.Length = 0;
            }

            this.m_pendingMatch = new MatchResult();
            this.m_pendingMatch.PosMatchStart = int.MaxValue;
            this.m_posDontMatchUntil = -1;
            this.m_posAfterKeepend = int.MaxValue;

            this.m_scopeStack.Add(Scope.BuildBackgroundScope(this.m_syntaxDefinition.MainContext.TopItems));
            this.BuildHighlightModes();

            this.m_outputWriter = new HighlightedOutputWriter(formatter, writeAsynchronously);
            this.LoadInputWindow(this.Reader.CurrentWindow);
            this.Vrooom();
        }