[antlr-interest] Exceptions in the lexer (c++)
Ric Klaren
klaren at cs.utwente.nl
Fri Aug 20 02:31:14 PDT 2004
On Fri, Aug 20, 2004 at 07:47:22AM -0000, beckersheinzsb wrote:
> is there a possibility to configure antlr (c++ version) that way,
> that the generated lexer doesn't "convert" RecognitionExceptions into
> TokenStreamRecognitionExceptions ?
Catch the RecognitionExceptions in your rules with custom handlers before
they get to the generated nextToken where they get converted to
TokenStreamRecognitionExceptions. This is somewhat a pain since you have to
add custom handlers to every rule in which you're interested.
Alternatively turn on the defaultErrorHandler and play around with
overloading reportError. Just have a peek at the code generated with and
without defaultErrorHandler and you'll probably get inspiration for what
will work best.
Cheers,
Ric
--
-----+++++*****************************************************+++++++++-------
---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755 ----
-----+++++*****************************************************+++++++++-------
"I don't have anything against Java - it's the best damn implementation
of UCSD Pascal ever released..." --- Larry Smith
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