Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Happy catchtok #283

Closed
wants to merge 3 commits into from
Closed

Happy catchtok #283

wants to merge 3 commits into from

Conversation

Kariiem
Copy link
Contributor

@Kariiem Kariiem commented Jun 28, 2024

This is a wip for introducing catchTok and all the neccessary generated code in the template files.

@Kariiem Kariiem marked this pull request as draft June 28, 2024 20:37
@Kariiem Kariiem force-pushed the happy-catchtok branch 2 times, most recently from 474bcfd to 1a27312 Compare June 29, 2024 22:30
@Kariiem Kariiem marked this pull request as ready for review June 29, 2024 22:38
@Kariiem Kariiem force-pushed the happy-catchtok branch 3 times, most recently from 8f45e4d to 179bdfd Compare July 13, 2024 11:16
Comment on lines +237 to +241
-- 2. Error resumption mode: If the error handler wants to resume parsing in
-- order to report multiple parse errors, it will call the resumption
-- continuation (of result type `P (Maybe a)`).
-- In the absence of the %resumptive declaration, this resumption will
-- always (do a bit of work, and) `return Nothing`.
-- In the presence of the %resumptive declaration, the grammar author
-- can use the special `catch` terminal to declare where parsing should
-- resume after an error.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment by me is out of date. Note that we no longer have a %resumptive pragma; we only have %error { abort } { report }, and report gets passed the resumption (of type P a).

The default behavior without %error (calling happyError) or with the unary variant of %error is to call a user-supplied function wrapped in happyReport that ignores the resumption. The reporting function will likely panic and abort the parse (at least happyFail does this). See also the code generation for callReportError.

It's all a bit confusing due to multiple layers of indirection; perhaps we can simplify.

It is probably best to describe the expected behavior of %error { abort } { report } in conjunction with the catch token in the user's guide first. Building on that documentation, we can describe how resumption is implemented here.

@sgraf812
Copy link
Collaborator

sgraf812 commented Oct 7, 2024

Superseded by #318.

@sgraf812 sgraf812 closed this Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants