[antlr-interest] v3 - how to disable error recovery
Tamas Kerecsen
kerecsen at gmail.com
Sun Aug 13 22:04:12 PDT 2006
Terence,
Thanks for the quick reply. Your suggestion works fine for the Parser and
the Tree generator, but I couldn't figure out how to get the lexer to
include my rulecatch statement (regardless of whether I put it at the
grammar level or inside the rule). I tried to decypher Java.stg, and it
doesn't seem to have any mention of @rulecatch for lexerRule. As the lexer's
exception handling is different from the parser and my understanding of
antlr's internals is extremely limited, I couldn't come up with an easy hack
to put it in there either.
Granted, it's pretty unlikely that the parser and tree generator will
succeed where the lexer failed, but I'd like to make sure nothing invalid
slips through :)
Thanks,
Tamas
On 8/13/06, Terence Parr <parrt at cs.usfca.edu> wrote:
>
>
> On Aug 12, 2006, at 12:43 PM, Tamas Kerecsen wrote:
>
> > Hi Everyone,
> >
> > Is there an easy way in v3 to completely disable error recovery?
> > I'd like to receive an exception on any lexer, parser or tree
> > walker issue and just bail out... v2 had an option that would allow
> > this, but I couldn't find the equivalent in v3 :(
> >
>
> Hi Tamas,
>
> Try defining an action:
>
> @rulecatch {}
>
> which will replace the rule catch blocks with nothing. Exceptions
> should fall through to invoking program.
>
> Ter
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060813/1f9f8cc0/attachment.html
More information about the antlr-interest
mailing list