Implement function to build operator tree
This commit is contained in:
parent
879f1fcd22
commit
d2336cb59d
@ -11,6 +11,7 @@ mod value;
|
|||||||
pub use configuration::{Configuration, EmptyConfiguration, HashMapConfiguration};
|
pub use configuration::{Configuration, EmptyConfiguration, HashMapConfiguration};
|
||||||
pub use error::Error;
|
pub use error::Error;
|
||||||
pub use function::Function;
|
pub use function::Function;
|
||||||
|
pub use tree::Node;
|
||||||
pub use value::Value;
|
pub use value::Value;
|
||||||
|
|
||||||
pub fn eval(string: &str) -> Result<Value, Error> {
|
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)
|
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)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::{eval, value::Value};
|
use crate::{eval, value::Value};
|
||||||
|
Loading…
Reference in New Issue
Block a user