[antlr-interest] How does INTEGER+ '.' INTEGER+ match "2."?
Gerald Rosenberg
gerald at certiv.net
Sun Aug 8 16:28:24 PDT 2010
------ Original Message (Sunday, August 08, 2010 6:42:55 PM) From: Ken
Klose ------
Subject: [antlr-interest] How does INTEGER+ '.' INTEGER+ match "2."?
> INTEGER: DIGIT+;
> PRICE: INTEGER '.' INTEGER;
Integer and price are ambiguous and, if "2." is a valid price, need to
make the decimal field optional.
Try:
INTEGER : DIGIT+
( '.' (DIGIT+)? { $type=PRICE; } // define
PRICE in the token block
| // just an integer
)
;
More information about the antlr-interest
mailing list