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

Ilia Kantor ilia at obnovlenie.ru
Sun Sep 3 12:42:43 PDT 2006


Maybe it referred to past versions of ANTLR.

It does not work in 3.0b4.

> 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