Better to do this:
fragment FLOAT;
INT : '0'..'9'+ ( '.' '0'..'9'+ { $type = FLOAT; } | ) ;
Cheers,
Jim
> -----Original Message-----
> From: [email protected] [mailto:antlr-interest-
> [email protected]] On Behalf Of yushang
> Sent: Monday, November 07, 2011 2:17 AM
> To: [email protected]
> 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 <[email protected]>
>
> > 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
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.