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

Jiwon Seo seojiwon at gmail.com
Sun Nov 13 01:31:26 PST 2011


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.


More information about the antlr-interest mailing list