haskell / happy

The Happy parser generator for Haskell
Other
291 stars 84 forks source link

Auto-resolve shift/reduce conflicts involving the catch token #327

Closed sgraf812 closed 2 weeks ago

sgraf812 commented 2 weeks ago

When the current token is the catch token, we never reduce; we only ever shift (see the user's guide for how catch works). More precisely, the mechanism considers multiple situations in which the catch token can be shifted in parallel, including situations that are reachable via reductions. Hence it does not make sense to report shift/reduce conflicts involving the catch token: Error resumption mode will only ever try to shift it.

The solution implemented in this patch is not to generate conflicting LR'Reduce actions in the first place by deleting the catch token from the lookahead sets of LR1 items.