congo-cc / congo-parser-generator

The CongoCC Parser Generator, the Next Generation of JavaCC 21, which in turn was the next generation of JavaCC
https://discuss.congocc.org/
Other
33 stars 9 forks source link

Fix some fault-tolerant things; add the ability to associate a code a… #171

Closed adMartem closed 4 months ago

adMartem commented 4 months ago

…ction with a fault recovery using either "!!" or "!->" for now.

adMartem commented 4 months ago

If a single ! is used there is no recovery action side-effect except that the parse exception, if any, associated with the recovery is captured and can be retrieved later by a visitor. If either !! or !-> is used it must be followed immediately by a code block that is performed when the recovery method has returned to the production method. At that point CURRENT_NODE and THIS_PRODUCTION have their normal meaning, and peekNode() refers to the InvalidNode pushed by recovery. I anticipate that we will standardize on one of the notations (!! or !->) and remove the other one when we decide which one "works" best in practice. With my experience so far, I think I would vote for !->.

While the action block option is allowed anywhere the single ! is allowed, it only affects the generated parser in loop recovery.

adMartem commented 4 months ago

I want to look at this a little more with respect to non-loop recovery. I'll resubmit when I've done that.