![Avatar](https://secure.gravatar.com/avatar/72985f2370db2ed38f236d47d9d626bb.jpg?s=64&d=identicon&r=g)
For following EBNF:
box = (apple | orange)?
I generate three classes in Language Designer:
class Box : AstNodeBase
{
public IList<AbstractFBlock> Apples { ... }
public IList<AbstractFBlock> Oranges { ... }
}
class Apple : AstNodeBase
{
}
class Orange : AstNodeBase
{
}
How to define production for Box?I'm not sure that is a correct way...
box = (apple | orange)?
I generate three classes in Language Designer:
class Box : AstNodeBase
{
public IList<AbstractFBlock> Apples { ... }
public IList<AbstractFBlock> Oranges { ... }
}
class Apple : AstNodeBase
{
}
class Orange : AstNodeBase
{
}
How to define production for Box?
boxDefinition.Production =
(appleDefenition["apple"] > Ast<Apple>()).OnErrorContinue().SetLabel("apples")
|(orangeDefenition["orange"] > Ast<Orange>()).OnErrorContinue().SetLabel("oranges"))
> Ast<Box>()
.AddToCollectionProperty(s => s.Apples, AstChildrenFrom("apples"))
.AddToCollectionProperty(s => s.Oranges, AstChildrenFrom("apples"));