[antlr-interest] beta6, alternation produces non compiling code.
Clinton Roy
clinton.roy at gmail.com
Tue Feb 27 17:10:52 PST 2007
Hi guys,
I'm sure someone has come across this before, but I couldn't spot anything.
list.g:
------
grammar list;
list : elem (',' elem)* ;
elem : 'a'..'z'|'A'..'Z' ;
------
generates this for elem:
------
public void elem() throws RecognitionException {
try {
// list.g:3:6: ( ('a'..'z'|'A'..'Z'))
// list.g:3:8: ('a'..'z'|'A'..'Z')
{
if ( ) {
input.consume();
errorRecovery=false;
}
------
In debugging mode the empty if predicate is actually an
<empty-set-expr>. I can seemingly work around this problem with some
redundant bracketing around one of the alternatives.
I feel like I must be doing something silly :)
--
Clinton Roy
www.acqao.org - ARC Centre of Excellence for Quantum-Atom Optics
www.humbug.org.au - Brisbane Unix Group
azure.humbug.org.au/~croy/blog - Blog
www.flickr.com/photos/croy/ - Photos
More information about the antlr-interest
mailing list