[antlr-interest] How to disable recovery in antlr3 ?

Dieter Frej dieter_frej at gmx.net
Sun Sep 3 07:02:03 PDT 2006


Hi Ilia,

a while ago Ter wrote in one of his emails (10.07.2006 23:20):

"By default ANTLR does not send the exceptions back out...it tries to
recover.  Override reportError and recover if you want; also can set
trycatchclause action I think it is."

Did you try this?

- Didi



Ilia Kantor wrote:
> В сообщении от 3 сентября 2006 02:14 Ilia Kantor написал(a):
> 
>>I don't want parser to 'recover' from errors. How can I disable recovery
>>and just let exception slip out ?
> 
> 
> Seems found the solution. Hope that helps someone.
> 
> 
> @rulecatch { }
> 
> @parser::members {
>     // override it to disable recovery
>     protected void mismatch(IntStream input, int ttype, BitSet follow) throws 
> RecognitionException
>     { 
>         MismatchedTokenException mte = new MismatchedTokenException(ttype, 
> input);
>         throw mte;
>     }
> }
> 	
> 
> 



More information about the antlr-interest mailing list