[antlr-interest] Lexer for 0.Equals(..)

Christian chwchw at gmx.de
Mon Jan 23 06:50:52 PST 2012


> It looks like your lexer is matching "0.E" as a REAL_LITERAL.
Yes, I know.

> You need to make sure that the exponent part includes non-optional digits after the E.
Thank you, but how can I realize it?

Regards,
Christian

Am 23.01.2012 15:48, schrieb Sam Harwell:
> It looks like your lexer is matching "0.E" as a REAL_LITERAL. You need to
> make sure that the exponent part includes non-optional digits after the E.
>
> --
> Sam Harwell
> Owner, Lead Developer
> http://tunnelvisionlabs.com
>
>
> -----Original Message-----
> From: Christian [mailto:chwchw at gmx.de] 
> Sent: Monday, January 23, 2012 7:31 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Lexer for 0.Equals(..)
>
> Hello,
>
> my lexer does not recognize 0.Equals(..) and reports the error:
>     required (...)+ loop did not match anything at character 'E'
>
> I understand why but I do not know how to resolve it. Here are the
> participating rules in order:
>
> INTEGER_LITERAL
>   : Decimal_integer_literal
>   | Hexadecimal_integer_literal
>   ;
>
> REAL_LITERAL
>   : Decimal_digits DOT Decimal_digits Exponent_part? Real_type_suffix?
>   | DOT Decimal_digits Exponent_part? Real_type_suffix?
>   | Decimal_digits Exponent_part Real_type_suffix?
>   | Decimal_digits Real_type_suffix
>   ;
>
> DOT : '.';
>
> The lexer tries to match the statement from above with the first branch in
> the REAL_LITERAL rule but fails after the DOT. Of course. However, why
> doesn't it try to match it with other rules after failing?
> Furthermore, how can I resolve the problem?
>
> If you need more information, please let me know.
>
> Regards,
> Christian
>
> 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