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

Christian chwchw at gmx.de
Mon Jan 23 05:30:41 PST 2012


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


More information about the antlr-interest mailing list