summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crates/rebel-parse/src/grammar/recipe.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/rebel-parse/src/grammar/recipe.rs b/crates/rebel-parse/src/grammar/recipe.rs
index fedc8a8..5d308e0 100644
--- a/crates/rebel-parse/src/grammar/recipe.rs
+++ b/crates/rebel-parse/src/grammar/recipe.rs
@@ -27,24 +27,24 @@ peg::parser! {
= body:body_stmt() ++ p(';') { ast::Body(body) }
pub rule body_stmt() -> ast::BodyStmt<'a>
- = dest:typed_expr() p2('=', '+') expr:expr() {
- ast::BodyStmt::assign(dest, Some(Add), true, expr)
- }
- / dest:typed_expr() op:assign_op() expr:expr() {
+ = dest:typed_expr() op:assign_op() expr:expr() {
ast::BodyStmt::assign(dest, op, false, expr)
}
+ / dest:typed_expr() p2('=', '+') expr:expr() {
+ ast::BodyStmt::assign(dest, Some(Add), true, expr)
+ }
/ expr:expr() {
ast::BodyStmt::Expr { expr: Box::new(expr) }
}
/ { ast::BodyStmt::Empty }
rule assign_op() -> Option<ast::OpBinary>
- = p2('+', '=') { Some(Add) }
+ = p('=') { None }
+ / p2('+', '=') { Some(Add) }
/ p2('-', '=') { Some(Sub) }
/ p2('*', '=') { Some(Mul) }
/ p2('/', '=') { Some(Div) }
/ p2('%', '=') { Some(Rem) }
- / p('=') { None }
rule typed_expr() -> ast::TypedExpr<'a>
= expr:expr() typ:tagged(<p(':')>, <expr()>)? { ast::TypedExpr { expr, typ } }