[antlr-interest] Shorthand notation for separated lists

Gavin Lambert antlr at mirality.co.nz
Thu Jan 26 12:51:12 PST 2012


At 04:47 27/01/2012, Jan Finis wrote:
 >(id ** ",") is automatically expanded to [ id ("," id)* ] and
 >(id ++ ",") is automatically expaned to id ("," id)*

Actually, it would make more sense if (id ** COMMA) expanded to 
(id (COMMA id)*) and (id ++ COMMA) expanded to (id (COMMA 
id)+).  You can already make the whole expression optional simply 
by putting a ? on the end.

(And I don't know why you were using square brackets.  They don't 
mean what you seem to think they do.)



More information about the antlr-interest mailing list