[antlr-interest] How to distinguish between integer an binary number?
Mario Prada
mario.prada at gmail.com
Sat Dec 13 11:42:30 PST 2008
I need to distinguish between integer an binary number in my grammar.<P>
In Lexer I have this code:
<P>
<font size=2><pre>
BINARIO : (BIN_DIGIT)+;
INT : DIGIT+ ;
fragment BIN_DIGIT
: '0'|'1';
fragment DIGIT
: '0'..'9';
</pre></font>
<P>
and in Parser, when I have a grammar rule with an INT token, it seems to
work, but this error appears:
<P>
mismatched input '1' expecting INT
<P>
How can I solve this problem?
Thanks in advance.
--
Mario Prada Arroyo
----------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081213/c3e8eb33/attachment.html
More information about the antlr-interest
mailing list