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

Introduce catch and new %error handler mode for resumable parsing #318

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

sgraf812
Copy link
Collaborator

@sgraf812 sgraf812 commented Oct 7, 2024

This is the "production-ready" version of #272 and #283, superseding both.


This patch enables users of happy to emit multiple parse errors in the same file and produce a partial syntax tree.

  • The main feature is described in the user's guide entry.
  • I also added a user's guide entry for the hitherto undocumented "expected token list" feature (which I broke to vastly improve it, but it was not documented anywhere). This will fix happyExpToks table can be larger than happyTable #271 because we no longer need an uncompressable table.
  • The most important place documenting the implementation and the backwards compatibility dance with the existing error token is described in Note [Error recovery] and its children.

This patch unblocks our GSoC student @Kariiem's work over at https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13145.

@sgraf812 sgraf812 force-pushed the wip/resumptive branch 2 times, most recently from c31a401 to a0e7618 Compare October 7, 2024 14:48
@Ericson2314
Copy link
Collaborator

This is very cool! :)

@@ -38,23 +37,25 @@ This will never terminate.
> , lookupProdsOfName = prodsOfName
> , non_terminals = nts
> })
> = joinSymSets (\ h -> maybe (Set.singleton h) id (lookup h env) )
> = joinSymSets (\h ->fromMaybe (Set.singleton h) (lookup h env))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
> = joinSymSets (\h ->fromMaybe (Set.singleton h) (lookup h env))
> = joinSymSets (\h -> fromMaybe (Set.singleton h) (lookup h env))

@sgraf812
Copy link
Collaborator Author

Will merge soon. It would be good if anyone could give the user's guide entry a read and tell me if it made any sense.

@sgraf812 sgraf812 merged commit 0b4b41a into master Oct 17, 2024
26 checks passed
@sgraf812 sgraf812 deleted the wip/resumptive branch October 17, 2024 15:11
@Ericson2314
Copy link
Collaborator

The users guide made sense, that was the only part I read.

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.

happyExpToks table can be larger than happyTable
3 participants