[antlr-interest] Detecting incomplete input in ANTLR V2
Thomas Rolfs
thomas.rolfs at cox.net
Tue Aug 8 11:14:10 PDT 2006
Scott wrote:
> I'm not sure how (or why) you could do this as MismatchedTokenException
> derives from RecognitionException, not the other way around (i.e. any
> MismatchedTokenException will be caught by the more general
> RecognitionException). Perhaps you meant downcasting? But either way,
> I don't see why you would need to have altered RecognitionException.
Sorry, I meant downcast. RTTI is not an option for me so I had to add
my own RTTI info. However, I'm not familiar with the code and I have
never used C++ exceptions in anger so if there is an elegant solution
I'm all ears.
I also just hit the problem of trying to trap the EOF exception in the
lexer. The lexer catches RecognitionException and re-throws it as
TokeStreamRecognitionException but in the process loses the original
exception information.
Again, if there is a right way to do this I'm all ears.
--
Thomas Rolfs
More information about the antlr-interest
mailing list