I want to create a token from '..'in the ANTLR3 lexis, which will be used to combine expressions like
a..b
c .. x
1..2
3 .. 4
So I added
DOTDOTSEP : '..'
;
The problem is that I already have a rule:
FLOAT : INT (('.' INT (('e'|'E') INT)? 'f'?) | (('e'|'E') INT)? ('f'))
;
And in the example [3] above it is 1..2compared as FLOAT(I’m not sure why, since after the first one .there is one more .not INT, but it is).
I wonder if there is a way to change the priority of lexer rules, so it DOTDOTSEPmaps first, then FLOAT.
Looking here, it seems like I'm losing, "The rule having the greatest count is the winner.",but I wonder if there is a way around it.
PS INT is defined as below ...
fragment DIGIT
: '0'..'9'
;
INT : DIGIT+
;
Edit.
, , FLOAT. ( , , .) ( ) lexer, .