Enum netsblox_ast::Expr
source · [−]pub enum Expr {
Show 79 variants
Value(Value),
Variable {
var: VariableRef,
comment: Option<String>,
},
Add {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Sub {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Mul {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Div {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Mod {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Pow {
base: Box<Expr>,
power: Box<Expr>,
comment: Option<String>,
},
Log {
value: Box<Expr>,
base: Box<Expr>,
comment: Option<String>,
},
And {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Or {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Conditional {
condition: Box<Expr>,
then: Box<Expr>,
otherwise: Box<Expr>,
comment: Option<String>,
},
Identical {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Eq {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Less {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
Greater {
left: Box<Expr>,
right: Box<Expr>,
comment: Option<String>,
},
RandInclusive {
a: Box<Expr>,
b: Box<Expr>,
comment: Option<String>,
},
RangeInclusive {
start: Box<Expr>,
stop: Box<Expr>,
comment: Option<String>,
},
MakeList {
values: Vec<Expr>,
comment: Option<String>,
},
Listcat {
lists: Vec<Expr>,
comment: Option<String>,
},
Listlen {
value: Box<Expr>,
comment: Option<String>,
},
ListIsEmpty {
value: Box<Expr>,
comment: Option<String>,
},
ListAllButFirst {
value: Box<Expr>,
comment: Option<String>,
},
ListItemInFrontOf {
item: Box<Expr>,
list: Box<Expr>,
comment: Option<String>,
},
ListFind {
list: Box<Expr>,
value: Box<Expr>,
comment: Option<String>,
},
ListContains {
list: Box<Expr>,
value: Box<Expr>,
comment: Option<String>,
},
ListIndex {
list: Box<Expr>,
index: Box<Expr>,
comment: Option<String>,
},
ListRandIndex {
list: Box<Expr>,
comment: Option<String>,
},
ListLastIndex {
list: Box<Expr>,
comment: Option<String>,
},
Strcat {
values: Vec<Expr>,
comment: Option<String>,
},
Strlen {
value: Box<Expr>,
comment: Option<String>,
},
UnicodeToChar {
value: Box<Expr>,
comment: Option<String>,
},
CharToUnicode {
value: Box<Expr>,
comment: Option<String>,
},
Not {
value: Box<Expr>,
comment: Option<String>,
},
Neg {
value: Box<Expr>,
comment: Option<String>,
},
Abs {
value: Box<Expr>,
comment: Option<String>,
},
Sqrt {
value: Box<Expr>,
comment: Option<String>,
},
Floor {
value: Box<Expr>,
comment: Option<String>,
},
Ceil {
value: Box<Expr>,
comment: Option<String>,
},
Round {
value: Box<Expr>,
comment: Option<String>,
},
Sin {
value: Box<Expr>,
comment: Option<String>,
},
Cos {
value: Box<Expr>,
comment: Option<String>,
},
Tan {
value: Box<Expr>,
comment: Option<String>,
},
Asin {
value: Box<Expr>,
comment: Option<String>,
},
Acos {
value: Box<Expr>,
comment: Option<String>,
},
Atan {
value: Box<Expr>,
comment: Option<String>,
},
CallRpc {
service: String,
rpc: String,
args: Vec<(String, Expr)>,
comment: Option<String>,
},
CallFn {
function: FnRef,
args: Vec<Expr>,
comment: Option<String>,
},
StageWidth {
comment: Option<String>,
},
StageHeight {
comment: Option<String>,
},
MouseX {
comment: Option<String>,
},
MouseY {
comment: Option<String>,
},
Latitude {
comment: Option<String>,
},
Longitude {
comment: Option<String>,
},
YPos {
comment: Option<String>,
},
XPos {
comment: Option<String>,
},
Heading {
comment: Option<String>,
},
PenDown {
comment: Option<String>,
},
Scale {
comment: Option<String>,
},
IsVisible {
comment: Option<String>,
},
This {
comment: Option<String>,
},
Entity {
name: String,
trans_name: String,
comment: Option<String>,
},
ImageOfEntity {
entity: Box<Expr>,
comment: Option<String>,
},
ImageOfDrawings {
comment: Option<String>,
},
IsTouchingEntity {
entity: Box<Expr>,
comment: Option<String>,
},
IsTouchingMouse {
comment: Option<String>,
},
IsTouchingEdge {
comment: Option<String>,
},
IsTouchingDrawings {
comment: Option<String>,
},
RpcError {
comment: Option<String>,
},
Closure {
params: Vec<VariableDef>,
captures: Vec<VariableRef>,
stmts: Vec<Stmt>,
comment: Option<String>,
},
CallClosure {
closure: Box<Expr>,
args: Vec<Expr>,
comment: Option<String>,
},
TextSplit {
text: Box<Expr>,
mode: TextSplitMode,
comment: Option<String>,
},
Answer {
comment: Option<String>,
},
Timer {
comment: Option<String>,
},
Map {
f: Box<Expr>,
list: Box<Expr>,
comment: Option<String>,
},
Keep {
f: Box<Expr>,
list: Box<Expr>,
comment: Option<String>,
},
FindFirst {
f: Box<Expr>,
list: Box<Expr>,
comment: Option<String>,
},
Combine {
f: Box<Expr>,
list: Box<Expr>,
comment: Option<String>,
},
NetworkMessageReply {
target: Box<Expr>,
msg_type: String,
values: Vec<(String, Expr)>,
comment: Option<String>,
},
}Variants
Value(Value)
Variable
Add
Sub
Mul
Div
Mod
Mathematical modulus (not remainder!). For instance, -1 mod 7 == 6.
Pow
Log
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
Less
Greater
RandInclusive
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.
RangeInclusive
Get a list of all the numbers starting at start and stepping towards stop (by +1 or -1), but not going past stop.
MakeList
Listcat
Listlen
ListIsEmpty
ListAllButFirst
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.
ListItemInFrontOf
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
ListIndex
ListRandIndex
ListLastIndex
Strcat
Strlen
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.
Not
Neg
Abs
Sqrt
Floor
Ceil
Round
Sin
Cos
Tan
Asin
Acos
Atan
CallRpc
CallFn
StageWidth
StageHeight
MouseX
MouseY
Latitude
Longitude
YPos
XPos
Heading
PenDown
Scale
IsVisible
This
Entity
ImageOfEntity
ImageOfDrawings
IsTouchingEntity
IsTouchingMouse
IsTouchingEdge
IsTouchingDrawings
RpcError
Closure
CallClosure
TextSplit
Answer
Timer
Map
Keep
FindFirst
Combine
NetworkMessageReply
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more