pub struct Interpreter {
pub debug_breakpoint_check: Option<DebugBreakpointCheck>,
pub debug_breakpoint_handler: Option<DebugBreakpointHandler>,
/* private fields */
}Expand description
Pascal interpreter using modular architecture
Fields§
§debug_breakpoint_check: Option<DebugBreakpointCheck>§debug_breakpoint_handler: Option<DebugBreakpointHandler>Implementations§
Source§impl Interpreter
impl Interpreter
Sourcepub fn current_scope(&self) -> &Scope
pub fn current_scope(&self) -> &Scope
Get the current scope for testing purposes
Sourcepub fn get_variable_value(&self, name: &str) -> Option<Value>
pub fn get_variable_value(&self, name: &str) -> Option<Value>
Get a variable value for testing purposes
Sourcepub fn scope_count(&self) -> usize
pub fn scope_count(&self) -> usize
Number of active scopes (for leak analysis)
Sourcepub fn all_scope_variables(&self) -> Vec<(String, Value)>
pub fn all_scope_variables(&self) -> Vec<(String, Value)>
All variables across all scopes
Sourcepub fn load_uses_clause(&mut self, uses: &[String]) -> Result<()>
pub fn load_uses_clause(&mut self, uses: &[String]) -> Result<()>
Load uses clause units (simplified implementation)
Sourcepub fn declare_block_vars(&mut self, block: &Block) -> Result<()>
pub fn declare_block_vars(&mut self, block: &Block) -> Result<()>
Declare variables in a block
Sourcepub fn register_block_types(&mut self, block: &Block) -> Result<()>
pub fn register_block_types(&mut self, block: &Block) -> Result<()>
Register type declarations (enum constants and generic types) in a block
Sourcepub fn register_block_classes(&mut self, block: &Block) -> Result<()>
pub fn register_block_classes(&mut self, block: &Block) -> Result<()>
Register classes in a block
Sourcepub fn register_class(&mut self, class_decl: &ClassDecl) -> Result<()>
pub fn register_class(&mut self, class_decl: &ClassDecl) -> Result<()>
Register a single class (validates interfaces when registry knows them)
Sourcepub fn register_interface(&mut self, iface: InterfaceDecl)
pub fn register_interface(&mut self, iface: InterfaceDecl)
Register an interface declaration
Sourcepub fn register_operator_overload(&mut self, overload: OperatorOverload)
pub fn register_operator_overload(&mut self, overload: OperatorOverload)
Register a user-defined operator overload (the implementation is a function with the given name, already registered in the function table).
Sourcepub fn register_block_functions(&mut self, block: &Block) -> Result<()>
pub fn register_block_functions(&mut self, block: &Block) -> Result<()>
Register functions and procedures in a block
Sourcepub fn run_program(&mut self, program: &Program) -> Result<()>
pub fn run_program(&mut self, program: &Program) -> Result<()>
Execute a program
Sourcepub fn execute_stmt(&mut self, stmt: &Stmt) -> Result<()>
pub fn execute_stmt(&mut self, stmt: &Stmt) -> Result<()>
Execute a statement
Sourcepub fn eval_literal(&mut self, literal: &Literal) -> Result<Value>
pub fn eval_literal(&mut self, literal: &Literal) -> Result<Value>
Evaluate a literal value
Sourcepub fn call_function(&mut self, name: &str, args: &[Value]) -> Result<Value>
pub fn call_function(&mut self, name: &str, args: &[Value]) -> Result<Value>
Call a built-in or user function
Sourcepub fn call_procedure(&mut self, name: &str, args: &[Value]) -> Result<()>
pub fn call_procedure(&mut self, name: &str, args: &[Value]) -> Result<()>
Call a procedure (function that returns Nil)
Sourcepub fn execute_block_stmts(&mut self, statements: &[Stmt]) -> Result<()>
pub fn execute_block_stmts(&mut self, statements: &[Stmt]) -> Result<()>
Execute multiple statements (for blocks)
Sourcepub fn set_debug_mode(&mut self, debug: bool)
pub fn set_debug_mode(&mut self, debug: bool)
Enable debug mode
Sourcepub fn set_debug_breakpoint_check(&mut self, callback: DebugBreakpointCheck)
pub fn set_debug_breakpoint_check(&mut self, callback: DebugBreakpointCheck)
Set debug breakpoint callback
Sourcepub fn set_debug_breakpoint_handler(&mut self, handler: DebugBreakpointHandler)
pub fn set_debug_breakpoint_handler(&mut self, handler: DebugBreakpointHandler)
Set debug breakpoint handler
Auto Trait Implementations§
impl !RefUnwindSafe for Interpreter
impl !Send for Interpreter
impl !Sync for Interpreter
impl !UnwindSafe for Interpreter
impl Freeze for Interpreter
impl Unpin for Interpreter
impl UnsafeUnpin for Interpreter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more