[antlr-interest] REAL or int or Range

Gavin Lambert antlr at mirality.co.nz
Tue Jan 22 10:49:11 PST 2008


At 05:50 23/01/2008, Jim Idle wrote:
 >
 >fragment DOT : '.' ;
 >
 >range
 >: '.'
 >    (     ('.')=>'.'         // It is indeed two dots
 >       |  { $type = DOT; }   // Just a dot
 >    )
 >;

Except the "range" rule needs to be a lexer rule as well.  So 
"RANGE" instead.  And if you're defining DOT like that anyway, you 
might as well write it like this:

fragment DOT : '.';

RANGE
   : DOT
     ( (DOT) => DOT
     | {$type = DOT; }
     )
   ;



More information about the antlr-interest mailing list