hmm
This commit is contained in:
parent
0c30f0022d
commit
d7795e52f9
10 changed files with 276 additions and 31 deletions
19
src/ast/op.rs
Normal file
19
src/ast/op.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#[derive(Debug, Clone)]
|
||||
pub enum Op {
|
||||
Add,
|
||||
Subtract,
|
||||
Multiply,
|
||||
Divide,
|
||||
}
|
||||
|
||||
impl Op {
|
||||
pub fn eval(&self) -> String {
|
||||
let text: &str = match self {
|
||||
Op::Add => "+",
|
||||
Op::Subtract => "-",
|
||||
Op::Multiply => "*",
|
||||
Op::Divide => "/",
|
||||
};
|
||||
text.to_string()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue