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

Alessandro alessnet at gmail.com
Sat Jun 9 06:07:58 PDT 2007


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