
The comments for Getting Started03c state " It doesn't matter whether a dynamic or programmatic lexer is used though. Either will work fine with all of the subsequent steps where we add advanced parsers and functionality."
I'm attempting to reproduce the Getting Started04b exercise based on the langdef Lexer as in Getting Started03a instead of the programmatic Lexer as in Getting Stared03b.
In the Actipro SampleApplication I've modified the Getting Started03a project to add the new code from Getting Started 04a. In particular please see the GetParser line in the code block.
I've updated the 03a MainControl.xaml to include a second SyntaxEditor control, named EbnfEditor, to receive the EBNF text or the text "parser is null".
The call to GetParser is returning null. What am I missing?
I've changed the Getting Started 03a MainControl.xaml.cs to add a GetParser call:
namespace ActiproSoftware.ProductSamples.SyntaxEditorSamples.QuickStart.GettingStarted03a {
/// <summary>
/// Provides the main user control for this sample.
/// </summary>
public partial class MainControl : System.Windows.Controls.UserControl {
/////////////////////////////////////////////////////////////////////////////////////////////////////
// OBJECT
/////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Initializes an instance of the <c>MainControl</c> class.
/// </summary>
public MainControl() {
InitializeComponent();
// Load the most basic version of the Simple language
editor.Document.Language = SyntaxEditorHelper.LoadLanguageDefinitionFromResourceStream("Simple-Advanced.langdef");
// Load the EBNF language
EbnfEditor.Document.Language = SyntaxEditorHelper.LoadLanguageDefinitionFromResourceStream("Ebnf.langdef");
// Show the EBNF
ILLParser parser = editor.Document.Language.GetParser() as ILLParser; // Returns null.
if (parser != null)
{
EbnfEditor.Document.SetText(parser.Grammar.ToEbnfString());
}
else
{
EbnfEditor.Document.SetText("parser is null.");
}
}
}
}
I appreciate what hints you can provide.
Thanks,
Pete
[Modified 11 years ago]