Fix prefix-expr bug

This commit is contained in:
Greg Shuflin 2021-11-05 02:46:58 -07:00
parent 76b1e9c0dc
commit 4f3ef5c850
2 changed files with 2 additions and 3 deletions

View File

@ -34,7 +34,7 @@ peg::parser! {
}
rule precedence_continuation() -> (&'input str, ExpressionKind) =
op:operator() _ expr:primary() _ { (op, expr) }
op:operator() _ expr:prefix_expr() _ { (op, expr) }
rule prefix_expr() -> ExpressionKind =
prefix:prefix()? expr:extended_expr() {

View File

@ -225,8 +225,7 @@ fn prefix_exps() {
assert_expr2!("-0.2", prefixop("-", expr(FloatLiteral(0.2))));
assert_expr2!("!3", prefixop("!", expr(NatLiteral(3))));
assert_expr2!("!t", prefixop("!", expr(Value(qn!(t)))));
//TODO fix
//assert_expr2!("a <- -b", binop("<-", expr(Value(qn!(a))), prefixop("-", expr(Value(qn!(b))))));
assert_expr2!("a <- -b", binop("<-", expr(Value(qn!(a))), prefixop("-", expr(Value(qn!(b))))));
assert_expr2!("a <--b", binop("<--", expr(Value(qn!(a))), expr(Value(qn!(b)))));
}