Skip to main content

Module condition

Module condition 

Source
Expand description

Runtime evaluator for edge when <expr> conditions.

The DSL parses when <expr> into [flow_domain::FlowEdge::condition] as an opaque string and serializes it back verbatim; this module gives that string runtime meaning. The executor first substitutes {{...}} references against prior node outputs (reusing its interpolation machinery), then hands the resolved literal string here.

The grammar is intentionally flat and total - there are no parentheses and evaluation never panics. Any malformed input yields an EvalError; the executor treats that (and any unresolved reference) as fail-closed: the edge does not fire.

expr   := or
or     := and ( "||" and )*
and    := cmp ( "&&" cmp )*
cmp    := value ( cmpop value )?
cmpop  := "==" | "!=" | "<" | "<=" | ">" | ">="
value  := number | "'...'" | "\"...\"" | bare-word

A lone value (no comparison) is truthy when it is true (any case), a non-zero number, or a non-empty string that is not false. Comparisons use numeric ordering when both sides parse as f64, otherwise string ordering.

Enums§

EvalError

Functions§

eval
Evaluate a fully-interpolated when expression to a boolean.