Example #1
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // OBJECT
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes an instance of the <c>MainControl</c> class.
        /// </summary>
        public MainControl()
        {
            InitializeComponent();

            // Load the EBNF language
            ebnfEditor.Document.Language = SyntaxEditorHelper.LoadLanguageDefinitionFromResourceStream("Ebnf.langdef");

            // Show the EBNF
            ILLParser parser = editor.Document.Language.GetParser() as ILLParser;

            if (parser != null)
            {
                ebnfEditor.Document.SetText(parser.Grammar.ToEbnfString());
            }
        }
Example #2
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // OBJECT
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <c>ParentParser</c> class.
        /// </summary>
        /// <param name="childLanguage">The child language.</param>
        public ParentParser(ISyntaxLanguage childLanguage) : base("Parent")
        {
            if (childLanguage == null)
            {
                throw new ArgumentNullException("childLanguage");
            }

            // Initialize and pull out the parser (so it doesn't automatically get called)
            this.childLanguage = childLanguage;
            this.childParser   = childLanguage.GetParser() as ILLParser;
            if (this.childParser == null)
            {
                throw new ArgumentException("No ILLParser service was found.", "childLanguage");
            }

            childLanguage.UnregisterParser();
        }