[antlr-interest] Error handeling - Illigal input termination

Vitaliy Vitaliy at dbsophic.com
Sun Nov 2 00:33:31 PDT 2008


Hi again,

Is this an obvious question?
I did not find any references to it in the documentation.
Could anybody please shed some light upon the issue?

Thanks allot,
Vitaliy

From: Vitaliy
Sent: Wednesday, October 29, 2008 14:05
To: ANTLR-Interest Interest
Subject: Error handeling - Illigal input termination

Hi,

I would like Antlr to fail upon any error, instead of trying to recover.
I've managed to do this for almost all types of errors, following the directives in the reference,
but for some reason if there is an illegal input termination, Antlr won't report an error for it.

That is, If we've got the input:
LegalStatement1,
LegalStatement2,
...
LegalStatementN,
IllegalStatement,

Antlr would stop on LegalStatementN,
Instead of reporting an error for IllegalStatement.

Following are all the steps I took to achieve the bail-upon-any-error behavior:


1.       Overriding NextToken method of the lexer, so it would always throw an exception

2.       Overriding methods Mismatch and RecoverFromMismatchedSet of the parser, so they would always throw an exception

3.       Adding @parser::rulecatch directive, so a RecognitionException would always be thrown.

So, what did I miss?

I would really appreciate any help,
Vitaliy


__________ Information from ESET NOD32 Antivirus, version of virus signature database 3565 (20081029) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


__________ Information from ESET NOD32 Antivirus, version of virus signature database 3568 (20081030) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


__________ Information from ESET NOD32 Antivirus, version of virus signature database 3575 (20081031) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081102/c62b3953/attachment.html 


More information about the antlr-interest mailing list