[antlr-interest] Default error handler, generated _token_set_n
Terence Parr
parrt at cs.usfca.edu
Sun Aug 15 15:04:06 PDT 2004
On Aug 15, 2004, at 5:06 PM, Ingo Maier wrote:
>
> Hi,
>
> the default parser error handler seems to catch RecognitionExceptions
> and then calls consumeUntil() with an auto generated BitSet as argument
> (_token_set_n). I guess these BitSets contain some hint to
> synchronizing
> tokens? But how exactly? I couldn't fiddle out by myself nor found it
> in the docs.
Hi :)
It's the FOLLOW(r) where r is the rule you are in. For example, if the
FOLLOW(expr) is {',', ';', '}'} then that is a could list of tokens to
look for in order to resynch after an error in an expression. :)
Simplest reasonable strategy, but it works wonders. ;)
Terence
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
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