[antlr-interest] Customizing Error Recovery

David-Sarah Hopwood david-sarah at jacaranda.org
Mon Nov 30 18:22:34 PST 2009


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 292 bytes
Desc: OpenPGP digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20091201/498703bb/attachment.bin 


More information about the antlr-interest mailing list