[antlr-interest] MismatchedTokenException in sample grammar
cyrilg31 at free.fr
cyrilg31 at free.fr
Sun Oct 5 02:22:08 PDT 2008
Hello,
I would like to recover information in String separated by tags like /WR, /BR
...
here is my grammar:
grammar example;
SLASH : '/';
CHAR : ('a'..'z'|'A'..'Z'|'.'|'-');
SEPARATOR_WR : SLASH 'WR';
SEPARATOR_BR : SLASH 'BR';
SEPARATOR_YH : SLASH 'YH';
abvalue: (CHAR | SLASH)*;
brvalue: (CHAR | SLASH)*;
yhvalue: (CHAR | SLASH)*;
message : SEPARATOR_WR abvalue SEPARATOR_BR brvalue SEPARATOR_YH yhvalue;
When I try with this message: /WRblabla/BRRFT/PNmj/YHkijg , no problem, it is
working fine.
When I try with this message: /WRblabla/BRRFT/WNmj/YHkijg , I have a " problem
matching token at 1:18 MismatchedTokenException(78!=82)" and I don't recover all
the information
When I try with this message: /WRblabla/BRRFT/WRmj/YHkijg , I have a "No Viable
Alt Exception".
It seems to be a problem of lexer and not parser, but I don't know how to
correct this.
Could you help me please, indicates me what it is wrong, or where to find
information. I read a lots of message in this forum and the "Definitive ANTLR
Reference" from Terence Parr but I didn't find information to solve my problem.
Thank you very much
Cyril
More information about the antlr-interest
mailing list