[antlr-interest] REAL or int or Range

Gavin Lambert antlr at mirality.co.nz
Wed Jan 9 17:26:28 PST 2008


At 13:17 10/01/2008, Alexander Gängel wrote:

>It's still not working for me

Hmmm.  It might be a prefixing problem (the two 
alts have the same prefix, so it's not sure which one to use).

The best solution would be to alter your source 
language; for example, this should work to 
distinguish a single number vs. range:

number_or_range : uint_or_real (RANGE uint_or_real)? ;

And then you could use this:

start : number_or_range+ EOF;

This will accept any mixture of numbers and 
ranges; eg "42" is valid, as is "42.1..50 72 
12..18.7".  This is different from what you originally had.



More information about the antlr-interest mailing list