use crate::{errors::RunError, stack::StackVec}; pub fn expr(memory: &mut StackVec, arg: String) { for code in arg.chars() { match code { '>' => memory.push(0), '$' => { memory.pop(); }, ':' => { let data = memory.last().clone(); memory.push(data); }, '\\' => { let ax = memory.pop(); let ax2 = memory.pop(); memory.push(ax); memory.push(ax2); } '+' => { let ax = memory.pop(); memory.push(ax + 1); } '-' => { let ax = memory.pop(); memory.push(ax - 1); } _ => { eprintln!("{}", RunError::InvalidExpressionUnknownOperator(code.to_string())); std::process::exit(2); } } } }