Ejemplo n.º 1
0
        private void ClassifyBuffer(ITextSnapshot snapshot)
        {
            if (disableSyntaxHighlighting)
            {
                return;
            }
            Debug("Starting classify at {0}, version {1}", DateTime.Now, snapshot.Version.ToString());
            ITokenStream tokens;

            tokens = _sourceWalker.Lex(snapshot.GetText());
            lock (gate)
            {
                _snapshot = snapshot;
                _tokens   = tokens;
                XSharpTokens xTokens = new XSharpTokens((BufferedTokenStream)tokens, snapshot);
                if (_buffer.Properties.ContainsProperty(typeof(XSharpTokens)))
                {
                    _buffer.Properties.RemoveProperty(typeof(XSharpTokens));
                }
                _buffer.Properties.AddProperty(typeof(XSharpTokens), xTokens);
            }
            BuildColorClassifications(tokens, snapshot);
            Debug("Ending classify at {0}, version {1}", DateTime.Now, snapshot.Version.ToString());
            return;
        }
Ejemplo n.º 2
0
        private void ClassifyBuffer(ITextSnapshot snapshot)
        {
            if (XSettings.DisableSyntaxHighlighting)
            {
                return;
            }
            // verify if someone else did not classify this already
            XSharpTokens xTokens = _buffer.GetTokens();
            ITokenStream tokens  = null;

            Debug("Starting classify at {0}, version {1}", DateTime.Now, snapshot.Version.ToString());
            tokens = _sourceWalker.Lex(snapshot.GetText());
            lock (gate)
            {
                _snapshot = snapshot;
                _tokens   = tokens;
                xTokens   = new XSharpTokens((BufferedTokenStream)tokens, snapshot);
                _buffer.Properties[typeof(XSharpTokens)] = xTokens;
            }
            BuildColorClassifications(tokens, snapshot);
            Debug("Ending classify at {0}, version {1}", DateTime.Now, snapshot.Version.ToString());
            return;
        }