Move function calling to separate source file.

This commit is contained in:
Stephen Chung
2020-07-23 18:40:42 +08:00
parent 1a48a2d8ba
commit bff266d4e1
13 changed files with 1203 additions and 1124 deletions

View File

@@ -1,4 +1,5 @@
//! Module containing implementation for custom syntax.
//! Module implementing custom syntax for `Engine`.
use crate::any::Dynamic;
use crate::engine::{Engine, Imports, State, MARKER_BLOCK, MARKER_EXPR, MARKER_IDENT};
use crate::error::{LexError, ParseError};
@@ -188,4 +189,26 @@ impl Engine {
Ok(self)
}
/// Evaluate an expression tree.
///
/// ## WARNING - Low Level API
///
/// This function is very low level. It evaluates an expression from an AST.
pub fn eval_expression_tree(
&self,
context: &mut EvalContext,
scope: &mut Scope,
expr: &Expression,
) -> Result<Dynamic, Box<EvalAltResult>> {
self.eval_expr(
scope,
context.mods,
context.state,
context.lib,
context.this_ptr,
expr.expr(),
context.level,
)
}
}