pub fn eval(pairs: Pairs<'_, Rule>, variable_map: &HashMap<&str, &str>) -> bool
Expand description
bool expression evaluation function given parsed expression and incoming variable HashMap bool expression evaluated and returns either true / false
use std::collections::HashMap;
use pest::Parser;
use bool_expr_parser::{eval, BoolExprParser, Rule};
let parsed = BoolExprParser::parse(Rule::main, "a=b and (c=d or e=f)").expect("Parse error");
let map = HashMap::from([("a", "b"), ("e", "f")]);
assert_eq!(eval(parsed, &map), true);