pub enum Expr<'a> {
Show 17 variants
Index {
item: Box<Expr<'a>>,
index: Box<Expr<'a>>,
},
ForLoop {
init: Box<Expr<'a>>,
check: Box<Expr<'a>>,
update: Box<Expr<'a>>,
exec: Box<Expr<'a>>,
},
WhileLoop {
condition: Box<Expr<'a>>,
exec: Box<Expr<'a>>,
},
Conditional {
condition: Box<Expr<'a>>,
true_branch: Box<Expr<'a>>,
else_branch: Option<Box<Expr<'a>>>,
},
Block(Vec<Expr<'a>>),
Literal(Literal<'a>),
List(Vec<Expr<'a>>),
Variable(&'a str),
Unary {
op: UnaryOperator,
node: Box<Expr<'a>>,
},
Roar(Box<Expr<'a>>),
Print(Box<Expr<'a>>),
Reassignment {
name: &'a str,
val: Box<Expr<'a>>,
},
Inc(&'a str, bool),
AddAssign {
name: &'a str,
add: Box<Expr<'a>>,
},
Assignment {
name: &'a str,
val: Box<Expr<'a>>,
},
Binary {
op: BinaryOperator,
left: Box<Expr<'a>>,
right: Box<Expr<'a>>,
},
Grouping(Box<Expr<'a>>),
}Expand description
An expression node in the AST
Variants§
Index
Indexing into a literal
ForLoop
A for style loop that performs some initialization and repeatedly checks a certain equality statement until it is true
Fields
WhileLoop
A while style loop that will repeat until the inner condition is false
Fields
Conditional
A conditional executor
Fields
Block(Vec<Expr<'a>>)
A block to be executed
Literal(Literal<'a>)
A literal
List(Vec<Expr<'a>>)
A list of expressions that boils down to a list of literals
Variable(&'a str)
A variable
Unary
Unary operation
Roar(Box<Expr<'a>>)
Roar the expressions result to stdout
Print(Box<Expr<'a>>)
Print the expressions result to stdout
Reassignment
Assignment operator for an existing variable, fails if variable does not exist
Inc(&'a str, bool)
Increment a variable, true if return before and false if return after inc
AddAssign
Add a value to a variable
Assignment
Assignment operator
Binary
Binary operation
Fields
§
op: BinaryOperatorOperator
Grouping(Box<Expr<'a>>)
A grouping ()
Trait Implementations§
impl<'a> StructuralPartialEq for Expr<'a>
Auto Trait Implementations§
impl<'a> Freeze for Expr<'a>
impl<'a> RefUnwindSafe for Expr<'a>
impl<'a> Send for Expr<'a>
impl<'a> Sync for Expr<'a>
impl<'a> Unpin for Expr<'a>
impl<'a> UnsafeUnpin for Expr<'a>
impl<'a> UnwindSafe for Expr<'a>
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