public static void LoadStylesAndModes(Assembly assembly) { foreach (string resource in assembly.GetManifestResourceNames()) { if (resource.EndsWith("SyntaxMode.xml", StringComparison.Ordinal)) { using (Stream stream = assembly.GetManifestResourceStream(resource)) { string mimeTypes = Scan(stream, SyntaxMode.MimeTypesAttribute); ResourceStreamProvider provider = new ResourceStreamProvider(assembly, resource); foreach (string mimeType in mimeTypes.Split(';')) { syntaxModeLookup[mimeType] = provider; } } } else if (resource.EndsWith("Style.json", StringComparison.Ordinal)) { using (Stream stream = assembly.GetManifestResourceStream(resource)) { string styleName = ScanStyle(stream); styleLookup[styleName] = new ResourceStreamProvider(assembly, resource); } } } }
public DietTemplateSyntaxMode () { var matches = new List<Match>(); if (baseMode == null) { var provider = new ResourceStreamProvider( typeof(DietTemplateSyntaxMode).Assembly, typeof(DietTemplateSyntaxMode).Assembly.GetManifestResourceNames().First(s => s.Contains("DietTemplateSyntaxDefinition"))); using (var s = provider.Open()) baseMode = SyntaxMode.Read(s); } this.rules = new List<Rule>(baseMode.Rules); this.keywords = new List<Keywords>(baseMode.Keywords); this.spans = new List<Span>(baseMode.Spans.Where(span => span.Begin.Pattern != "#")).ToArray(); matches.AddRange(baseMode.Matches); this.prevMarker = baseMode.PrevMarker; this.SemanticRules = new List<SemanticRule>(baseMode.SemanticRules); SemanticRules.Add(InlineDHighlighting.Instance); this.keywordTable = baseMode.keywordTable; this.keywordTableIgnoreCase = baseMode.keywordTableIgnoreCase; this.properties = baseMode.Properties; // D Number literals matches.Add(DSyntaxMode.workaroundMatchCtor( "Number" , @" (?<!\w)(0((x|X)[0-9a-fA-F_]+|(b|B)[0-1_]+)|([0-9]+[_0-9]*)[L|U|u|f|i]*)")); this.matches = matches.ToArray(); }
public DSyntaxMode() { var matches = new List<Mono.TextEditor.Highlighting.Match>(); if (baseMode == null) { #if STABLE var provider = new ResourceXmlProvider(typeof(DSyntaxMode).Assembly, typeof(DSyntaxMode).Assembly.GetManifestResourceNames().First(s => s.Contains("MonoDevelop.D.DSyntaxHighlightingMode"))); using (XmlReader reader = provider.Open()) baseMode = SyntaxMode.Read(reader); #else var provider = new ResourceStreamProvider( typeof(DSyntaxMode).Assembly, typeof(DSyntaxMode).Assembly.GetManifestResourceNames().First(s => s.Contains("DSyntaxHighlightingMode"))); using (Stream s = provider.Open()) baseMode = SyntaxMode.Read(s); #endif } this.rules = new List<Rule>(baseMode.Rules); this.keywords = new List<Keywords>(baseMode.Keywords); this.spans = new List<Span>(baseMode.Spans.Where(span => span.Begin.Pattern != "#")).ToArray(); matches.AddRange(baseMode.Matches); this.prevMarker = baseMode.PrevMarker; this.SemanticRules = new List<SemanticRule>(baseMode.SemanticRules); this.keywordTable = baseMode.keywordTable; this.keywordTableIgnoreCase = baseMode.keywordTableIgnoreCase; this.properties = baseMode.Properties; // D Number literals matches.Add(workaroundMatchCtor( #if STABLE "constant.digit" #else "Number" #endif , @"(?<!\w)(0((x|X)[0-9a-fA-F_]+|(b|B)[0-1_]+)|([0-9]+[_0-9]*)[L|U|u|f|i]*)")); // extern linkages attributes //matches.Add(workaroundMatchCtor("constant.digit", "(?<=extern[\\s]*\\()[\\s]*(C(\\+\\+)?|D|Windows|System|Pascal|Java)[\\s]*(?=\\))")); // version checks //matches.Add(workaroundMatchCtor("constant.digit", @"(?<=version[\s]*\()[\s]*(DigitalMars|GNU|LDC|Windows|OSX|linux|FreeBSD|OpenBSD|BSD|Solaris|Posix|D_Version2)[\s]*(?=\))")); // type declaration names //matches.Add(workaroundMatchCtor("keyword.semantic.type", @"(?<=(class|struct|union|interface|template)[\s]+)[\w]+")); this.matches = matches.ToArray(); }
public GherkinSyntaxMode() { ResourceStreamProvider provider = new ResourceStreamProvider (typeof (GherkinSyntaxMode).Assembly, "GherkinSyntaxHighlightingMode.xml"); using (var reader = provider.Open ()) { SyntaxMode baseMode = SyntaxMode.Read (reader); this.rules = new List<Rule> (baseMode.Rules); this.keywords = new List<Keywords> (baseMode.Keywords); this.spans = baseMode.Spans; this.matches = baseMode.Matches; this.prevMarker = baseMode.PrevMarker; this.SemanticRules = new List<SemanticRule> (baseMode.SemanticRules); this.keywordTable = baseMode.keywordTable; this.keywordTableIgnoreCase = baseMode.keywordTableIgnoreCase; } }
public JaySyntaxMode (TextDocument doc) : base (doc) { ResourceStreamProvider provider = new ResourceStreamProvider (typeof(IStreamProvider).Assembly, typeof(IStreamProvider).Assembly.GetManifestResourceNames ().First (s => s.Contains ("JaySyntaxMode"))); using (var stream = provider.Open ()) { SyntaxMode baseMode = SyntaxMode.Read (stream); this.rules = new List<Rule> (baseMode.Rules); this.keywords = new List<Keywords> (baseMode.Keywords); this.spans = new List<Span> (baseMode.Spans).ToArray (); this.matches = baseMode.Matches; this.prevMarker = baseMode.PrevMarker; this.SemanticRules = new List<SemanticRule> (baseMode.SemanticRules); this.keywordTable = baseMode.keywordTable; this.keywordTableIgnoreCase = baseMode.keywordTableIgnoreCase; this.properties = baseMode.Properties; } }
void Init() { var provider = new ResourceStreamProvider (typeof (CoffeeScriptSyntaxMode).Assembly, "MonoDevelop.CoffeeScript.CoffeeScriptSyntaxMode.xml"); using (var reader = provider.Open ()) { var baseMode = SyntaxMode.Read (reader); this.rules = new System.Collections.Generic.List<Rule> (baseMode.Rules); this.keywords = new System.Collections.Generic.List<Mono.TextEditor.Highlighting.Keywords> (baseMode.Keywords); this.spans = baseMode.Spans; this.matches = baseMode.Matches; this.prevMarker = baseMode.PrevMarker; this.SemanticRules = new System.Collections.Generic.List<Mono.TextEditor.SemanticRule>(baseMode.SemanticRules); this.keywordTable = baseMode.keywordTable; this.properties = baseMode.Properties; } }
public JaySyntaxMode(TextDocument doc) : base(doc) { ResourceStreamProvider provider = new ResourceStreamProvider(typeof(IStreamProvider).Assembly, typeof(IStreamProvider).Assembly.GetManifestResourceNames().First(s => s.Contains("JaySyntaxMode"))); using (var stream = provider.Open()) { SyntaxMode baseMode = SyntaxMode.Read(stream); this.rules = new List <Rule> (baseMode.Rules); this.keywords = new List <Keywords> (baseMode.Keywords); this.spans = new List <Span> (baseMode.Spans).ToArray(); this.matches = baseMode.Matches; this.prevMarker = baseMode.PrevMarker; this.SemanticRules = new List <SemanticRule> (baseMode.SemanticRules); this.keywordTable = baseMode.keywordTable; this.keywordTableIgnoreCase = baseMode.keywordTableIgnoreCase; this.properties = baseMode.Properties; } }
public RazorSyntaxMode (Document doc) { this.guiDocument = doc; guiDocument.DocumentParsed += HandleDocumentParsed; ResourceStreamProvider provider = new ResourceStreamProvider (typeof (ResourceStreamProvider).Assembly, "RazorSyntaxMode.xml"); using (var reader = provider.Open ()) { SyntaxMode baseMode = SyntaxMode.Read (reader); this.rules = new List<Rule> (baseMode.Rules); this.keywords = new List<Keywords> (baseMode.Keywords); this.spans = baseMode.Spans; this.matches = baseMode.Matches; this.prevMarker = baseMode.PrevMarker; this.SemanticRules = new List<SemanticRule> (baseMode.SemanticRules); this.keywordTable = baseMode.keywordTable; this.keywordTableIgnoreCase = baseMode.keywordTableIgnoreCase; } }
public IodineSyntaxMode() { this.DocumentSet += delegate { if (this.Document == null) return; this.Document.FileNameChanged += delegate { var provider = new ResourceStreamProvider (typeof(IodineSyntaxMode).Assembly, GetSyntaxMode ()); var reader = provider.Open (); var basemode = SyntaxMode.Read (reader); this.rules = new List<Rule> (basemode.Rules); this.keywords = new List<Keywords> (basemode.Keywords); this.spans = basemode.Spans; this.matches = basemode.Matches; this.prevMarker = basemode.PrevMarker; this.SemanticRules = basemode.SemanticRules; this.keywordTable = basemode.keywordTable; this.properties = basemode.Properties; }; }; }
public static void LoadStylesAndModes (Assembly assembly) { foreach (string resource in assembly.GetManifestResourceNames ()) { if (resource.EndsWith ("SyntaxMode.xml", StringComparison.Ordinal)) { using (Stream stream = assembly.GetManifestResourceStream (resource)) { string mimeTypes = Scan (stream, SyntaxMode.MimeTypesAttribute); ResourceStreamProvider provider = new ResourceStreamProvider (assembly, resource); foreach (string mimeType in mimeTypes.Split (';')) { syntaxModeLookup [mimeType] = provider; } } } else if (resource.EndsWith ("Style.json", StringComparison.Ordinal)) { using (Stream stream = assembly.GetManifestResourceStream (resource)) { string styleName = ScanStyle (stream); styleLookup [styleName] = new ResourceStreamProvider (assembly, resource); } } } }