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

Default AST NodeType

Sep 6, 2010 at 10:47 AM


I'm wondering if there is a way to set a default Ast Node type if one has not been provided?

For example, if the rule is

MyNonTerminal.Rule = (Empty | SomeNonTerminal) + "hello";

And the NonTerminal has a NodeType of ExpressionListNode...there will be no Ast nodes created for (Empty | SomeNonTerminal), and the grammar errors will reflect this.  What makes the most sense is for you to be able to set ExpressionListNode as the default (instead of NullNode), and then everything will work as expected.

Is this somewhere and I've missed it?

And awesome job on the project, by the way!


Sep 7, 2010 at 5:34 PM

There's a property Grammar.DefaultNodeType, and also DefaultLiteralNodeType (defaulted to LiteralValueNode) - just for these. If you assign DefaultNodeType that should work as you want