示例#1
0
 public static void ScanSpans(TextDocument doc, SyntaxMode mode, Rule rule, CloneableStack <Span> spanStack, int start, int end)
 {
     if (mode == null)
     {
         return;
     }
     SyntaxMode.SpanParser parser = mode.CreateSpanParser(null, spanStack);
     parser.ParseSpans(start, end - start);
 }
示例#2
0
            public void InnerRun()
            {
                bool doUpdate  = false;
                int  startLine = doc.OffsetToLineNumber(startOffset);

                if (startLine < 0)
                {
                    return;
                }
                try {
                    var lineSegment = doc.GetLine(startLine);
                    if (lineSegment == null)
                    {
                        return;
                    }
                    var span = lineSegment.StartSpan;
                    if (span == null)
                    {
                        return;
                    }

                    var spanStack = span.Clone();

                    SyntaxMode.SpanParser parser = mode.CreateSpanParser(null, spanStack);

                    foreach (var line in doc.GetLinesStartingAt(startLine))
                    {
                        if (line == null)
                        {
                            return;
                        }

                        if (line.Offset > endOffset)
                        {
                            span = line.StartSpan;
                            if (span == null)
                            {
                                return;
                            }

                            bool equal = span.Equals(spanStack);

                            doUpdate |= !equal;

                            if (equal)
                            {
                                break;
                            }
                        }

                        line.StartSpan = spanStack.Clone();

                        parser.ParseSpans(line.Offset, line.LengthIncludingDelimiter);

                        while (spanStack.Count > 0 && !EndsWithContinuation(spanStack.Peek(), line))
                        {
                            parser.PopSpan();
                        }
                    }
                } catch (Exception e) {
                    Console.WriteLine("Syntax highlighting exception:" + e);
                }
                if (doUpdate)
                {
                    Gtk.Application.Invoke(delegate {
                        doc.RequestUpdate(new UpdateAll());
                        doc.CommitDocumentUpdate();
                    });
                }
                IsFinished = true;
                ManualResetEvent.Set();
            }
示例#3
0
 public static void ScanSpans(Document doc, SyntaxMode mode, Rule rule, CloneableStack <Span> spanStack, int start, int end)
 {
     SyntaxMode.SpanParser parser = mode.CreateSpanParser(doc, mode, null, spanStack);
     parser.ParseSpans(start, end - start);
 }
 protected void ScanSpansThreaded(Document doc, Rule rule, Stack <Span> spanStack, int start, int end)
 {
     SyntaxMode.SpanParser parser = mode.CreateSpanParser(doc, mode, null, spanStack);
     parser.ParseSpans(start, end - start);
 }