[getting OT ...] Re: [antlr-interest] exceptions in the lexer

Harald Mueller harald.m.mueller at bigfoot.com
Tue Dec 7 02:56:48 PST 2004


> 
> Well JEdit catches this and recovers.
> Why can't I?

You can :-) But there's no guarantee it works. Here is the text from the JLS
(section 8.4.4) - which I interpret as a more constructive comment than
mine:

> Exceptions that are represented by the subclasses of class Error, for
example OutOfMemoryError, are thrown due to a failure in or of the virtual
machine. Many of these are the result of linkage failures and can occur at
unpredictable points in the execution of a program. Sophisticated programs
may yet wish to catch and attempt to recover from some of these conditions. 

Regards
Harald M. Mueller

> matthew
> 
> ----- Original Message ----- 
> From: "Harald Mueller" <harald.m.mueller at bigfoot.com>
> To: <antlr-interest at yahoogroups.com>
> Sent: Tuesday, December 07, 2004 8:48 PM
> Subject: Re: [antlr-interest] exceptions in the lexer
> 
> 
> >
> > >
> > > Hey, Just extend you user-defined exceptions from RuntimeException and
> > > throw
> > > them.
> >
> > He explicitly didn't want to do this - but I also do it (using a
> > WrappingRuntimeException which I need at other places anyway (e.g. for
> the
> > Runnable.run() method)).
> >
> > > You catch all your RuntimeExceptions don't you?
> > > Remember OutOfMemoryException is not necessarly fatal.
> >
> > This is not an Exception, but an Error - you would never catch this.
> >
> > Regards
> > Harald M. Müller
> >
> > > matthew
> > > ----- Original Message ----- 
> > > From: "Paul J. Lucas" <pauljlucas at mac.com>
> > > To: <antlr-interest at yahoogroups.com>
> > > Sent: Tuesday, December 07, 2004 11:10 AM
> > > Subject: Re: [antlr-interest] exceptions in the lexer
> > >
> > >
> > > >
> > > > On Mon, 6 Dec 2004, Terence Parr wrote:
> > > >
> > > > > Are you familiar with the filter option on the lexer grammar?
> > > >
> > > > Yes in the sense that I've read that bit of the documentation,
> > > > but I've never used it.
> > > >
> > > > I don't want my entire lexer to be a filter since I need it to
> > > > be a real lexer for a parser.
> > > >
> > > > My particular case at hand is dealing with pragmas that can
> > > > appear anywhere comments can.  Since comments are most easily
> > > > handled in the lexer, I handle pragmas there to for the same
> > > > reason.  The problem is what to do if there's an error in a
> > > > pragma.  The lexer can't throw user-defined exceptions.  (I
> > > > might be able to work around it by hiding the real exception
> > > > inside a Runtime exception, but that's ugly.
> > > >
> > > > - Paul
> > > >
> > > >
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > -- 
> > NEU +++ DSL Komplett von GMX +++ http://www.gmx.net/de/go/dsl
> > GMX DSL-Netzanschluss + Tarif zum supergünstigen Komplett-Preis!
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 

-- 
GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list