[antlr-interest] Is it a bug of BaseRecongnizer?

Kay Roepke kroepke at classdump.org
Sat Jun 2 11:37:36 PDT 2007


On May 31, 2007, at 8:02 PM, Terence Parr wrote:

>> first, MismatchedNotSetException variable use the same name mse as  
>> MismatchedSetException variable, and Whether should  
>> MismatchedNotSetException's error message be "expecting not set"  
>> or not?
>
> Hi. I think that I have computed the set complement already so it  
> will say the correct thing when executed.  Did you see the inverse?

> 	public String getErrorMessage(RecognitionException e, String[]  
> tokenNames) {
> ................
> 		else if ( e instanceof MismatchedSetException ) {
> 			MismatchedSetException mse = (MismatchedSetException)e;
> 			msg = "mismatched input "+getTokenErrorDisplay(e.token)+
> 				" expecting set "+mse.expecting;
> 		}
> 		else if ( e instanceof MismatchedNotSetException ) {
> 			MismatchedNotSetException mse = (MismatchedNotSetException)e;
> 			msg = "mismatched input "+getTokenErrorDisplay(e.token)+
> 				" expecting set "+mse.expecting;
> 		}
> ..................
> }

Actually, it looks like the "if ( e instanceof  
MismatchedNotSetException )" is always false, NotSetException being a  
subclass of SetException.
Shouldn't those else ifs be the other way around?

cheers,
-k
-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list