Skip to main content

Module condition

Module condition 

Source
Expand description

Condition block — boolean expression evaluator.

Phase 1 supports a deliberately tiny grammar to avoid a JS sandbox:

<lhs> <op> <rhs> where op ∈ {==, !=, <, <=, >, >=}

Both sides are {{}}-resolved first. If both sides parse as numbers the comparison is numeric; otherwise it’s string. The block’s output is the boolean result, exposed as {{<this_id>.result}}.

An expression that uses &&, ||, !, grouping, a list, or the words contains, matches, in_set or exists runs on the Transform expression language instead (transform/condition.rs): each {{reference}} is bound to the value it holds, typed (a number, a list, an object), and the expression is read as written. Nothing a reference holds is read as syntax. The simple form above keeps its own reading, bare words and all.

Structs§

Scanned 🔒
The authored expression, read once: whether it needs the expression language, and for that language each {{reference}} replaced by the name (item.r0, …) its value is bound to.

Constants§

WORD_OPERATORS 🔒
Words the simple form has no meaning for.

Functions§

bare_boolean 🔒
compare 🔒
run
scan 🔒
split_binop 🔒
Splits at the first occurrence of a recognized comparison operator. Multi-char operators are tried before single-char.