Loading grammar from MGrammar problem

SyntaxEditor for WPF Forum

Posted 15 years ago by Civa
Avatar
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 :

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;
            }
Can anyone please describe me if there is some error or something I really dont get it.

Thanks in advance.

Civa

Comments (1)

Posted 15 years ago by Civa
Avatar
I think I solved my problem.Suddenly somehow it happened to work I dont know if I made some spell error when specified compiler name but it works now.

Regards,

Civa
The latest build of this product (v24.1.2) was released 10 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.