[antlr-interest] ANTLR syntax bug with array return types

Olivier Lefevre lefevrol at yahoo.com
Tue Feb 26 17:15:23 PST 2008


Consider this tree grammar rule with Java output:

    foo returns [List[] lists] <blah blah>

The Java code emitted by ANTLR will have:

     // $ANTLR start foo
     // Bug3.g:7:1: foo returns [List lists] : ;
     public final List foo() throws RecognitionException {
         List lists = null;
         <blah blah>
	return lists;
     }

which is just wrong: the array-ness of lists (i.e., the [])
was thrown away. Is this is a deliberate limitation, where
is it documented?

Thanks,

-- O.L.



More information about the antlr-interest mailing list