Attempts to add // math operator (#5759)

* attempts to add `div` math operator

* allows `//` to be used too

* fmt:

* clippy issue

* returns appropriate type

* returns appropriate type 2

* fmt

* ensure consistency; rename to `fdiv`

* Update parser.rs
This commit is contained in:
pwygab
2022-06-13 18:54:47 +08:00
committed by GitHub
parent 43a218240c
commit caafd26deb
9 changed files with 236 additions and 1 deletions

View File

@ -100,6 +100,7 @@ fn with_operator(
Operator::Multiply => apply_arithmetic(left, right, lhs_span, Mul::mul),
Operator::Divide => apply_arithmetic(left, right, lhs_span, Div::div),
Operator::Modulo => apply_arithmetic(left, right, lhs_span, Rem::rem),
Operator::FloorDivision => apply_arithmetic(left, right, lhs_span, Div::div),
Operator::Equal => Ok(left
.clone()
.apply_with_expr(right.clone(), Expr::eq)