[antlr-interest] Tree grammars & optional AST nodes
Nicolas Rouquette
nicolas.rouquette at jpl.nasa.gov
Sat Oct 21 14:10:26 PDT 2006
Terence Parr <parrt at ...> writes:
> On Oct 20, 2006, at 11:24 PM, Nicolas Rouquette wrote:
>
> > Terence Parr <parrt <at> ...> writes:
> >
> > expression
> > : e1=conditionalExpression (op=assignmentOperator e2=expression)?
> > -> {$op!=null} ? ^($op $e1 $e2)
> > -> $e1
> > ;
>
> Oh. It wants $op.tree or something. Which which is the problem? ^
> ($op i guess. Try {$op.tree} for now.
Since 'op' is inside an optional block, $op can be NULL
and $op.tree can produce a NullPointerException.
At most, it could be {$op!=null} but 3.0b4 doesn't like it.
-- Nicolas.
> Ter
>
>
More information about the antlr-interest
mailing list