Init
This commit is contained in:
28
src/model/script.rs
Normal file
28
src/model/script.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use super::forth::Forth;
|
||||
|
||||
pub use super::forth::{ExecutionTrace, Rng, SourceSpan, StepContext, Variables};
|
||||
|
||||
pub struct ScriptEngine {
|
||||
forth: Forth,
|
||||
}
|
||||
|
||||
impl ScriptEngine {
|
||||
pub fn new(vars: Variables, rng: Rng) -> Self {
|
||||
Self {
|
||||
forth: Forth::new(vars, rng),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn evaluate(&self, script: &str, ctx: &StepContext) -> Result<Vec<String>, String> {
|
||||
self.forth.evaluate(script, ctx)
|
||||
}
|
||||
|
||||
pub fn evaluate_with_trace(
|
||||
&self,
|
||||
script: &str,
|
||||
ctx: &StepContext,
|
||||
trace: &mut ExecutionTrace,
|
||||
) -> Result<Vec<String>, String> {
|
||||
self.forth.evaluate_with_trace(script, ctx, trace)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user