void RemoveSemanticRule (Rule rule, Type type) { if (rule != null) { for (int i = 0; i < rule.SemanticRules.Count; i++) { if (rule.SemanticRules[i].GetType () == type) { rule.SemanticRules.RemoveAt (i); i--; } } } }
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); }
public void PushSpan (Span span, Rule rule) { spanStack.Push (span); ruleStack.Push (rule); this.CurRule = rule; this.CurSpan = span; }
void AddSemanticRule (Rule rule, SemanticRule semanticRule) { if (rule != null) rule.SemanticRules.Add (semanticRule); }
public static Rule Read (SyntaxMode mode, XmlReader reader, bool ignoreCaseDefault) { Rule result = new Rule (); result.Name = reader.GetAttribute ("name"); result.DefaultColor = reader.GetAttribute ("color"); result.IgnoreCase = ignoreCaseDefault; if (!String.IsNullOrEmpty (reader.GetAttribute ("ignorecase"))) result.IgnoreCase = Boolean.Parse (reader.GetAttribute ("ignorecase")); List<Match> matches = new List<Match> (); List<Span> spanList = new List<Span> (); List<Marker> prevMarkerList = new List<Marker> (); XmlReadHelper.ReadList (reader, Node, delegate () { switch (reader.LocalName) { case Node: return true; } return result.ReadNode (reader, matches, spanList, prevMarkerList); }); result.matches = matches.ToArray (); result.spans = spanList.ToArray (); result.prevMarker = prevMarkerList.ToArray (); return result; }
Rule DeepCopy (TextDocument doc, SyntaxMode mode, Rule rule) { var newRule = new Rule (); newRule.spans = new Span[rule.Spans.Length]; for (int i = 0; i < rule.Spans.Length; i++) { newRule.spans [i] = rule.Spans [i].Clone (); } if (rule.HasDelimiter) newRule.SetDelimiter (rule.GetDelimiter (null)); newRule.IgnoreCase = rule.IgnoreCase; newRule.Name = rule.Name; newRule.DefaultColor = rule.DefaultColor; newRule.matches = rule.Matches; newRule.prevMarker = rule.PrevMarker; newRule.keywords = rule.keywords; newRule.keywordTable = rule.keywordTable; newRule.keywordTableIgnoreCase = rule.keywordTableIgnoreCase; foreach (var pair in rule.Properties) newRule.Properties.Add (pair.Key, pair.Value); return newRule; }
public FSharpSpanParser(Document doc, SyntaxMode mode, LineSegment line, Stack<Span> spanStack) : base(doc, mode, line, spanStack) { foreach (Span span in mode.Spans) { if (span.Rule == "text.preprocessor") { preprocessorSpan = span; preprocessorRule = GetRule (span); } } }
public void PushSpan (Span span, Rule rule) { spanStack.Push (span); ruleStack.Push (rule); CurRule = rule; CurSpan = span; if (rule.Name == "InterpolatedString" || rule.Name == "InterpolatedVerbatimString") interpolatedBraces.Push(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); }
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); }