[antlr-interest] Problem with lexical nondeterminism - ANTLR 2.7.7
Gavin Lambert
antlr at mirality.co.nz
Thu Jan 3 13:26:38 PST 2008
At 10:02 4/01/2008, clive.i.hill at jpmorgan.com wrote:
>If I try your suggestions with APAC_NUMERIC_TICKER above NUMER I
>still get the same issue. Harold your suggestion would work if
>it matches NUMBER first but it was actually an
>APAC_NUMERIC_TICKER. The match actually happens the other way
>around.
Ok, what's probably happening here is that ANTLR is discarding the
predicate because there's only one alt. I thought it was only
ANTLR 3 that did that, but I guess v2 did as well. In that case
you'll need to combine the rules:
NUMBER
: (INT COMMA) => APAC_NUMERIC_TICKER
{$setType(APAC_NUMERIC_TICKER);}
| (INT COLON) => RANGE {$setType(RANGE);}
| (DOT) => FLOAT {$setType(FLOAT);}
| (INT DOT) => FLOAT {$setType(FLOAT);}
| INT {$setType(INT);}
;
protected
APAC_NUMERIC_TICKER
: INT COMMA CHAR CHAR
;
More information about the antlr-interest
mailing list