Please see the FAQ: http://www.antlr.org/wiki/display/ANTLR3/Lexer+grammar+for+floating+point%2C+dot%2C+range%2C+time+specs
Also note that there is a search engine: http://antlr.markmail.org For this group, and it is really good: http://antlr.markmail.org/search/?q=range Jim > -----Original Message----- > From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- > boun...@antlr.org] On Behalf Of Ondrej Krc-Jediny > Sent: Wednesday, May 26, 2010 1:34 PM > To: antlr-interest@antlr.org > Subject: [antlr-interest] Ambiguous grammar > > 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 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.