pub enum Expr {
Show 20 variants
Number(f64, SourceLocation),
String(String, SourceLocation),
Regex(String, SourceLocation),
Var(String, SourceLocation),
Field(Box<Expr>, SourceLocation),
ArrayAccess {
array: String,
indices: Vec<Expr>,
location: SourceLocation,
},
Binary {
left: Box<Expr>,
op: BinaryOp,
right: Box<Expr>,
location: SourceLocation,
},
Unary {
op: UnaryOp,
operand: Box<Expr>,
location: SourceLocation,
},
Assign {
target: Box<Expr>,
op: AssignOp,
value: Box<Expr>,
location: SourceLocation,
},
PreIncrement(Box<Expr>, SourceLocation),
PreDecrement(Box<Expr>, SourceLocation),
PostIncrement(Box<Expr>, SourceLocation),
PostDecrement(Box<Expr>, SourceLocation),
Ternary {
condition: Box<Expr>,
then_expr: Box<Expr>,
else_expr: Box<Expr>,
location: SourceLocation,
},
Call {
name: String,
args: Vec<Expr>,
location: SourceLocation,
},
InArray {
key: Vec<Expr>,
array: String,
location: SourceLocation,
},
Match {
expr: Box<Expr>,
pattern: Box<Expr>,
negated: bool,
location: SourceLocation,
},
Concat(Vec<Expr>, SourceLocation),
Getline {
var: Option<String>,
input: Option<GetlineInput>,
location: SourceLocation,
},
Group(Box<Expr>, SourceLocation),
}Expand description
Expression types
Variants§
Number(f64, SourceLocation)
Numeric literal
String(String, SourceLocation)
String literal
Regex(String, SourceLocation)
Regex literal
Var(String, SourceLocation)
Variable reference
Field(Box<Expr>, SourceLocation)
Field access: $expr
ArrayAccess
Array access: arr[index] or arr[i,j]
Binary
Binary operation
Unary
Unary operation
Assign
Assignment
PreIncrement(Box<Expr>, SourceLocation)
Pre-increment: ++x
PreDecrement(Box<Expr>, SourceLocation)
Pre-decrement: –x
PostIncrement(Box<Expr>, SourceLocation)
Post-increment: x++
PostDecrement(Box<Expr>, SourceLocation)
Post-decrement: x–
Ternary
Ternary: cond ? then : else
Call
Function call
InArray
Array membership: (key) in array
Match
Regex match: expr ~ /regex/ or expr !~ /regex/
Concat(Vec<Expr>, SourceLocation)
Concatenation (implicit when expressions are adjacent)
Getline
Getline as expression (returns status)
Group(Box<Expr>, SourceLocation)
Grouping parentheses (for precedence)
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
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