[antlr-interest] Using range operator (INT .. INT)

Jiwon Seo jiwon at stanford.edu
Sun Nov 13 15:30:32 PST 2011


Hmm I see.

Then do I have to extend the lexer like following?

http://www.antlr.org/wiki/display/ANTLR3/Lexer+grammar+for+floating+point,+dot,+range,+time+specs

Cause it seems like very complicated for what I want to achieve...
In my language FLOAT does not have a conflict with the range because I
do not allow a float number such as .123
(dot has to be preceded by number like 0.123)

Is there easier way which uses the fact that I'm now allowing .123
style floating point number?

Thanks.

On Sun, Nov 13, 2011 at 10:14 AM, Bart Kiers <bkiers at gmail.com> wrote:
> On Sun, Nov 13, 2011 at 6:59 PM, Jiwon Seo <seojiwon at gmail.com> wrote:
>
>> Thanks for the reply!
>>
>> I'm trying to do it without extending lexer since I think my
>> definition of FLOAT should not be a problem with the range operator.
>
>
> But it _is_  a problem if the `..` is preceded by an INT: the ('0'..'9')+
> '.' is consumed by FLOAT and can then not match ('0'..'9')+ EXPONENT?,
> resulting in the MismatchedTokenException.
>
> Regards,
>
> Bart.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list