[antlr-interest] Customizing Error Recovery
Jim Idle
jimi at temporal-wave.com
Mon Nov 30 19:10:37 PST 2009
I added an explanation of where to raise an error because you are consuming spurious tokens and correct the method call name in the Java code. Thanks for the input.
jim
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of David-Sarah Hopwood
> Sent: Monday, November 30, 2009 6:23 PM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Customizing Error Recovery
>
> Jim Idle wrote:
> > As this subject comes up fairly often, I thought I would write an
> > article showing some of the ways you can influence, hijack, or
> > otherwise coerce the error recovery mechanisms within your parser.
> You
> > can find the article here:
> >
> > http://www.antlr.org/wiki/display/ANTLR3/Custom+Syntax+Error+Recovery
>
> The '[ListBuffer<JFXTree> mems]' argument to syncClass should be
> removed.
>
> 'protected void syncToSet(BitSet follow)' should be called
> 'syncToGoodToken' if it's to be consistent with the call in
> 'syncToSet()'.
>
> A more serious problem is that this code seems to be suppressing
> errors, as opposed to recovering from them. That is, syncToSet will
> just discard invalid tokens, rather than reporting that an invalid
> token was found before syncing to the next good token.
>
> --
> David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com
More information about the antlr-interest
mailing list