/// <summary>
 /// Equality operator.
 /// </summary>
 public bool Equals(XshdReference <T> other)
 {
     // add comparisions for all members here
     return(this.referencedDefinition == other.referencedDefinition &&
            this.referencedElement == other.referencedElement &&
            this.inlineElement == other.inlineElement);
 }
Beispiel #2
0
 void WriteBeginEndElement(string elementName, string regex, XshdReference <XshdColor> colorReference)
 {
     if (regex != null)
     {
         writer.WriteStartElement(elementName, Namespace);
         WriteColorReference(colorReference);
         writer.WriteString(regex);
         writer.WriteEndElement();
     }
 }
Beispiel #3
0
 void WriteRuleSetReference(XshdReference <XshdRuleSet> ruleSetReference)
 {
     if (ruleSetReference.ReferencedElement != null)
     {
         if (ruleSetReference.ReferencedDefinition != null)
         {
             writer.WriteAttributeString("ruleSet", ruleSetReference.ReferencedDefinition + "/" + ruleSetReference.ReferencedElement);
         }
         else
         {
             writer.WriteAttributeString("ruleSet", ruleSetReference.ReferencedElement);
         }
     }
 }
 HighlightingRuleSet GetRuleSet(XshdElement position, XshdReference<XshdRuleSet> ruleSetReference)
 {
     if (ruleSetReference.InlineElement != null) {
         return (HighlightingRuleSet)ruleSetReference.InlineElement.AcceptVisitor(this);
     } else if (ruleSetReference.ReferencedElement != null) {
         IHighlightingDefinition definition = GetDefinition(position, ruleSetReference.ReferencedDefinition);
         HighlightingRuleSet ruleSet = definition.GetNamedRuleSet(ruleSetReference.ReferencedElement);
         if (ruleSet == null)
             throw Error(position, "Could not find rule set named '" + ruleSetReference.ReferencedElement + "'.");
         return ruleSet;
     } else {
         return null;
     }
 }
 HighlightingColor GetColor(XshdElement position, XshdReference<XshdColor> colorReference)
 {
     if (colorReference.InlineElement != null) {
         return (HighlightingColor)colorReference.InlineElement.AcceptVisitor(this);
     } else if (colorReference.ReferencedElement != null) {
         IHighlightingDefinition definition = GetDefinition(position, colorReference.ReferencedDefinition);
         HighlightingColor color = definition.GetNamedColor(colorReference.ReferencedElement);
         if (color == null)
             throw Error(position, "Could not find color named '" + colorReference.ReferencedElement + "'.");
         return color;
     } else {
         return null;
     }
 }
Beispiel #6
0
 void WriteColorReference(XshdReference <XshdColor> color)
 {
     if (color.InlineElement != null)
     {
         WriteColorAttributes(color.InlineElement);
     }
     else if (color.ReferencedElement != null)
     {
         if (color.ReferencedDefinition != null)
         {
             writer.WriteAttributeString("color", color.ReferencedDefinition + "/" + color.ReferencedElement);
         }
         else
         {
             writer.WriteAttributeString("color", color.ReferencedElement);
         }
     }
 }