From dc8acdc2bde05a2b83830b61f3ba371aba326a86 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 23 Jun 2026 19:03:47 +0200 Subject: [PATCH] Improved match statements --- crates/parser/src/grammar.pest | 2 +- mist-test/src/common/statement_test.mist | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/parser/src/grammar.pest b/crates/parser/src/grammar.pest index c254af8..719e55d 100644 --- a/crates/parser/src/grammar.pest +++ b/crates/parser/src/grammar.pest @@ -450,7 +450,7 @@ loop_stmt = { pattern_list = { pattern ~ ("|" ~ pattern)* } match_item = { - pattern_list ~ "=>" ~ statement + pattern_list ~ "=>" ~ (statement | (expr ~ ",")) } match_stmt = { diff --git a/mist-test/src/common/statement_test.mist b/mist-test/src/common/statement_test.mist index e403751..00ca939 100644 --- a/mist-test/src/common/statement_test.mist +++ b/mist-test/src/common/statement_test.mist @@ -109,8 +109,8 @@ pub void test_match_literal() { match x { 1 => { result = 10; } - 2 => { result = 20; } - 3 => { result = 30; } + 2 => result = 20; + 3 => result = 30, _ => panic!(); } assert_eq!(result, 20);