This examples does everything you need and more, so you can pare it down to just your examples.
http://www.antlr.org/wiki/display/ANTLR3/Lexer+grammar+for+floating+point%2C+dot%2C+range%2C+time+specs Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Andy Hull > Sent: Tuesday, April 20, 2010 2:42 PM > To: [email protected] > Subject: [antlr-interest] Can I force a token to have precendence in > the lexer? > > I have the following lexer tokens defined: > > I have the following expression "x={1..3};" > > I'm expecting the input between the braces to be recognized as FLOAT, > AUTO, FLOAT but what I actually get is just a FLOAT ".3" in the token > stream of "x","=","{",".3","}",";" > > > AUTO : '...'; > > FLOAT > : ('0' .. '9')+ '.' ('0' .. '9')+ EXPONENT? > | '.' ( '0' .. '9' )+ EXPONENT? > | ('0' .. '9')+ EXPONENT > | ('0' .. '9')+ > ; > > I think the float is matching too much. Can anyone help? > > Thanks > -- > Andy Hull | Senior Software Engineer > SunRun Inc.<http://www.sunrunhome.com/> > direct 415.684.9851 > > Review SunRun on Yelp<http://www.yelp.com/biz/sunrun-san-francisco> > click on the link above and then on 'write a review' > > > 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.
