[antlr-interest] automatic token type per literal
Matt Benson
gudnabrsam at yahoo.com
Thu Dec 1 09:11:23 PST 2005
Let's say I have a grammar having stolen the Java
IDENT lexer rule. In my parser, I have the following:
tokens { FOO; }
somerule
: f:"foo"^ { #f.setType(FOO); } BAR
;
Have I missed a feature by means of which I can (once)
permanently set the association between ttype FOO and
the literal "foo"? If not, is there a rationale for
the absence of such a feature? If the answer to THAT
is no, might such a feature find its way into ANTLR3?
;) I tried overriding the ttype in the IDENT lexer
rule but the ambiguity issues were (at my level of
expertise) insurmountable. :) I'm a longtime lurker
but still fairly green wrt actually making ANTLR do
anything...
TIA,
Matt
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
More information about the antlr-interest
mailing list