rewrite_chain_assignments

Function rewrite_chain_assignments 

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

Rewrite a = b = … = <expr> into <last> = <expr>; <prev> = <last>; … so evalexpr — which makes = return Empty — doesn’t choke on the outer assignments. Detected via a strict left-to-right scan: each step requires a bare identifier followed by = and another bare identifier followed by =, no operators between them. Real-world presets in the corpus: dx=dx=(y*dx)*cos(time)*… (the LHS is repeated — a common author typo, but evalexpr still has to accept).