[antlr-interest] missing MATCHRANGE macro

Jim Idle jimi at temporal-wave.com
Mon Nov 7 09:32:05 PST 2011


Better to do this:

fragment FLOAT;
INT : '0'..'9'+ ( '.' '0'..'9'+ { $type = FLOAT; } | ) ;

Cheers,

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of yushang
> Sent: Monday, November 07, 2011 2:17 AM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] missing MATCHRANGE macro
>
> Hi,
> I think I've found the reason . I've written a rule as follow
> numeric_literal
>     :    '0'..'9' ('0'..'9')*
>     |    ('0'..'9')* '.' '0'..'9' ('0'..'9')*
>     ;
> which will be translated to MATCHRANGE in Parser , if I change it to
> this :
> numeric_literal
>     :    INT
>     |    FLOAT
>     ;
> INT
>     :    '0'..'9' ('0'..'9')*
>     ;
> FLOAT
>     :    ('0'..'9')* '.' '0'..'9' ('0'..'9')*
>     ;
> will OK. Many thanks.
>
> 2011/11/5 yushang <yusunn at gmail.com>
>
> > Hi , I'm using ANTLR v3 C runtime and found this macro is missing
> from
> > the generated *Parser.c and *Parser.h . This macro can be found in
> > *Lexer.c file . Is this a bug ?
> > thanks in advance .
> >
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list