[antlr-interest] Can I force a token to have precendence in the lexer?
Andy Hull
andyh at sunrunhome.com
Tue Apr 20 14:41:52 PDT 2010
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’
More information about the antlr-interest
mailing list