pub struct Evaluator { /* private fields */ }Expand description
Implementations§
Source§impl Evaluator
impl Evaluator
Sourcepub fn with_grove(grove: Rc<dyn Grove>) -> Self
pub fn with_grove(grove: Rc<dyn Grove>) -> Self
Create a new evaluator with a grove
Sourcepub fn set_source_file(&mut self, file: String)
pub fn set_source_file(&mut self, file: String)
Set the current source file (for error reporting)
Sourcepub fn source_file(&self) -> Option<&str>
pub fn source_file(&self) -> Option<&str>
Get the current source file
Sourcepub fn set_position(&mut self, position: Position)
pub fn set_position(&mut self, position: Position)
Set the current position (for error reporting)
Sourcepub fn set_backend(&mut self, backend: Rc<RefCell<dyn FotBuilder>>)
pub fn set_backend(&mut self, backend: Rc<RefCell<dyn FotBuilder>>)
Set the backend
Sourcepub fn set_current_node(&mut self, node: Box<dyn Node>)
pub fn set_current_node(&mut self, node: Box<dyn Node>)
Set the current node
Sourcepub fn clear_current_node(&mut self)
pub fn clear_current_node(&mut self)
Clear the current node
Sourcepub fn process_root(&mut self, env: Gc<Environment>) -> EvalResult
pub fn process_root(&mut self, env: Gc<Environment>) -> EvalResult
Start DSSSL processing from the root node
Corresponds to OpenJade’s ProcessContext::process().
After template loading, this triggers automatic tree processing.
Sourcepub fn process_node(&mut self, env: Gc<Environment>) -> EvalResult
pub fn process_node(&mut self, env: Gc<Environment>) -> EvalResult
Process the current node
Corresponds to OpenJade’s ProcessContext::processNode().
§Algorithm (from OpenJade):
- If character data node, output directly
- If element node: a. Find matching construction rule by GI b. If rule found, evaluate it (returns sosofo) c. If no rule, default behavior: process-children
Sourcepub fn eval(&mut self, expr: Value, env: Gc<Environment>) -> EvalResult
pub fn eval(&mut self, expr: Value, env: Gc<Environment>) -> EvalResult
Evaluate an expression in an environment
Corresponds to OpenJade’s Interpreter::eval().
§Evaluation Rules
- Self-evaluating: Numbers, strings, bools, chars → return as-is
- Symbols: Variable lookup in environment
- Lists: Check first element for special forms, otherwise apply
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Evaluator
impl !RefUnwindSafe for Evaluator
impl !Send for Evaluator
impl !Sync for Evaluator
impl Unpin for Evaluator
impl !UnwindSafe for Evaluator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more