GrammarExplorer Crash

Mar 8, 2010 at 10:59 AM

Hello,
When switching to the Parser Trace pane after parsing a test file, the marked line throws a NullReferenceException (ParseTreeNode.cs):

    public override string ToString() {
      /* >>> */ return Term.Grammar.GetParseNodeCaption(this); // Term is null
    }//method

This used to work in previous releases; anything obvious I'm missing?

Thanks in advance,

Rob

Coordinator
Mar 8, 2010 at 2:31 PM

Ooopss... I thought I fixed that... 

Please replace the code in ToString with the following:

 

    public override string ToString() {
      if (Term == null) 
        return "(S0)"; //initial state node
      else 
        return Term.GetParseNodeCaption(this); 
    }//method
    public override string ToString() {
      if (Term == null) 
        return "(S0)"; //initial state node
      else 
        return Term.GetParseNodeCaption(this); 
    }//method
Also replace BnfTerm.GetParseTreeNodeCaption:
    public virtual string GetParseNodeCaption(ParseTreeNode node) {
      if (GrammarData != null)
        return GrammarData.Grammar.GetParseNodeCaption(node);
      else 
        return Name; 
    }
Sorry for the trouble, will patch it asap

 

Mar 8, 2010 at 8:53 PM

Fix is working, thank you!