[antlr-interest] Re: exceptions in the lexer

Colm McHugh colmmagoo at yahoo.com
Fri Dec 10 17:11:18 PST 2004



--- Terence Parr <parrt at cs.usfca.edu> wrote:
> 
> 
> On Dec 10, 2004, at 2:25 PM, Paul J. Lucas wrote:
> 
> >
> > On Fri, 10 Dec 2004, Terence Parr wrote:
> >
> >> Hm...perhaps I should just make it catch
> ANTLRException, the root,
> >> instead?
> >
> > 	That would work also (and should fix the problem
> once and for
> > 	all).
> 
> Agreed, though I'm afraid it would break something. 
> I'll add to list 
> to examine for 2.7.5, which I hope to jump on next
> week around 
> thursday.
> 
Might that 'something' be related to syntactic
predicate?

I've been grappling with this exact same problem for
the past week, namely trapping bad character (or
lexical) errors. 

I switched all catches of TokenRecognitionException in
my parser to catch ANTLRException (I want to do my own
exception handling), and that traps all bad characters
except for one case, and that is when a bad character
is found while in syntactic predicate guess mode; the
exception does not get trapped and causes the process
to abort [this is bad]. The same bad character error
is trapped when it's not part of a syntactic
predicate, hence my finger-pointing at syn preds.

I've looked at the generated code for the parser, and
a catch block is only executed if guessing is not on,
otherwise it does a 'throw'. Why is this ? Is there a
good reason to not do the user's exception-handling if
we are in guess mode ?

My brain is refusing to delve further into the problem
(it _is_ 4:30pm on Friday) but let me know if there is
anything that vaguely makes sense in this line of
thought.

Cheers!
Colm.




		
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 





 
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