[antlr-interest] Tokens
Steve Bennett
stevagewp at gmail.com
Thu Nov 26 23:38:33 PST 2009
> APPLE
> : 'Apple'
> ;
>
> PEAR
> : 'Pear'
> ;
>
> ORANGE
> : 'Orange'
> ;
>
> ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
> ;
Kevin's answer is probably the right one, but what I have done sometimes is:
ID: ('a'..'z'|'A'..'Z'|'_'|APPLE|PEAR|ORANGE)
('a'..'z'|'A'..'Z'|'0'..'9'|'_'|APPLE|PEAR|ORANGE)*
If I'm not misremembering how lexing works...it's been a little while.
Steve
More information about the antlr-interest
mailing list