#[non_exhaustive]pub enum LsbOp {
Show 15 variants
Concat,
Len,
Truthy,
Not,
TypeOf,
Iter,
IterNext,
Resume,
ResumeThrow,
CoroClose,
CoroKey,
CoroResult,
CoroStatus,
ErrCode,
ErrPayload,
}Expand description
An LSB instruction sequence with LSB’s own semantics, hooks included (LSB §5.6–§5.10). These are the 0.2 built-in intrinsics.
§Examples
use bcgen_lang::{Arity, LsbOp};
assert_eq!(LsbOp::Concat.arity(), Arity::exact(2));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Concat
dconcat: two strings concatenated; other kinds go to the concat
hook, else TypeError.
Len
dlen, as a dynamic int: string bytes or collection entries; else
the len hook.
Truthy
dtruthy, as a dynamic bool (the truthy hook for non-scalars).
Not
dnot, as a dynamic bool: the negated truthiness.
TypeOf
type_of, as a dynamic int: the LSB kind code (LSB §2.2).
Iter
diter_new (after a copy-on-write dup under PHP arrays, so the
loop iterates a snapshot): an iterator over a collection or
coroutine.
IterNext
One iter_next: nil when the iterator is done, else the pair
[key, value] as a new array.
Resume
resume coro, value: the value the coroutine (operand 1) yields,
awaits, or returns next, after resuming it with operand 2 (PHP
Generator::send, Python send).
ResumeThrow
resume_throw coro, error: as Resume, raising
operand 2 at the suspension point (PHP Generator::throw).
CoroClose
coro_close coro, signal: closes the coroutine, running its pending
finally blocks (LSB §5.13 rule 11).
CoroKey
coro_key: the key of the value most recently yielded (PHP
Generator::key).
CoroResult
coro_result: a returned coroutine’s return value (PHP
Generator::getReturn).
CoroStatus
coro_status, as a dynamic int (0 created, 1 running, 2 yielded,
3 awaiting, 4 returned, 5 failed).
ErrCode
err_code, as a dynamic int: the code of a caught runtime error
value (200 for NoMatch), else 0.
ErrPayload
err_payload: the payload of a caught runtime error value (the
unmatched value of a NoMatch), else nil.