[antlr-interest] API change for "recoverFromMismatchedSet"?

Gerz, Michael Gerz at fgan.de
Mon May 26 03:33:33 PDT 2008


Hello,

 

with the recent API changes, I think that the "error handling" section at

 

http://www.antlr.org/wiki/display/ANTLR3/Migrating+from+ANTLR+2+to+ANTLR+3 <http://www.antlr.org/wiki/display/ANTLR3/Migrating+from+ANTLR+2+to+ANTLR+3> 

 

needs be revised.

 

Regards,

 

Michael

 

 

************************************************************************

Dr. Michael Gerz 

FGAN e.V.                                       Phone:  +49 228 9435-414

Department FKIE/ITF                             Fax:    +49 228 9435-685

Neuenahrer Straße 20                            E-Mail: gerz at fgan.de 

53343 Wachtberg-Werthhoven, Germany             WWW:    www.fgan.de 

 

Forschungsgesellschaft für Angewandte Naturwissenschaften e. V. (FGAN) 

Sitz der Gesellschaft: Bonn 

Registergericht: Amtsgericht Bonn VR 2530 

Vorstand: Dr.rer.nat. R. Dornhaus (Vorst.), Prof. Dr. J. Ender (Stellv.)

 

________________________________

Von: Gerz, Michael 
Gesendet: Montag, 26. Mai 2008 12:22
An: 'antlr-interest at antlr.org'
Betreff: API change for "recoverFromMismatchedSet"?

 

Hello,

 

I use the following code to suppress any kind of error handling

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

 

@rulecatch { 

            catch (RecognitionException e) {

                        throw e;

            }

}

 

@members {

            @Override

            protected void mismatch(IntStream input, int ttype, BitSet follow)

                        throws RecognitionException

            {

                        throw new MismatchedTokenException(ttype, input);

            }

 

            @Override

            public void recoverFromMismatchedSet(IntStream input, RecognitionException e, BitSet follow)

                        throws RecognitionException

            {

                        throw e;

            }

}

 

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 

 

With the latest ANTLR snapshot as of 2008-05-25, the Java compiler complains about the following problem:

 

   The return type is incompatible with BaseRecognizer.recoverFromMismatchedSet(IntStream, RecognitionException, BitSet)

 

It seems that I have to return an "Object". What is the proper way of overwriting this method to suppress errors? 

 

Kind regards, 

 

Michael

 

************************************************************************

Dr. Michael Gerz 

FGAN e.V.                                       Phone:  +49 228 9435-414

Department FKIE/ITF                             Fax:    +49 228 9435-685

Neuenahrer Straße 20                            E-Mail: gerz at fgan.de 

53343 Wachtberg-Werthhoven, Germany             WWW:    www.fgan.de 

 

Forschungsgesellschaft für Angewandte Naturwissenschaften e. V. (FGAN) 

Sitz der Gesellschaft: Bonn 

Registergericht: Amtsgericht Bonn VR 2530 

Vorstand: Dr.rer.nat. R. Dornhaus (Vorst.), Prof. Dr. J. Ender (Stellv.)

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080526/0d910349/attachment-0001.html 


More information about the antlr-interest mailing list