pub enum Expr {
Show 22 variants
Literal(LiteralType),
Str(IStr),
Num(f64),
Var(IStr),
Arr(Vec<LocExpr>),
ArrComp(LocExpr, Vec<CompSpec>),
Obj(ObjBody),
ObjExtend(LocExpr, ObjBody),
Parened(LocExpr),
UnaryOp(UnaryOpType, LocExpr),
BinaryOp(LocExpr, BinaryOpType, LocExpr),
AssertExpr(AssertStmt, LocExpr),
LocalExpr(Vec<BindSpec>, LocExpr),
Import(PathBuf),
ImportStr(PathBuf),
ErrorStmt(LocExpr),
Apply(LocExpr, ArgsDesc, bool),
Index(LocExpr, LocExpr),
Function(ParamsDesc, LocExpr),
Intrinsic(IStr),
IfElse {
cond: IfSpecData,
cond_then: LocExpr,
cond_else: Option<LocExpr>,
},
Slice(LocExpr, SliceDesc),
}
Expand description
Syntax base
Variants§
Literal(LiteralType)
Str(IStr)
String value: “hello”
Num(f64)
Number: 1, 2.0, 2e+20
Var(IStr)
Variable name: test
Arr(Vec<LocExpr>)
Array of expressions: [1, 2, “Hello”]
ArrComp(LocExpr, Vec<CompSpec>)
Array comprehension:
ingredients: [
{ kind: kind, qty: 4 / 3 }
for kind in [
'Honey Syrup',
'Lemon Juice',
'Farmers Gin',
]
],
Obj(ObjBody)
Object: {a: 2}
ObjExtend(LocExpr, ObjBody)
Object extension: var1 {b: 2}
Parened(LocExpr)
(obj)
UnaryOp(UnaryOpType, LocExpr)
-2
BinaryOp(LocExpr, BinaryOpType, LocExpr)
2 - 2
AssertExpr(AssertStmt, LocExpr)
assert 2 == 2 : “Math is broken”
LocalExpr(Vec<BindSpec>, LocExpr)
local a = 2; { b: a }
Import(PathBuf)
import “hello”
ImportStr(PathBuf)
importStr “file.txt”
ErrorStmt(LocExpr)
error “I’m broken”
Apply(LocExpr, ArgsDesc, bool)
a(b, c)
Index(LocExpr, LocExpr)
a[b]
Function(ParamsDesc, LocExpr)
function(x) x
Intrinsic(IStr)
std.primitiveEquals
IfElse
if true == false then 1 else 2
Slice(LocExpr, SliceDesc)
Trait Implementations§
Source§impl Trace for Expr
impl Trace for Expr
Source§fn finalize_glue(&self)
fn finalize_glue(&self)
Runs Finalize::finalize() on this object and all
contained subobjects
impl StructuralPartialEq for Expr
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