pub enum Undef {
UnaryOperation {
op: &'static str,
val: Box<Value>,
pos: usize,
},
BinaryOperation {
op: &'static str,
lhv: Box<Value>,
rhv: Box<Value>,
pos: usize,
},
Termination {
expected: char,
pos: usize,
},
Token {
token: String,
pos: usize,
},
Name {
pos: usize,
},
Value(Box<Value>),
}Expand description
Why a value is undefined: the payload of Value::Undefined.
Positions (pos) are byte offsets in the evaluated source. Built-in
functions use position 0. Two Undefs are equal when they have the same
variant and contents, regardless of position.
The Swan built-in undef.inspect exposes these fields to Swan code.
Variants§
UnaryOperation
The result of a unary operation that is not defined for the operand type.
Fields
BinaryOperation
The result of a binary operation that is not defined for the operand types.
Fields
Termination
Syntax error: a group (...), [...] or {...} without its closing
bracket.
Fields
Token
Syntax error: a token that is not valid where it appears.
Name
A name was expected (left of =, : or ->, or after $), but
another expression was found.
Value(Box<Value>)
An undefined value created explicitly, for example by the Swan
built-in undef.from. It wraps an arbitrary value.