Removed C style flow control

This commit is contained in:
2026-06-10 04:35:11 +02:00
parent 286894c5db
commit afd3d05e2f
10 changed files with 42 additions and 111 deletions
+6 -10
View File
@@ -357,10 +357,6 @@ statement = _{
| (expr ~ semicolon)
}
statement_wrapper = { statement }
statement_body = { statement_wrapper | expr }
// ------------------------------------------------------
// BASIC STATEMENTS
// ------------------------------------------------------
@@ -402,7 +398,7 @@ control_flow = {
| block
}
statement_branch = { "(" ~ expr ~ ")" ~ statement_body }
statement_branch = { expr ~ block }
else_if = _{
"else" ~ "if" ~ statement_branch
@@ -413,7 +409,7 @@ else_if_list = {
}
if_stmt = {
"if" ~ statement_branch ~ else_if_list ~ ("else" ~ statement_body)?
"if" ~ statement_branch ~ else_if_list ~ ("else" ~ block)?
}
// ------------------------------------------------------
@@ -425,15 +421,15 @@ while_stmt = {
}
c_for_stmt = {
"for" ~ "(" ~ statement ~ statement ~ expr ~ ")" ~ statement_body
"for" ~ "(" ~ statement ~ statement ~ expr ~ ")" ~ block
}
for_stmt = {
"for" ~ "(" ~ pattern ~ ":" ~ expr ~ ")" ~ statement_body
"for" ~ pattern ~ "in" ~ expr ~ block
}
loop_stmt = {
"loop" ~ statement_body
"loop" ~ block
}
// ------------------------------------------------------
@@ -447,7 +443,7 @@ match_item = {
}
match_stmt = {
"match" ~ "(" ~ expr ~ ")" ~ "{" ~ match_item* ~ "}"
"match" ~ expr ~ "{" ~ match_item* ~ "}"
}
// ======================================================