Пример #1
0
 public object VisitRule(XshdRule rule)
 {
     return(new HighlightingRule {
         Color = GetColor(rule, rule.ColorReference),
         Regex = CreateRegex(rule, rule.Regex, rule.RegexType)
     });
 }
Пример #2
0
        object IXshdVisitor.VisitRule(XshdRule rule)
        {
            writer.WriteStartElement("Rule", Namespace);
            WriteColorReference(rule.ColorReference);

            writer.WriteString(rule.Regex);

            writer.WriteEndElement();
            return(null);
        }
        object IXshdVisitor.VisitRule(XshdRule rule)
        {
            writer.WriteStartElement("Rule", Namespace);
            WriteColorReference(rule.ColorReference);

            writer.WriteString(rule.Regex);

            writer.WriteEndElement();
            return null;
        }
Пример #4
0
        static XshdRule ParseRule(XmlReader reader)
        {
            XshdRule rule = new XshdRule();

            SetPosition(rule, reader);
            rule.ColorReference = ParseColorReference(reader);
            if (!reader.IsEmptyElement)
            {
                reader.Read();
                if (reader.NodeType == XmlNodeType.Text)
                {
                    rule.Regex     = reader.ReadContentAsString();
                    rule.RegexType = XshdRegexType.IgnorePatternWhitespace;
                }
            }
            return(rule);
        }
Пример #5
0
 public object VisitRule(XshdRule rule)
 {
     return(rule.ColorReference.AcceptVisitor(this));
 }
			public object VisitRule(XshdRule rule)
			{
				return rule.ColorReference.AcceptVisitor(this);
			}
Пример #7
0
		static XshdRule ParseRule(XmlReader reader)
		{
			XshdRule rule = new XshdRule();
			SetPosition(rule, reader);
			rule.ColorReference = ParseColorReference(reader);
			if (!reader.IsEmptyElement) {
				reader.Read();
				if (reader.NodeType == XmlNodeType.Text) {
					rule.Regex = reader.ReadContentAsString();
					rule.RegexType = XshdRegexType.IgnorePatternWhitespace;
				}
			}
			return rule;
		}
Пример #8
0
 public object VisitRule(XshdRule rule)
 {
     return new HighlightingRule {
         Color = GetColor(rule, rule.ColorReference),
         Regex = CreateRegex(rule, rule.Regex, rule.RegexType)
     };
 }
Пример #9
0
		private void updateStandardWordList(int i)
		{
			OptionsWindow _ow = new OptionsWindow();

			XshdKeywords newKeyWords = new XshdKeywords();
			XshdSpan newSpan = new XshdSpan();
			XshdSpan otherNewSpan = new XshdSpan();
			XshdSpan thirdNewSpan = new XshdSpan();
			XshdSpan thNewSpan = new XshdSpan();
			XshdRule rule = new XshdRule();
			 
			XshdRuleSet mainRuleSet = xshd.Elements.OfType<XshdRuleSet>().Where(o => string.IsNullOrEmpty(o.Name)).First();
			
			if(i==0)
			{
				for(int ii=0;ii<_ow.commands.Count;ii++)
				{
					newKeyWords.Words.Add(_ow.commands[ii].Commnd);
				}
				
				XshdColor xcol = xshd.Elements.OfType<XshdColor>().Where(xc => string.Equals(xc.Name, (_ow.words[i].color+_ow.words[i].fontstyle), StringComparison.CurrentCultureIgnoreCase)).First();
				newKeyWords.ColorReference = new XshdReference<XshdColor>(null, xcol.Name);
				mainRuleSet.Elements.Add(newKeyWords);
			}
			if(i==1)
			{
				for(int ii=0;ii<_ow.subs.Count;ii++)
				{
					newKeyWords.Words.Add(_ow.subs[ii].Sub);
				}
				
				XshdColor xcol = xshd.Elements.OfType<XshdColor>().Where(xc => string.Equals(xc.Name, (_ow.words[i].color+_ow.words[i].fontstyle), StringComparison.CurrentCultureIgnoreCase)).First();
				newKeyWords.ColorReference = new XshdReference<XshdColor>(null, xcol.Name);
				mainRuleSet.Elements.Add(newKeyWords);
			}
			if(i==2)
			{
				XshdColor xcol = xshd.Elements.OfType<XshdColor>().Where(xc => string.Equals(xc.Name, (_ow.words[i].color+_ow.words[i].fontstyle), StringComparison.CurrentCultureIgnoreCase)).First();
				
				newSpan.SpanColorReference = new XshdReference<XshdColor>(null, xcol.Name);
				newSpan.BeginRegex = @"[//]{2,3}";
				
				otherNewSpan.SpanColorReference = new XshdReference<XshdColor>(null, xcol.Name);
				otherNewSpan.BeginRegex = @";.";
				
				mainRuleSet.Elements.Add(newSpan);
				mainRuleSet.Elements.Add(otherNewSpan);
				
			}
			if(i==3)
			{
				XshdColor xcol = xshd.Elements.OfType<XshdColor>().Where(xc => string.Equals(xc.Name, (_ow.words[i].color+_ow.words[i].fontstyle), StringComparison.CurrentCultureIgnoreCase)).First();
				rule.ColorReference = new XshdReference<XshdColor>(null, xcol.Name);
				rule.Regex = @"\b0[xX][0-9a-fA-F]+|\b(\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?";
				mainRuleSet.Elements.Add(rule);
			}
			if(i==4)
			{
				XshdColor xcol = xshd.Elements.OfType<XshdColor>().Where(xc => string.Equals(xc.Name, (_ow.words[i].color+_ow.words[i].fontstyle), StringComparison.CurrentCultureIgnoreCase)).First();
				thNewSpan.SpanColorReference = new XshdReference<XshdColor>(null, xcol.Name);
				thNewSpan.BeginRegex = "\"";
				thNewSpan.EndRegex = "\"";
				mainRuleSet.Elements.Add(thNewSpan);
			}
			if(i==5)
			{
				for(int ii=0;ii<_ow.oc_alias.Count;ii++)
				{
					newKeyWords.Words.Add(_ow.oc_alias[ii].Alias);
				}
				
				XshdColor xcol = xshd.Elements.OfType<XshdColor>().Where(xc => string.Equals(xc.Name, (_ow.words[i].color+_ow.words[i].fontstyle), StringComparison.CurrentCultureIgnoreCase)).First();
				newKeyWords.ColorReference = new XshdReference<XshdColor>(null, xcol.Name);
				mainRuleSet.Elements.Add(newKeyWords);
			}
			
					
		}