[antlr-interest] QUESTION on: How do I handle abbreviated keywords?
Gavin Lambert
antlr at mirality.co.nz
Sat Nov 1 03:03:32 PDT 2008
At 20:06 1/11/2008, Ben Gillis wrote:
>Can you tell me more about how you go about it? This is exactly
>what I'm looking into, i.e. what is the best way to define my
>keywords.
I normally just define them directly, ie:
BEGIN: 'begin';
(I used to define them in the tokens section:
tokens {
BEGIN = 'begin';
}
except that in recent versions of ANTLR this sometimes gives odd
warning messages.)
It helps to write lots of unit tests, though. Sometimes
interactions between lexer rules (and ANTLR's minimal lookahead)
can lead to odd results.
More information about the antlr-interest
mailing list