Enum netsblox_ast::ExprKind
source · pub enum ExprKind {
Show 97 variants
Value(Value),
Variable {
var: VariableRef,
},
Add {
values: VariadicInput,
},
Mul {
values: VariadicInput,
},
Min {
values: VariadicInput,
},
Max {
values: VariadicInput,
},
Sub {
left: Box<Expr>,
right: Box<Expr>,
},
Div {
left: Box<Expr>,
right: Box<Expr>,
},
Mod {
left: Box<Expr>,
right: Box<Expr>,
},
Pow {
base: Box<Expr>,
power: Box<Expr>,
},
Log {
value: Box<Expr>,
base: Box<Expr>,
},
Atan2 {
y: Box<Expr>,
x: Box<Expr>,
},
And {
left: Box<Expr>,
right: Box<Expr>,
},
Or {
left: Box<Expr>,
right: Box<Expr>,
},
Conditional {
condition: Box<Expr>,
then: Box<Expr>,
otherwise: Box<Expr>,
},
Identical {
left: Box<Expr>,
right: Box<Expr>,
},
Eq {
left: Box<Expr>,
right: Box<Expr>,
},
Neq {
left: Box<Expr>,
right: Box<Expr>,
},
Less {
left: Box<Expr>,
right: Box<Expr>,
},
LessEq {
left: Box<Expr>,
right: Box<Expr>,
},
Greater {
left: Box<Expr>,
right: Box<Expr>,
},
GreaterEq {
left: Box<Expr>,
right: Box<Expr>,
},
Random {
a: Box<Expr>,
b: Box<Expr>,
},
MakeListRange {
start: Box<Expr>,
stop: Box<Expr>,
},
MakeList {
values: VariadicInput,
},
MakeListConcat {
lists: VariadicInput,
},
ListLength {
value: Box<Expr>,
},
ListRank {
value: Box<Expr>,
},
ListDims {
value: Box<Expr>,
},
ListFlatten {
value: Box<Expr>,
},
ListColumns {
value: Box<Expr>,
},
ListRev {
value: Box<Expr>,
},
ListLines {
value: Box<Expr>,
},
ListCsv {
value: Box<Expr>,
},
ListJson {
value: Box<Expr>,
},
ListReshape {
value: Box<Expr>,
dims: VariadicInput,
},
ListCombinations {
sources: VariadicInput,
},
ListIsEmpty {
value: Box<Expr>,
},
ListCdr {
value: Box<Expr>,
},
ListCons {
item: Box<Expr>,
list: Box<Expr>,
},
ListFind {
list: Box<Expr>,
value: Box<Expr>,
},
ListContains {
list: Box<Expr>,
value: Box<Expr>,
},
ListGet {
list: Box<Expr>,
index: Box<Expr>,
},
ListLastIndex {
list: Box<Expr>,
},
ListGetRandom {
list: Box<Expr>,
},
Strcat {
values: VariadicInput,
},
Strlen {
value: Box<Expr>,
},
UnicodeToChar {
value: Box<Expr>,
},
CharToUnicode {
value: Box<Expr>,
},
Not {
value: Box<Expr>,
},
Neg {
value: Box<Expr>,
},
Abs {
value: Box<Expr>,
},
Sqrt {
value: Box<Expr>,
},
Floor {
value: Box<Expr>,
},
Ceil {
value: Box<Expr>,
},
Round {
value: Box<Expr>,
},
Sin {
value: Box<Expr>,
},
Cos {
value: Box<Expr>,
},
Tan {
value: Box<Expr>,
},
Asin {
value: Box<Expr>,
},
Acos {
value: Box<Expr>,
},
Atan {
value: Box<Expr>,
},
CallRpc {
service: String,
rpc: String,
args: Vec<(String, Expr)>,
},
CallFn {
function: FnRef,
args: Vec<Expr>,
},
StageWidth,
StageHeight,
MouseX,
MouseY,
Latitude,
Longitude,
YPos,
XPos,
Heading,
PenDown,
Scale,
IsVisible,
This,
Entity {
name: String,
trans_name: String,
},
ImageOfEntity {
entity: Box<Expr>,
},
ImageOfDrawings,
IsTouchingEntity {
entity: Box<Expr>,
},
IsTouchingMouse,
IsTouchingEdge,
IsTouchingDrawings,
RpcError,
Closure {
params: Vec<VariableDef>,
captures: Vec<VariableRef>,
stmts: Vec<Stmt>,
},
CallClosure {
closure: Box<Expr>,
args: Vec<Expr>,
},
TextSplit {
text: Box<Expr>,
mode: TextSplitMode,
},
Answer,
Timer,
Map {
f: Box<Expr>,
list: Box<Expr>,
},
Keep {
f: Box<Expr>,
list: Box<Expr>,
},
FindFirst {
f: Box<Expr>,
list: Box<Expr>,
},
Combine {
f: Box<Expr>,
list: Box<Expr>,
},
NetworkMessageReply {
target: Box<Expr>,
msg_type: String,
values: Vec<(String, Expr)>,
},
Syscall {
name: Box<Expr>,
args: VariadicInput,
},
SyscallError,
}Variants§
Value(Value)
Variable
Fields
var: VariableRefAdd
Fields
values: VariadicInputMul
Fields
values: VariadicInputMin
Fields
values: VariadicInputMax
Fields
values: VariadicInputSub
Div
Mod
Mathematical modulus (not remainder!). For instance, -1 mod 7 == 6.
Pow
Log
Atan2
And
Short-circuiting logical or.
Or
Short-circuiting logical and.
Conditional
Lazily-evaluated conditional expression. Returns then if condition is true, otherwise otherwise.
Identical
If both values are lists, returns true of they are references to the same list.
If both values are non-lists, returns true if the values are equal.
Otherwise returns false.
Eq
Neq
Less
LessEq
Greater
GreaterEq
Random
Get a random number between a and b (inclusive).
There are no ordering guarantees (swapping a and b is equivalent).
If both values are integers, the result is an integer, otherwise continuous floats are returned.
MakeListRange
Get a list of all the numbers starting at start and stepping towards stop (by +1 or -1), but not going past stop.
MakeList
Fields
values: VariadicInputMakeListConcat
Fields
lists: VariadicInputListLength
ListRank
ListDims
ListFlatten
ListColumns
ListRev
ListLines
ListCsv
ListJson
ListReshape
ListCombinations
Fields
sources: VariadicInputListIsEmpty
ListCdr
Given a list, returns a new (shallow copy) of all the items except the first. If the list is empty, an empty list is returned.
ListCons
Given a value and a list, returns a new list (shallow copy) with the item prepended.
ListFind
Returns the (1-based) index of value in the list, or 0 if not present.
ListContains
ListGet
ListLastIndex
ListGetRandom
Strcat
Fields
values: VariadicInputStrlen
String length in terms of unicode code points (not bytes or grapheme clusters!).
UnicodeToChar
Convert a unicode code point into a 1-character string.
CharToUnicode
Convert a 1-character string into its unicode code point.