Open
Description
edit @pokey:
As discussed in #579 (comment), we'd like to proceed as follows:
- Add
"subject"
scope type #1172 - Add
"branch"
scope type #1173 - Support
"name"
/"key"
/"condition"
for switch statements #1174 - Support
"value"
for switch statements #1175 - Support
"inside branch"
#1176
Original
There currently is no keyword for selecting alternatives in a match construct. Examples of match constructs are:
- Python
match x: case Alt1: exp1 … case AltN: expN
- Haskell
or
f = case x of Alt1 -> exp1 … AltN -> expN
f Alt1 = exp1 … f AltN = expN
We probably want three keywords:
matched
to select the value matched on, i.e.,x
;<ordinal> pattern
to select the i’th pattern, i.e.,Alt1
toAltN
above; and<ordinal> case
to select the i’th case, i.e.,exp1
toexpN
above.
Unmodified pattern
and case
should probably to the scopes relative to the named mark or cursor, i.e., pattern
refers to Alt1
if the mark or cursor is in either Alt1
or exp1
, and similarly for case
.