public XmlHighlightingDefinition(XshdSyntaxDefinition xshd, IHighlightingDefinitionReferenceResolver resolver) { this.Name = xshd.Name; xshd.AcceptElements(new RegisterNamedElementsVisitor(this)); TranslateElementVisitor translateVisitor = new TranslateElementVisitor(this, resolver); foreach (XshdElement element in xshd.Elements) { HighlightingRuleSet rs = element.AcceptVisitor(translateVisitor) as HighlightingRuleSet; XshdRuleSet xrs = element as XshdRuleSet; if (rs != null && xrs != null && xrs.Name == null) { if (MainRuleSet != null) { throw Error(element, "Duplicate main RuleSet. There must be only one nameless RuleSet!"); } else { MainRuleSet = rs; } } } if (MainRuleSet == null) { throw new HighlightingDefinitionInvalidException("Could not find main RuleSet."); } }
public XmlHighlightingDefinition(XshdSyntaxDefinition xshd, IHighlightingDefinitionReferenceResolver resolver) { this.Name = xshd.Name; xshd.AcceptElements(new RegisterNamedElementsVisitor(this)); TranslateElementVisitor translateVisitor = new TranslateElementVisitor(this, resolver); foreach (XshdElement element in xshd.Elements) { HighlightingRuleSet rs = element.AcceptVisitor(translateVisitor) as HighlightingRuleSet; XshdRuleSet xrs = element as XshdRuleSet; if (rs != null && xrs != null && xrs.Name == null) { if (MainRuleSet != null) throw Error(element, "Duplicate main RuleSet. There must be only one nameless RuleSet!"); else MainRuleSet = rs; } } if (MainRuleSet == null) throw new HighlightingDefinitionInvalidException("Could not find main RuleSet."); }