This project has moved. For the latest updates, please go here.

Bug in Colorizing solved

Oct 14, 2012 at 5:16 PM
Edited Oct 14, 2012 at 5:19 PM

Hi Roman,

Making the change below resolved a runtime exception that occurred regularly while building incremental enhancements to a grammar:

// in AstNode.cs:

    protected AstNode AddChild(NodeUseType useType, string role, ParseTreeNode childParseNode) {
      var child = (AstNode)childParseNode.AstNode;

// old code:
//      if (child == null)
//        child = new NullNode(childParseNode.Term); //put a stub to throw an exception with clear message on attempt to evaluate. 
// new code:
      if (child == null) {//put a stub to throw an exception with clear message on attempt to evaluate. 
        child = new NullNode(); 
// [edit] End of change
child.Role = role; child.Parent = this; ChildNodes.Add(child); return child; }

The error was occurring a couple of different ways, but most often when Span was null attempting to locate the source Terminal. I believe this change also makes the constructor NullNode(BnfTerm term) redundant.

Oct 16, 2012 at 6:17 PM

thanks, will look into this


Apr 5, 2013 at 9:48 AM
I was trying this out because I am having the same issue in the grammar explorer, but I get:

Error 3 'Irony.Interpreter.Ast.NullNode' does not contain a constructor that takes 0 arguments

When calling

child = new NullNode();

any help? I'm new to Irony, so this can be obvious.
Apr 5, 2013 at 5:46 PM
NullNode is supposed to be singleton, global single instance