Parser tweak
parent
6f9ab43fff
commit
f9f28a54d7
|
@ -93,7 +93,8 @@ impl TreeElement {
|
||||||
pub fn evaluate(&self) -> Option<f32> {
|
pub fn evaluate(&self) -> Option<f32> {
|
||||||
match self {
|
match self {
|
||||||
Self::Number(x) => Some(*x),
|
Self::Number(x) => Some(*x),
|
||||||
Self::Partial(_) => None,
|
// Try to parse strings of a partial
|
||||||
|
Self::Partial(s) => s.parse().ok(),
|
||||||
Self::Add { l, r } => {
|
Self::Add { l, r } => {
|
||||||
let l = l.evaluate();
|
let l = l.evaluate();
|
||||||
let r = r.evaluate();
|
let r = r.evaluate();
|
||||||
|
|
Loading…
Reference in New Issue