fn write_quantified_left<W: Write, T: AstInfo>(
f: &mut AstFormatter<W>,
expr: &Expr<T>,
op: &Op,
)Expand description
Write left as the LHS of <left> <op> ANY/ALL (...). The printed <op> is an
ordinary binary infix. It can be any operator the parser accepts here, from
=/< (Cmp) all the way down to *///% (MultiplyDivide), and on
reparse it binds into any operator exposed on left’s right spine that is
strictly looser than <op> itself, stealing that suffix into the quantified
expression’s left rather than wrapping the whole left. So parenthesize
exactly when left’s right_edge binds looser than <op>’s own precedence
(binary_op_precedence), mirroring the binary-Op arm. Using the operator’s
real precedence (not a fixed Like threshold) both parenthesizes a
tighter-binding <op> over a looser left and leaves an equal-or-tighter left
bare (a = b = ANY (…), a LIKE b = ANY (…)), which the old fixed threshold
over-parenthesized. The tighter-binding case, (a + b) * ANY (…), would
otherwise print a + b * ANY (…) and reparse as the different
a + (b * ANY (…)). right_edge also sees a looser spine hidden under
right-transparent prefixes, e.g. the NOT’s IN in - NOT a IN (b) = ANY (…).