[antlr-interest] lexer's rule overlapping problem
Непонятна Неизвесто
JOHN851 at yandex.ru
Sun Sep 6 09:59:26 PDT 2009
Hello,
I would like to make my own translator but has faced with one problem - lexer's rules overlapping. I want to have two lexer rules like this:
ID 'a'..'z'+;
ENG 'a'..'z';
and
INT '0'..'9'+;
DIG '0'..'9;
I need it because it is necessary to catch input text errors while parsing.
The purpose of these lexer rules is demonstrated below:
word:
'inputword' ':' (ENG|DIG) 'in' '['axsis']' ';'
;
axis:
INT (',' INT)*
;
I have find only one solution of this problem
word:
'inputword' ':' (ID|INT) 'in' '['axsis']' ';'
; //^ it is important that here was placed only one character
and then find input errors (like this 123 in [1,2,3]) by the tree grammar
Thank you,
John
More information about the antlr-interest
mailing list