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

Christian chwchw at gmx.de
Sun Nov 13 03:09:55 PST 2011


Hello Jiwon,

first, try to write a simple minimal grammar that represents your
usecase because I do not see anything that explains the behavior you
described. Maybe there are some other rules that influence the parsing.

Tell us afterwards.

Regards,
Christian

Am 13.11.2011 10:31, schrieb Jiwon Seo:
> I'm trying to add range operator in my language, and I'm having a
> problem with it.
>
> The range operator is defined as following:
>
> range: INT '..' INT ;
>
> where INT is '0'..'9'+
>
> I do have FLOAT, but it is defined such that it does not have conflict
> with the range operator:
>
> FLOAT: ('0'..'9')+'.'('0'..'9')+ EXPONENT?
>             | ('0'..'9')+ EXPONENT
>           ;
>
> The thing is, if I use the range operator with white spaces before &
> after the dots(such as 10 .. 100), it parses fine
> But without the white spaces(such as 10..100), it says
> 'MismatchedTokenException' .
>
> Can anyone see why it's acting like that? I do not use dot ('.') in
> any other places.
>
> I'm using antlrworks 1.4.3 for writing grammar and testing it
> (interpreter & debugger)
>
> Thanks.
>
> 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