[antlr-interest] exception thrown in syntatic predicate can't be caught!

mzukowski at yci.com mzukowski at yci.com
Mon Apr 14 08:01:09 PDT 2003


Syntactic predicates work by trying a piece of syntax and then checking if
an exception was thrown.  When it finds a predicate that works it then calls
the parser for real, with actions turned back on.  Syntactic predicates
won't work if you can catch their exceptions.  Catch the exception after the
predicate has decide where to go.

Or just catch and handle the exception in the lexer.  What exactly are you
doing with the exceptions anyhow?

Monty

-----Original Message-----
From: martinkbraid [mailto:mbraid at sqlworks.com]
Sent: Sunday, April 13, 2003 7:07 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] exception thrown in syntatic predicate can't
be caught!


Because I need to be able to handle garbage characters passed to my 
parser/lexer, I'm doing my own error processing in a top level rule 
by catching ANTLRExceptions. 

By chance, during syntactic predicate processing, the lexer 
encounters a garbage character and throws a TokenStreamException. But 
because inputState.guessing > 0 (because it was in a syntactic 
predicate), my exception handler does NOT get control and the 
exception passes out of the parser. What do I do? It would be 
impossible to avoid syntatic predicates?

Thanks, Martin Braid


 

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


 

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




More information about the antlr-interest mailing list