[antlr-interest] line 0:-1 mismatched input '<EOF>' expecting ';'

Fabien Hermenier fabien.hermenier at unice.fr
Sat Oct 6 02:44:06 PDT 2012


I am stuck with this problem since long.

When I have an error in the parser at the end of the input, the reported error position is always 0:-1.
When it is in the middle of the input, there is no problem.
The exception RecognitionException that is generated in my parser reported this inaccurate position.
In fact, the token related to that error indicates the line 0:-1.
So, why this particular situation at the end of the input ?

Here is a sample input:


-> Report an error in line 2:1 :expecting ';'


-> Report an error in line 0:-1 : expecting ';'


More information about the antlr-interest mailing list