IHighlightingStrategy LoadDefinition(DictionaryEntry entry) { SyntaxMode syntaxMode = (SyntaxMode)entry.Key; ISyntaxModeFileProvider syntaxModeFileProvider = (ISyntaxModeFileProvider)entry.Value; DefaultHighlightingStrategy highlightingStrategy = null; try { //johnny //var reader = syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode); System.Xml.XmlTextReader reader = syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode); if (reader == null) { throw new HighlightingDefinitionInvalidException("Could not get syntax mode file for " + syntaxMode.Name); } highlightingStrategy = HighlightingDefinitionParser.Parse(syntaxMode, reader); if (highlightingStrategy.Name != syntaxMode.Name) { throw new HighlightingDefinitionInvalidException("The name specified in the .xshd '" + highlightingStrategy.Name + "' must be equal the syntax mode name '" + syntaxMode.Name + "'"); } } finally { if (highlightingStrategy == null) { highlightingStrategy = DefaultHighlighting; } highlightingDefs[syntaxMode.Name] = highlightingStrategy; highlightingStrategy.ResolveReferences(); } return(highlightingStrategy); }
IHighlightingStrategy LoadDefinition(Tuple <SyntaxMode, ISyntaxModeFileProvider> entry) { SyntaxMode syntaxMode = entry.Item1; ISyntaxModeFileProvider syntaxModeFileProvider = entry.Item2; DefaultHighlightingStrategy highlightingStrategy = null; try { var reader = syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode); if (reader == null) { throw new HighlightingDefinitionInvalidException("Could not get syntax mode file for " + syntaxMode.Name); } highlightingStrategy = HighlightingDefinitionParser.Parse(syntaxMode, reader); if (highlightingStrategy.Name != syntaxMode.Name) { throw new HighlightingDefinitionInvalidException("The name specified in the .xshd '" + highlightingStrategy.Name + "' must be equal the syntax mode name '" + syntaxMode.Name + "'"); } } finally { if (highlightingStrategy == null) { highlightingStrategy = DefaultHighlighting; } HighlightingDefinitions[syntaxMode.Name] = highlightingStrategy; highlightingStrategy.ResolveReferences(); } return(highlightingStrategy); }
private IHighlightingStrategy LoadDefinition(DictionaryEntry entry) { SyntaxMode key = (SyntaxMode)entry.Key; ISyntaxModeFileProvider value = (ISyntaxModeFileProvider)entry.Value; DefaultHighlightingStrategy defaultHighlighting = null; try { XmlTextReader syntaxModeFile = value.GetSyntaxModeFile(key); if (syntaxModeFile == null) { throw new HighlightingDefinitionInvalidException(string.Concat("Could not get syntax mode file for ", key.Name)); } defaultHighlighting = HighlightingDefinitionParser.Parse(key, syntaxModeFile); if (defaultHighlighting.Name != key.Name) { string[] name = new string[] { "The name specified in the .xshd '", defaultHighlighting.Name, "' must be equal the syntax mode name '", key.Name, "'" }; throw new HighlightingDefinitionInvalidException(string.Concat(name)); } } finally { if (defaultHighlighting == null) { defaultHighlighting = this.DefaultHighlighting; } this.highlightingDefs[key.Name] = defaultHighlighting; defaultHighlighting.ResolveReferences(); } return(defaultHighlighting); }
IHighlightingStrategy LoadDefinition(DictionaryEntry entry) { SyntaxMode syntaxMode = (SyntaxMode)entry.Key; ISyntaxModeFileProvider syntaxModeFileProvider = (ISyntaxModeFileProvider)entry.Value; DefaultHighlightingStrategy highlightingStrategy = HighlightingDefinitionParser.Parse(syntaxMode, syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode)); highlightingDefs[syntaxMode.Name] = highlightingStrategy; highlightingStrategy.ResolveReferences(); return(highlightingStrategy); }