Add stubs for MathNumber.

This commit is contained in:
Tom Alexander
2020-06-13 22:23:40 -04:00
parent d8b8c223f0
commit 0a2e1b007c
2 changed files with 84 additions and 0 deletions

View File

@@ -1,6 +1,10 @@
use crate::parser::OwnedLiteral;
use std::convert::TryInto;
use std::ops::Add;
use std::ops::Div;
use std::ops::Mul;
use std::ops::Rem;
use std::ops::Sub;
#[derive(Debug)]
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
/// (add, subtract, multiply)
pub fn math_ints<L, R, F>(left: L, right: R, operation: F) -> Option<OwnedLiteral>