Skip to main content

CodegenVisitor

Struct CodegenVisitor 

Source
pub struct CodegenVisitor { /* private fields */ }
Expand description

Visitor that generates Rust code from ELO AST

Implementations§

Source§

impl CodegenVisitor

Source

pub fn new() -> Self

Create a new code generation visitor

Trait Implementations§

Source§

impl Debug for CodegenVisitor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenVisitor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Visitor<TokenStream> for CodegenVisitor

Source§

fn visit_expr(&mut self, expr: &Expr) -> TokenStream

Visit a generic expression, dispatching to specific methods
Source§

fn visit_literal(&mut self, lit: &Literal) -> TokenStream

Visit a literal value (number or boolean)
Source§

fn visit_null(&mut self) -> TokenStream

Visit a null literal
Source§

fn visit_identifier(&mut self, name: &str) -> TokenStream

Visit an identifier (variable reference)
Source§

fn visit_field_access(&mut self, receiver: &Expr, field: &str) -> TokenStream

Visit a field access expression
Source§

fn visit_binary_op( &mut self, op: BinaryOperator, left: &Expr, right: &Expr, ) -> TokenStream

Visit a binary operation
Source§

fn visit_unary_op(&mut self, op: UnaryOperator, operand: &Expr) -> TokenStream

Visit a unary operation
Source§

fn visit_function_call(&mut self, name: &str, args: &[Expr]) -> TokenStream

Visit a function call
Source§

fn visit_lambda(&mut self, param: &str, body: &Expr) -> TokenStream

Visit a lambda expression
Source§

fn visit_let(&mut self, name: &str, value: &Expr, body: &Expr) -> TokenStream

Visit a let binding
Source§

fn visit_if( &mut self, condition: &Expr, then_branch: &Expr, else_branch: &Expr, ) -> TokenStream

Visit an if conditional
Source§

fn visit_array(&mut self, elements: &[Expr]) -> TokenStream

Visit an array literal
Source§

fn visit_object(&mut self, fields: &[(String, Expr)]) -> TokenStream

Visit an object literal
Source§

fn visit_pipe(&mut self, value: &Expr, functions: &[Expr]) -> TokenStream

Visit a pipe operator
Source§

fn visit_alternative( &mut self, primary: &Expr, alternative: &Expr, ) -> TokenStream

Visit an alternative operator (?|)
Source§

fn visit_guard(&mut self, condition: &Expr, body: &Expr) -> TokenStream

Visit a guard expression
Source§

fn visit_date(&mut self, date: &str) -> TokenStream

Visit a date literal
Source§

fn visit_datetime(&mut self, datetime: &str) -> TokenStream

Visit a datetime literal
Source§

fn visit_duration(&mut self, duration: &str) -> TokenStream

Visit a duration literal
Source§

fn visit_temporal_keyword(&mut self, keyword: TemporalKeyword) -> TokenStream

Visit a temporal keyword
Source§

fn visit_string(&mut self, value: &str) -> TokenStream

Visit a string literal

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.