Struct jaq_interpret::ParseCtx
source · pub struct ParseCtx {
pub errs: Vec<Spanned<Error>>,
/* private fields */
}Expand description
Compile parsed to executable filters.
This allows to go from a parsed filter to a filter executable by this crate.
Fields§
§errs: Vec<Spanned<Error>>errors occurred during transformation
Implementations§
source§impl ParseCtx
impl ParseCtx
sourcepub fn new(vars: Vec<String>) -> Self
pub fn new(vars: Vec<String>) -> Self
Initialise new context with list of global variables.
When running a filter produced by this context, values corresponding to the variables have to be supplied in the execution context.
sourcepub fn insert_native(&mut self, name: String, arity: usize, f: Native)
pub fn insert_native(&mut self, name: String, arity: usize, f: Native)
Add a native filter with given name and arity.
sourcepub fn insert_natives<I>(&mut self, natives: I)where
I: IntoIterator<Item = (String, usize, Native)>,
pub fn insert_natives<I>(&mut self, natives: I)where I: IntoIterator<Item = (String, usize, Native)>,
Add native filters with given names and arities.
sourcepub fn insert_defs(&mut self, defs: impl IntoIterator<Item = Def>)
pub fn insert_defs(&mut self, defs: impl IntoIterator<Item = Def>)
Import parsed definitions, such as obtained from the standard library.
Errors that might occur include undefined variables, for example.
sourcepub fn root_def(&mut self, def: Def)
👎Deprecated since 1.1.0: use insert_defs instead
pub fn root_def(&mut self, def: Def)
insert_defs insteadInsert a root definition.
sourcepub fn root_filter(&mut self, filter: Spanned<Filter>)
👎Deprecated since 1.1.0: this call has no effect
pub fn root_filter(&mut self, filter: Spanned<Filter>)
Insert a root filter.
Auto Trait Implementations§
impl RefUnwindSafe for ParseCtx
impl Send for ParseCtx
impl Sync for ParseCtx
impl Unpin for ParseCtx
impl UnwindSafe for ParseCtx
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