rewrite_chained_comparisons

Function rewrite_chained_comparisons 

Source
pub(super) fn rewrite_chained_comparisons(s: &str) -> String
Expand description

Rewrite Python-style chained comparisons (A > B <= C <= 1) into the explicit AND-chain ((A > B) && (B <= C) && (C <= 1)) that evalexpr’s left-associative comparison precedence can type-check.

MD2’s EEL2 historically reads chained comparisons as pairwise AND, like Python: a < b < c means “a < b AND b < c”. evalexpr 13 inherits C semantics, so A > B <= C evaluates to (A > B) <= C, which is Boolean <= C and dies.