[antlr-interest] ambiguous lexer rules
Kay Roepke
kroepke at classdump.org
Thu Jul 19 08:51:27 PDT 2007
On Jul 19, 2007, at 3:12 AM, Christoph Beckmeyer wrote:
> I have a problem with the overlapping rules ID and INT. I tried
> to solve it in multiple ways but none of them resulted in success.
> Can somebody give me a hint how to handle this.
What are you trying to solve?
> grammar Test;
> ID : '10';
> INT : DIGIT+;
> fragment DIGIT : '0'..'9';
> SEP_L1 : ';';
> SEP_L2 : ',';
> field : ID SEP_L2 INT SEP_L1;
This grammar results in the following parse tree to me:
Input : 10,984;
Parse tree:
(field ID SEP_L2 INT SEP_L1)
Isn't that what you wanted?
cheers,
-k
--
Kay Röpke
http://classdump.org/
More information about the antlr-interest
mailing list