[antlr-interest] Could antlr understand (group)3
Vidar Håkestad
vidar at hawkis.com
Sat Sep 17 04:03:37 PDT 2005
Is it possible for antlr to understand a digit as a group operator in addition
to *, ? and +? This would help in situations where a specific number of
elements are known.
For example in CSS, a color value may be specified with either three or six
hex numbers. It would be shorter to write
HEX
: '0'..'9' | 'a'..'f' | 'A'..'F'
;
COLOR
: '#' ((HEX)3 | (HEX)6)
;
instead of
COLOR
: '#' ((HEX HEX HEX) | (HEX HEX HEX HEX HEX HEX))
;
Vidar
More information about the antlr-interest
mailing list