match grammar

This commit is contained in:
2026-05-07 22:32:53 +02:00
parent dc49cddc20
commit f98b9d7514
2 changed files with 9 additions and 1 deletions
+7
View File
@@ -98,6 +98,7 @@ statement_list = { statement* }
statement = _{
expr_stmt
| match_stmt
| var_decl_statement
| assign_statement
| if_stmt
@@ -144,6 +145,12 @@ for_stmt = {
"for" ~ "(" ~ identifier ~ "in" ~ expr ~ ")" ~ statement
}
match_item = { pattern ~ "=>" ~ block }
match_stmt = {
"match" ~ "(" ~ expr ~ ")" ~ match_item*
}
// ================= EXPRESSIONS =================
tuple_type = { "(" ~ (type_expr ~ ("," ~ type_expr)*)? ~ ")" }
path_type = { static_path ~ ("<" ~ (type_expr ~ ("," ~ type_expr)*)? ~ ">")? }