[antlr-interest] bug or strange behaviour in rewrite operator ?

Terence Parr parrt at cs.usfca.edu
Sat Jun 9 13:21:00 PDT 2007


ooops. looks like a bug. added

http://www.antlr.org:8888/browse/ANTLR-135

Ter
On Jun 9, 2007, at 6:07 AM, Alessandro wrote:

> Hello,
>
> When I use $rule? the code generated seems to be not correct.
> Here is a example :
>
> prog:
> 	(func | (decvar SEMI) -> $prog? func? decvar? )*
> 	-> ^(PROG_DEC $prog)
> ;
>
> The code generated for ($prog)? is :
>
> // ( $prog)?
> if ( stream_prog.hasNext() ) {
>   adaptor.addChild(root_0, stream_retval.next());
> }
> stream_prog.reset();
>
> the variable stream_prog does not exist, the correct variable is
> "stream_retval".
> Is it a bug ?
>
> Thanks,
>
> Alessandro



More information about the antlr-interest mailing list