-
Notifications
You must be signed in to change notification settings - Fork 571
Closed
Milestone
Description
Summary
The parser has a couple of ad-hoc cases in the parser that should not be necessary.
purescript/lib/purescript-cst/src/Language/PureScript/CST/Parser.y
Lines 404 to 411 in e56d28b
| -- These special cases handle some idiosynchratic syntax that the current | |
| -- parser allows. Technically the parser allows the rhs of a case branch to be | |
| -- at any level, but this is ambiguous. We allow it in the case of a singleton | |
| -- case, since this is used in the wild. | |
| | 'case' sep(expr, ',') 'of' '\{' sep(binder1, ',') '->' '\}' exprWhere | |
| { ExprCase () (CaseOf $1 $2 $3 (pure ($5, Unconditional $6 $8))) } | |
| | 'case' sep(expr, ',') 'of' '\{' sep(binder1, ',') '\}' guardedCase | |
| { ExprCase () (CaseOf $1 $2 $3 (pure ($5, $7))) } |
Motivation
I originally added these cases to keep some core modules compiling that use extremely odd formatting for single-branch cases. Normally these would run afoul the offside rule, but the old parser accepted them due to various idiosyncrasies.
Proposal
We should remove these cases in 0.15 and update the core libraries. We can warn in a followup 0.14 release.
kritzcreek, thomashoneyman, f-f, hdgarrood, schneiderfelipe and 1 more