pub enum Expr {
Show 22 variants Literal(LiteralType), Str(IStr), Num(f64), Var(IStr), Arr(Vec<LocExpr>), ArrComp(LocExprVec<CompSpec>), Obj(ObjBody), ObjExtend(LocExprObjBody), Parened(LocExpr), UnaryOp(UnaryOpTypeLocExpr), BinaryOp(LocExprBinaryOpTypeLocExpr), AssertExpr(AssertStmtLocExpr), LocalExpr(Vec<BindSpec>, LocExpr), Import(LocExpr), ImportStr(LocExpr), ImportBin(LocExpr), ErrorStmt(LocExpr), Apply(LocExprArgsDescbool), Index(LocExprLocExpr), Function(ParamsDescLocExpr), IfElse { cond: IfSpecData, cond_then: LocExpr, cond_else: Option<LocExpr>, }, Slice(LocExprSliceDesc),
}
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(LocExprVec<CompSpec>)

Array comprehension:

 ingredients: [
   { kind: kind, qty: 4 / 3 }
   for kind in [
     'Honey Syrup',
     'Lemon Juice',
     'Farmers Gin',
   ]
 ],
§

Obj(ObjBody)

Object: {a: 2}

§

ObjExtend(LocExprObjBody)

Object extension: var1 {b: 2}

§

Parened(LocExpr)

(obj)

§

UnaryOp(UnaryOpTypeLocExpr)

-2

§

BinaryOp(LocExprBinaryOpTypeLocExpr)

2 - 2

§

AssertExpr(AssertStmtLocExpr)

assert 2 == 2 : “Math is broken”

§

LocalExpr(Vec<BindSpec>, LocExpr)

local a = 2; { b: a }

§

Import(LocExpr)

import “hello”

§

ImportStr(LocExpr)

importStr “file.txt”

§

ImportBin(LocExpr)

importBin “file.txt”

§

ErrorStmt(LocExpr)

error “I’m broken”

§

Apply(LocExprArgsDescbool)

a(b, c)

§

Index(LocExprLocExpr)

a[b]

§

Function(ParamsDescLocExpr)

function(x) x

§

IfElse

Fields

§cond_then: LocExpr
§cond_else: Option<LocExpr>

if true == false then 1 else 2

§

Slice(LocExprSliceDesc)

Trait Implementations§

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Define how to visit values referred by this value. Read more
Whether this type should be tracked by the collector. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.