statement body parsing
This commit is contained in:
@@ -343,6 +343,10 @@ statement = _{
|
||||
| (expr ~ semicolon)
|
||||
}
|
||||
|
||||
statement_wrapper = { statement }
|
||||
|
||||
statement_body = { statement_wrapper | expr }
|
||||
|
||||
// ------------------------------------------------------
|
||||
// BASIC STATEMENTS
|
||||
// ------------------------------------------------------
|
||||
@@ -384,7 +388,7 @@ control_flow = {
|
||||
| block
|
||||
}
|
||||
|
||||
statement_branch = { "(" ~ expr ~ ")" ~ statement }
|
||||
statement_branch = { "(" ~ expr ~ ")" ~ statement_body }
|
||||
|
||||
else_if = {
|
||||
"else" ~ "if" ~ statement_branch
|
||||
@@ -395,7 +399,7 @@ else_if_list = {
|
||||
}
|
||||
|
||||
if_stmt = {
|
||||
"if" ~ statement_branch ~ else_if_list ~ ("else" ~ statement)?
|
||||
"if" ~ statement_branch ~ else_if_list ~ ("else" ~ statement_body)?
|
||||
}
|
||||
|
||||
// ------------------------------------------------------
|
||||
@@ -407,15 +411,15 @@ while_stmt = {
|
||||
}
|
||||
|
||||
c_for_stmt = {
|
||||
"for" ~ "(" ~ statement ~ statement ~ expr ~ ")" ~ statement
|
||||
"for" ~ "(" ~ statement ~ statement ~ expr ~ ")" ~ statement_body
|
||||
}
|
||||
|
||||
for_stmt = {
|
||||
"for" ~ "(" ~ mutable? ~ pattern ~ ":" ~ expr ~ ")" ~ statement
|
||||
"for" ~ "(" ~ mutable? ~ pattern ~ ":" ~ expr ~ ")" ~ statement_body
|
||||
}
|
||||
|
||||
loop_stmt = {
|
||||
"loop" ~ statement
|
||||
"loop" ~ statement_body
|
||||
}
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user