Hi Eugene,

The problem with folding TokenMgrException into ParseException is that it's
inconsistent with the parser generation framework provided by JavaCC.
Simply put, a lexer error is not a parser error.  Indeed, a smart parser may
be able to gracefully recover from lexer errors.  Yes, you can hack the
generated classes, but first I'd like to believe that there's a good design
reason for doing so.  To my mind, the absence of an "is a" relationship
between these two classes make such a move an abuse of inheritance.

my 2 cents,
Eric



> -----Original Message-----
> From: Eugene Gluzberg [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 15, 2002 7:56 AM
> To: Lucene Developers List
> Subject: Re: about my proposed patch for bug 7782
> 
> 
> Although I agree with you in theory, in practice we need to 
> be backwards
> compatable as well is absolutelly correct.
> 
> ParseException also does not nesseserally mean "syntax 
> error", it indicates
> an error encountered during parsing.
> 
> If you would like we can create 3 exception classes:
> ParseException
> TokenMgrException extends ParseException
> SyntaxException extends ParseException
> 
> but that would require significant changes thoughout the 
> code, which IMHO
> should not be in this release.
> 
> For this release we should just throw a ParseException.
> 
> >
> > To make a source code analogy:  "return if break;" contains a set of
> > valid tokens for the Java language, but the syntax is 
> invalid, making a
> > ParseException the right kind of error to raise.  
> Conversely, "swAtch
> > (c) { }" contains characters which cannot be recognized by 
> the lexer as
> > a legal token, so a TokenMgrException is appropriate.
> >
> > I would strongly urge against blurring the distinction between these
> > two classes of error, as they really are not the same thing.
> >
> > Eric
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to