public CloneableStack <T> Clone()
        {
            CloneableStack <T> result = new CloneableStack <T> ();

            result.count = count;
            result.top   = top;
            return(result);
        }
Пример #2
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);
 }
Пример #3
0
 public SpanParser(Document doc, SyntaxMode mode, CloneableStack <Span> spanStack)
 {
     if (doc == null)
     {
         throw new ArgumentNullException("doc");
     }
     this.doc       = doc;
     this.mode      = mode;
     this.SpanStack = spanStack;
     this.CurRule   = mode;
     this.ruleStack = CreateRuleStack();
     this.CurRule   = ruleStack.Peek();
     this.CurSpan   = spanStack.Count > 0 ? spanStack.Peek() : null;
     FoundSpanBegin = DefaultFoundSpanBegin;
     FoundSpanEnd   = DefaultFoundSpanEnd;
     FoundSpanExit  = DefaultFoundSpanEnd;
     ParseChar      = delegate(ref int i, char ch) {};
 }
Пример #4
0
 public SpanParser(SyntaxMode mode, CloneableStack <Span> spanStack)
 {
     if (mode == null)
     {
         throw new ArgumentNullException("mode");
     }
     this.doc = mode.Document;
     if (this.doc == null)
     {
         throw new ArgumentException("Syntax mode isn't bound to any document.", "mode");
     }
     this.mode      = mode;
     this.SpanStack = spanStack;
     this.CurRule   = mode;
     this.ruleStack = CreateRuleStack();
     this.CurRule   = ruleStack.Peek();
     this.CurSpan   = spanStack.Count > 0 ? spanStack.Peek() : null;
     FoundSpanBegin = DefaultFoundSpanBegin;
     FoundSpanEnd   = DefaultFoundSpanEnd;
     FoundSpanExit  = DefaultFoundSpanEnd;
     ParseChar      = delegate(ref int i, char ch) {};
 }
Пример #5
0
 public virtual SpanParser CreateSpanParser(DocumentLine line, CloneableStack <Span> spanStack)
 {
     return(new SpanParser(this, spanStack ?? line.StartSpan.Clone()));
 }
Пример #6
0
 public override SpanParser CreateSpanParser(DocumentLine line, CloneableStack <Span> spanStack)
 {
     return(new JaySpanParser(this, spanStack ?? line.StartSpan.Clone()));
 }
Пример #7
0
 public JaySpanParser(SyntaxMode mode, CloneableStack <Span> spanStack) : base(mode, spanStack)
 {
 }
Пример #8
0
 public virtual SpanParser CreateSpanParser(Document doc, SyntaxMode mode, LineSegment line, CloneableStack <Span> spanStack)
 {
     return(new SpanParser(doc, mode, spanStack ?? line.StartSpan.Clone()));
 }
Пример #9
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);
 }
Пример #10
0
 public JaySpanParser(Document doc, SyntaxMode mode, CloneableStack <Span> spanStack) : base(doc, mode, spanStack)
 {
 }
 public bool Equals(CloneableStack <T> other)
 {
     return(ReferenceEquals(top, other.top));
 }