[antlr-interest] ANTLR 3.0 "feature"
Gavin Lambert
antlr at mirality.co.nz
Sat Feb 10 13:01:01 PST 2007
At 09:38 11/02/2007, Gilbert Williams wrote:
>ere_dupl_symbol : '*'{prn("ere_dupl_symbol found:"+$text);}
> | '+'{prn("ere_dupl_symbol found:"+$text);}
> | '?'{prn("ere_dupl_symbol found:"+$text);}
> | '{' dup_count ',' dup_count
> '}'{prn("ere_dupl_symbol found:"+$text);}
> | '{' dup_count
> ',' '}'{prn("ere_dupl_symbol found:"+$text);}
> | '{'
> dup_count '}'{prn("ere_dupl_symbol found:"+$text);}
If you're going to be doing similar actions for those last three
alts, then I would write it as a single alt like so:
| '{' dup_count (',' dup_count?)? '}' { prn(...); }
Doesn't really make a lot of difference, though. I think :)
More information about the antlr-interest
mailing list