pub struct ExpressionVisitor<'a, C, T = DefaultTypeSet> {
pub context: &'a mut C,
pub source: &'a str,
pub _marker: PhantomData<T>,
}Expand description
A visitor that can process an abstract syntax tree.
Fields§
§context: &'a mut CThe context in which the expression is evaluated.
source: &'a strThe source code from which the expression was parsed.
_marker: PhantomData<T>The types of the variables in the context.
Implementations§
Source§impl<'a, C, T> ExpressionVisitor<'a, C, T>where
C: ExprContext<T>,
T: TypeSet,
impl<'a, C, T> ExpressionVisitor<'a, C, T>where
C: ExprContext<T>,
T: TypeSet,
Sourcepub fn visit_expression(
&mut self,
expression: &Expression<T::Parser>,
) -> Result<TypedValue<T>, EvalError>
pub fn visit_expression( &mut self, expression: &Expression<T::Parser>, ) -> Result<TypedValue<T>, EvalError>
Visits an expression and evaluates it, returning the result as a TypedValue.
Sourcepub fn visit_right_hand_expression(
&mut self,
expression: &RightHandExpression<T::Parser>,
) -> Result<TypedValue<T>, EvalError>
pub fn visit_right_hand_expression( &mut self, expression: &RightHandExpression<T::Parser>, ) -> Result<TypedValue<T>, EvalError>
Visits an expression and evaluates it, returning the result as a TypedValue.
Sourcepub fn visit_function(
&mut self,
function: &Function<T::Parser>,
args: &[TypedValue<T>],
) -> Result<TypedValue<T>, EvalError>
pub fn visit_function( &mut self, function: &Function<T::Parser>, args: &[TypedValue<T>], ) -> Result<TypedValue<T>, EvalError>
Evaluates a function with the given arguments.
Auto Trait Implementations§
impl<'a, C, T> Freeze for ExpressionVisitor<'a, C, T>
impl<'a, C, T> RefUnwindSafe for ExpressionVisitor<'a, C, T>where
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, C, T> Send for ExpressionVisitor<'a, C, T>
impl<'a, C, T> Sync for ExpressionVisitor<'a, C, T>
impl<'a, C, T> Unpin for ExpressionVisitor<'a, C, T>where
T: Unpin,
impl<'a, C, T = DefaultTypeSet> !UnwindSafe for ExpressionVisitor<'a, C, T>
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