[antlr-interest] Collecting Values in Lists

Michael Bedward michael.bedward at gmail.com
Wed Apr 8 21:07:17 PDT 2009


Hi Behdad

You can do this...

x:  foo+=y (',' foo+=y)* ;

The += notation tells ANTLR to create a List which, in the example
above, would be called list_foo.

ANTLR doesn't do generics though, so list_foo will be a List<Object>
and you will need to cast the elements to the appropriate type.

Hope this helps
Michael


More information about the antlr-interest mailing list