[antlr-interest] Detecting incomplete input in ANTLR V2

Peggy Fieland madcapmaggie at yahoo.com
Tue Aug 8 14:00:54 PDT 2006


I don't know about the right way to solve your
probleem, but you can specify an uponEOF() routine of
your own.



--- Thomas Rolfs <thomas.rolfs at cox.net> wrote:

> 
> 
> 
> 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