Exemplo n.º 1
0
		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);
		}
Exemplo n.º 3
0
			public void PushSpan (Span span, Rule rule)
			{
				spanStack.Push (span);
				ruleStack.Push (rule);
				this.CurRule = rule;
				this.CurSpan = span;
			}
Exemplo n.º 4
0
		void AddSemanticRule (Rule rule, SemanticRule semanticRule)
		{
			if (rule != null)
				rule.SemanticRules.Add (semanticRule);
		}
Exemplo n.º 5
0
		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;
		}
Exemplo n.º 6
0
		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;
		}
Exemplo n.º 7
0
 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);
         }
     }
 }
Exemplo n.º 8
0
			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);
			}
Exemplo n.º 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);
		}
			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);
			}
Exemplo n.º 11
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);
 }