Hello,

I am new to ANTLR and I'd appreciate help with my problem. At first
some grammar rules I am going to talk about:

DIGIT: '0'..'9';
LETTER: 'a'..'z'|'A'..'Z';

REAL
    :   (DIGIT)+ '.' (DIGIT)* EXPONENT?
    |   '.' (DIGIT)+ EXPONENT?
    |   (DIGIT)+ EXPONENT
    ;

INTEGER: DIGIT+;

IDENTIFIER: LETTER+;

range_expr:
  expr ('..' expr)?;

expr: expratom ('+' expratom)?;

expratom: INTEGER | REAL | IDENTIFIER;

This grammar allows '1.' and .1' as correct real numbers. Also, it
allows range expression '1..2', which gets parsed incorrectly as two
real numbers 1. and .2. Redefining token
INTEGER: DIGIT '..'?;
doesn't help, because then also valid range expression 'i + 1..2'. Is
there any way how to parse the '..' correctly in all cases?

Thank you very much,

Ondrej.

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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to