Skip to content

Commit

Permalink
refactor: remove unused code #13
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 7, 2022
1 parent d97818e commit 65f9097
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions extensions/ext-computing/src/expr/parser.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use std::collections::BTreeMap;
use std::fmt::Error;

use pest::iterators::{Pair, Pairs};
use pest::Parser;
use pest::pratt_parser::*;

use crate::expr::ast::{BinaryOp, Expr, ExprPair, UnaryOp, Value, ValueIndex};
use crate::expr::token::Instruction;

#[derive(Parser)]
Expand All @@ -30,7 +29,7 @@ pub fn parse(input: &str, vars: &BTreeMap<String, Instruction>) -> f64 {
let expr = parse_expr(pairs.next().unwrap().into_inner());
namespace.eval(expr)
}
Err(err) => {
Err(_err) => {
f64::NAN
}
}
Expand Down Expand Up @@ -64,8 +63,6 @@ impl<'b> EvalNamespace<'b> {
}
}

const VALUE_INDEX: usize = 0;

fn parse_expr(pairs: Pairs<Rule>) -> Instruction {
PRATT_PARSER
.map_primary(|primary| {
Expand Down Expand Up @@ -147,8 +144,8 @@ mod tests {
assert_eq!(parse("1 + 2 * 3 + x + y", &map2), 10.0);
}

// #[test]
// fn function_sqrt() {
// assert_eq!(parse("sqrt(4)"), 2.0);
// }
#[test]
fn function_sqrt() {
assert_eq!(parse("sqrt(4)", &Default::default()), 2.0);
}
}

0 comments on commit 65f9097

Please sign in to comment.