[antlr-interest] REAL or int or Range

Gavin Lambert antlr at mirality.co.nz
Wed Jan 9 15:40:42 PST 2008


At 05:55 10/01/2008, Alexander Gängel wrote:

>I have a Problem in My grammar
>
>I try to decide if I got in Integer an Real or an Range like 0..9
>
>It works for Int and Real but if I input 0..9 in 
>Antlrworks in the Input frame is only 9
[...]
>start    :
>     uint_or_real
>     |(uint_or_real RANGE uint_or_real)+;

Try changing this to:

start : statement EOF;

statement
   :  uint_or_real
   |  (uint_or_real RANGE uint_or_real)+
   ;

(That's a really odd grammar, by the way.  Why do 
you support multiple ranges but not multiple numbers?)
    



More information about the antlr-interest mailing list