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
36 stars 11 forks source link

Using an up-to-here in an otherwise legal non-choice location within ATTEMPT ... RECOVER is not allowed #46

Closed adMartem closed 7 months ago

adMartem commented 1 year ago

Of course the entire ATTEMPT ... RECOVER can be enclosed in parentheses and then up-to-here used on the complete production, but that does not allow the up-to-here to be used for a leading subset of the component expansions. Quick examination of the code leads me to believe there is no good reason to disallow up-to-here within the recovery block when it is at the top level of the production or would be at what would be consider a choice point otherwise.

revusky commented 1 year ago

Could you provide a code snippet of what you're trying to do?

adMartem commented 7 months ago

What I am trying to do is: FooBarBaz : ATTEMPT "foo" "bar" =>|| "baz" RECOVER (FAIL);. Other similar variants are: FooBarBaz : ATTEMPT ("foo" "bar" =>|| "baz") RECOVER (FAIL); and FooBarBaz : (ATTEMPT "foo" "bar" =>|| "baz" RECOVER (FAIL));. I think I have a fix that works, but due to the messiness of the method, I would like for you to take a look at it, and improve it if necessary. I'll do a PR for this issue with the proposed fix shortly.