Skip to content

Commit 4b79524

Browse files
committed
Spec: Syntax changes to match.
1 parent 77a9910 commit 4b79524

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

docs/_spec/06-expressions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ Expr1 ::= ‘if’ ‘(’ Expr ‘)’ {nl} Expr [[semi] ‘else’ Exp
1919
| SimpleExpr1 ArgumentExprs ‘=’ Expr
2020
| PostfixExpr
2121
| PostfixExpr Ascription
22-
| PostfixExpr ‘match’ ‘{’ CaseClauses ‘}’
2322
PostfixExpr ::= InfixExpr [id [nl]]
2423
InfixExpr ::= PrefixExpr
2524
| InfixExpr id [nl] InfixExpr
25+
| InfixExpr MatchClause
2626
PrefixExpr ::= [‘-’ | ‘+’ | ‘~’ | ‘!’] SimpleExpr
2727
SimpleExpr ::= ‘new’ (ClassTemplate | TemplateBody)
2828
| BlockExpr
29+
| SimpleExpr ‘.’ MatchClause
2930
| SimpleExpr1 [‘_’]
3031
SimpleExpr1 ::= Literal
3132
| Path
@@ -36,6 +37,7 @@ SimpleExpr1 ::= Literal
3637
| SimpleExpr1 ArgumentExprs
3738
| XmlExpr
3839
Exprs ::= Expr {‘,’ Expr}
40+
MatchClause ::= ‘match’ ‘{’ CaseClauses ‘}’
3941
BlockExpr ::= ‘{’ CaseClauses ‘}’
4042
| ‘{’ Block ‘}’
4143
Block ::= BlockStat {semi BlockStat} [ResultExpr]

docs/_spec/08-pattern-matching.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ Therefore, the right hand side of the case clause, `y.n`, of type `Int`, is foun
484484
## Pattern Matching Expressions
485485

486486
```ebnf
487+
InfixExpr ::= InfixExpr MatchClause
488+
SimpleExpr ::= SimpleExpr ‘.’ MatchClause
487489
Expr ::= PostfixExpr ‘match’ ‘{’ CaseClauses ‘}’
488490
CaseClauses ::= CaseClause {CaseClause}
489491
CaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Block

0 commit comments

Comments
 (0)