From 7623cc2f350c23dac0981879e5e4b45f609e3655 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Wed, 3 Aug 2022 00:26:06 +0400 Subject: [PATCH] Add guarded case for switches --- docs/sophia_syntax.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/sophia_syntax.md b/docs/sophia_syntax.md index a49eb0e..9a4b748 100644 --- a/docs/sophia_syntax.md +++ b/docs/sophia_syntax.md @@ -182,6 +182,10 @@ LetDef ::= Id Args [':' Type] '=' Block(Stmt) // Function definition | Pattern '=' Block(Stmt) // Value definition Case ::= Pattern '=>' Block(Stmt) + | Pattern Block(GuardedCase) + +GuardedCase ::= '|' Sep1(Expr, ',') '=>' Block(Stmt) + Pattern ::= Expr ```