pub enum Expr<'src> {
    ForLoop {
        init: Box<Expr<'src>>,
        cond: Box<Expr<'src>>,
        inc: Box<Expr<'src>>,
        exec: Box<Expr<'src>>,
    },
    WhileLoop {
        condition: Box<Expr<'src>>,
        eval: Box<Expr<'src>>,
    },
    Conditional {
        condition: Box<Expr<'src>>,
        true_branch: Box<Expr<'src>>,
        else_branch: Option<Box<Expr<'src>>>,
    },
    Block(Vec<Expr<'src>>),
    Print(Box<Expr<'src>>),
    Variable(&'src str),
    Assignment(&'src str, Box<Expr<'src>>),
    Binary {
        op: BinaryOp,
        left: Box<Expr<'src>>,
        right: Box<Expr<'src>>,
    },
    Unary {
        op: UnaryOp,
        node: Box<Expr<'src>>,
    },
    Grouping(Box<Expr<'src>>),
    Literal(Literal<'src>),
}Expand description
A node in the abstract syntax tree, represents all possible operations that can occur
Variants§
ForLoop
A for loop
Fields
WhileLoop
A while loop
Fields
Conditional
A conditional executor
Fields
Block(Vec<Expr<'src>>)
A block to be executed
Print(Box<Expr<'src>>)
Print an expression’s literal result
Variable(&'src str)
A variable reference
Assignment(&'src str, Box<Expr<'src>>)
An assignment from an identifier to an expression
Binary
A binary operation between two expressions
Fields
Unary
A unary operation on a single expression
Grouping(Box<Expr<'src>>)
( expr )
Literal(Literal<'src>)
A literal
Trait Implementations§
impl<'src> StructuralPartialEq for Expr<'src>
Auto Trait Implementations§
impl<'src> Freeze for Expr<'src>
impl<'src> RefUnwindSafe for Expr<'src>
impl<'src> Send for Expr<'src>
impl<'src> Sync for Expr<'src>
impl<'src> Unpin for Expr<'src>
impl<'src> UnwindSafe for Expr<'src>
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