|
|
@ -1,6 +1,10 @@
|
|
|
|
use crate::parser::OwnedLiteral;
|
|
|
|
use crate::parser::OwnedLiteral;
|
|
|
|
use std::convert::TryInto;
|
|
|
|
use std::convert::TryInto;
|
|
|
|
use std::ops::Add;
|
|
|
|
use std::ops::Add;
|
|
|
|
|
|
|
|
use std::ops::Div;
|
|
|
|
|
|
|
|
use std::ops::Mul;
|
|
|
|
|
|
|
|
use std::ops::Rem;
|
|
|
|
|
|
|
|
use std::ops::Sub;
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum MathNumber {
|
|
|
|
pub enum MathNumber {
|
|
|
@ -44,6 +48,50 @@ impl Add<MathNumber> for MathNumber {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Sub<MathNumber> for MathNumber {
|
|
|
|
|
|
|
|
type Output = Option<OwnedLiteral>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn sub(self, other: MathNumber) -> Self::Output {
|
|
|
|
|
|
|
|
todo!()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Mul<MathNumber> for MathNumber {
|
|
|
|
|
|
|
|
type Output = Option<OwnedLiteral>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn mul(self, other: MathNumber) -> Self::Output {
|
|
|
|
|
|
|
|
todo!()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Div<MathNumber> for MathNumber {
|
|
|
|
|
|
|
|
type Output = Option<OwnedLiteral>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn div(self, other: MathNumber) -> Self::Output {
|
|
|
|
|
|
|
|
todo!()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Rem<MathNumber> for MathNumber {
|
|
|
|
|
|
|
|
type Output = Option<OwnedLiteral>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn rem(self, other: MathNumber) -> Self::Output {
|
|
|
|
|
|
|
|
todo!()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl MathNumber {
|
|
|
|
|
|
|
|
fn math_abs(&self) -> Option<OwnedLiteral> {
|
|
|
|
|
|
|
|
todo!()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn math_floor(&self) -> Option<OwnedLiteral> {
|
|
|
|
|
|
|
|
todo!()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn math_ceil(&self) -> Option<OwnedLiteral> {
|
|
|
|
|
|
|
|
todo!()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// For math operations that take in integers and return integers
|
|
|
|
/// For math operations that take in integers and return integers
|
|
|
|
/// (add, subtract, multiply)
|
|
|
|
/// (add, subtract, multiply)
|
|
|
|
pub fn math_ints<L, R, F>(left: L, right: R, operation: F) -> Option<OwnedLiteral>
|
|
|
|
pub fn math_ints<L, R, F>(left: L, right: R, operation: F) -> Option<OwnedLiteral>
|
|
|
|