This project has moved and is read-only. For the latest updates, please go here.

NullReferenceException due to errror in AstBuilder


The first couple of lines of BuildAst in AstBuilder check the term flags and also a safety check to see if an AST node is set on the term
 public virtual void BuildAst(ParseTreeNode parseNode) {
      var term = parseNode.Term;
      if (term.Flags.IsSet(TermFlags.NoAstNode) || parseNode.AstNode != null) return; 
... but it looks like it checks for != null meaning you get further down the line to the default node creator and get a NullReferenceException (this is only when trying to run an invalid grammar specification) - not a deal breaker but obviously a bug somewhere.

Changing to
if (term.Flags.IsSet(TermFlags.NoAstNode) || parseNode.AstNode == null) return; 
Fixes it temporarily but disables implicit defaults on the ast config. I think the lack of defaults/ast config is the problem

It sounds like somewhere down the line there needs to be the right check to ensure that if no default ast setup is provided the correct messages are displayed and no nullref is thrown

Had me scratching my head until I got hold of the source - I think it would help if this was fixed so that the errors are meaningful