Skip to main content

evaluate

Function evaluate 

Source
pub fn evaluate(
    ast: &AstNode,
    vars: &mut dyn FnMut(&str) -> Result<Value, EvalError>,
    mode: EvalMode,
) -> Result<Value, EvalError>
Expand description

Evaluate an AstNode using the provided variable resolver.

The resolver receives variable identifiers and must return their value. An identifier the resolver rejects with EvalError::UnknownVariable is retried against the built-in constants before the error is propagated, so a declared <pVariable> always shadows a same-named constant.