Implement function to build operator tree

This commit is contained in:
Sebastian Schmidt 2019-03-18 19:25:43 +02:00
parent 879f1fcd22
commit d2336cb59d

View File

@ -11,6 +11,7 @@ mod value;
pub use configuration::{Configuration, EmptyConfiguration, HashMapConfiguration};
pub use error::Error;
pub use function::Function;
pub use tree::Node;
pub use value::Value;
pub fn eval(string: &str) -> Result<Value, Error> {
@ -24,6 +25,10 @@ pub fn eval_with_configuration(
tree::tokens_to_operator_tree(token::tokenize(string)?)?.eval(configuration)
}
pub fn build_operator_tree(string: &str) -> Result<Node, Error> {
tree::tokens_to_operator_tree(token::tokenize(string)?)
}
#[cfg(test)]
mod test {
use crate::{eval, value::Value};