Posted 15 years ago
by Civa
Hi all,
I downloaded WPF Syntax editor a couple of days ago and started with MGrammarIntegration sample solution.I tried to make custom grammar for my language and I added new .mg file in solution and followed existing code for loading that file but I always get DynamicParser instance from assembly System.DataFlow.dll null.(Note that .mg file is compiled and turned to RBL.mx)
I dont know what is going on everything seems similar to SimpleLanguage example.
Here is snippet :Can anyone please describe me if there is some error or something I really dont get it.
Thanks in advance.
Civa
I downloaded WPF Syntax editor a couple of days ago and started with MGrammarIntegration sample solution.I tried to make custom grammar for my language and I added new .mg file in solution and followed existing code for loading that file but I always get DynamicParser instance from assembly System.DataFlow.dll null.(Note that .mg file is compiled and turned to RBL.mx)
I dont know what is going on everything seems similar to SimpleLanguage example.
Here is snippet :
using (Stream stream = this.GetType().Assembly.GetManifestResourceStream("NewLang.RBL.mx"))
{
//Here I get parser == null I checked couple of times and in Intellipad
//when I define that language name is correct - rally annoying
DynamicParser parser = DynamicParser.LoadFromStream(stream, "Langauges.RBL");
IHighlightingStyleRegistry registry = AmbientHighlightingStyleRegistry.Instance;
registry.Register(ClassificationTypes.Comment, new HighlightingStyle("Comment", Brushes.Green));
registry.Register(new ClassificationType("Delimiter"), new HighlightingStyle("Delimiter", Brushes.SlateBlue));
registry.Register(ClassificationTypes.Identifier, new HighlightingStyle("Identifier", null));
registry.Register(ClassificationTypes.Keyword, new HighlightingStyle("Keyword", Brushes.Blue));
registry.Register(new ClassificationType("Number"), new HighlightingStyle("Number", Brushes.Purple));
SyntaxLanguage language = new SyntaxLanguage("RBL");
language.LexicalParser = new DataflowLexicalParser(parser);
language.ClassifierFactory = new DataflowClassifierFactory(parser, registry);
this.syntaxEditor.Document.Language = language;
}
Thanks in advance.
Civa