[antlr-interest] RE Lexer rule for number range matching ?
antlr at mirality.co.nz
Thu Apr 24 19:58:01 PDT 2008
At 05:52 25/04/2008, Nagesh, Harsha wrote:
>I tried these suggestions, but I am getting the following
>in ANTLRWorks when I include this rule
>"The following token definitions are unreachable:.."
You've probably got another lexer rule that matches sequences of
digits. Remember, the lexer is contextless, so if you have other
possibilities for digit groups you can't do the range-checking in
the lexer. You need to make a general-purpose NUMBER rule in the
lexer and do your range checking in the parser instead.
More information about the antlr-interest