[antlr-interest] Problem with lexer rule for an optional suffix

Scott Oakes scott.oakes62 at googlemail.com
Sat Nov 14 06:14:58 PST 2009


On Sat, Nov 14, 2009 at 12:11 PM, Gavin Lambert <antlr at mirality.co.nz> wrote:
> There are quite a few options for resolving this, depending on what
> constructs are legal in your language.  One way is to use a syntactic
> predicate:
>
>  ID : (LETTER | ('.' LETTER) => '.')+ ('.' DIGIT+)?
>     | DIGIT+
>     ;

That makes sense, although I'm having a bit of trouble getting it to
work when I use this rule -- I still get two tokens from "foo.bar.32".


More information about the antlr-interest mailing list