pub struct TolerantCompiler { /* private fields */ }Expand description
Tolerant compilation façade.
The compiler is stateless besides its RecoveryStrategy; each call to
Self::compile_program starts from a fresh CompilerContext unless
the caller uses Self::compile_program_with_contexts.
Implementations§
Source§impl TolerantCompiler
impl TolerantCompiler
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a tolerant compiler with RecoveryStrategy::SkipOnError.
Sourcepub fn with_strategy(strategy: RecoveryStrategy) -> Self
pub fn with_strategy(strategy: RecoveryStrategy) -> Self
Construct a tolerant compiler with a specific recovery strategy.
Sourcepub fn strategy(&self) -> RecoveryStrategy
pub fn strategy(&self) -> RecoveryStrategy
Configured recovery strategy.
Sourcepub fn set_strategy(&mut self, strategy: RecoveryStrategy)
pub fn set_strategy(&mut self, strategy: RecoveryStrategy)
Update the recovery strategy in place.
Sourcepub fn compile_program(&self, program: &[TLExpr]) -> PartialCompilationResult
pub fn compile_program(&self, program: &[TLExpr]) -> PartialCompilationResult
Compile a program (slice of expressions) under the current recovery
strategy using one fresh CompilerContext per expression so
failures do not poison the context for siblings.
Sourcepub fn compile_program_with<F>(
&self,
program: &[TLExpr],
make_ctx: F,
) -> PartialCompilationResult
pub fn compile_program_with<F>( &self, program: &[TLExpr], make_ctx: F, ) -> PartialCompilationResult
Compile a program, calling make_ctx once per expression to obtain a
fresh context. This lets callers share domain declarations across
expressions while still keeping each compilation isolated.
Sourcepub fn compile_program_with_contexts(
&self,
program: &[TLExpr],
contexts: &mut [CompilerContext],
) -> PartialCompilationResult
pub fn compile_program_with_contexts( &self, program: &[TLExpr], contexts: &mut [CompilerContext], ) -> PartialCompilationResult
Compile a program re-using a caller-supplied vector of contexts. Every context is used exactly once, matched by index to the expression slot.
The caller must provide contexts.len() >= program.len(); surplus
contexts are ignored.
Trait Implementations§
Source§impl Clone for TolerantCompiler
impl Clone for TolerantCompiler
Source§fn clone(&self) -> TolerantCompiler
fn clone(&self) -> TolerantCompiler
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more