Add element structure
parent
7c345c83ec
commit
83588964c3
@ -0,0 +1,59 @@
|
||||
use crate::elements::special::Expression;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Group {
|
||||
Parentheses(Parentheses),
|
||||
Brackets(Brackets),
|
||||
Braces(Braces),
|
||||
Angles(Angles),
|
||||
XGroup(XGroup),
|
||||
Abs(Abs),
|
||||
Floor(Floor),
|
||||
Ceil(Ceil),
|
||||
Norm(Norm),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Parentheses {
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Brackets {
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Braces {
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Angles {
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct XGroup {
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Abs {
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Floor {
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Ceil {
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Norm {
|
||||
inner: Box<Expression>,
|
||||
}
|
@ -1,5 +1,14 @@
|
||||
use crate::elements::group::Group;
|
||||
use crate::elements::literal::Literal;
|
||||
use crate::elements::special::Special;
|
||||
|
||||
pub mod group;
|
||||
pub mod literal;
|
||||
pub mod special;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Element {}
|
||||
pub enum Element {
|
||||
Literal(Literal),
|
||||
Special(Special),
|
||||
Group(Group),
|
||||
}
|
||||
|
@ -1,6 +1,65 @@
|
||||
use crate::elements::Element;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Root {
|
||||
pub struct Expression {
|
||||
children: Vec<Element>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Special {
|
||||
Sum(Sum),
|
||||
Prod(Prod),
|
||||
Frac(Frac),
|
||||
Exp(Exp),
|
||||
Sqrt(Sqrt),
|
||||
Root(Root),
|
||||
Integral(Integral),
|
||||
OIntegral(OIntegral),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Sum {
|
||||
top: Option<Expression>,
|
||||
bottom: Option<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Prod {
|
||||
top: Box<Expression>,
|
||||
bottom: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Frac {
|
||||
top: Box<Expression>,
|
||||
bottom: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Exp {
|
||||
base: Box<Element>,
|
||||
exp: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Sqrt {
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Root {
|
||||
base: Box<Expression>,
|
||||
inner: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Integral {
|
||||
top: Box<Expression>,
|
||||
bottom: Box<Expression>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct OIntegral {
|
||||
top: Box<Expression>,
|
||||
bottom: Box<Expression>,
|
||||
}
|
||||
|
Loading…
Reference in New Issue