pub(crate) fn brace_up_single_statement_blocks(src: &str) -> StringExpand description
Wrap single-statement if/while/for bodies in { ... }. WGSL requires
braces on every conditional/loop body; HLSL doesn’t, and a lot of MD2
preset code uses the brace-less form (if (cond) ret.z -= 0.5;).
We walk the source, find each if / while / for keyword, balance the
condition parens, and if the next non-whitespace character isn’t {, we
wrap from there to the next top-level ; (tracking parens to skip nested
calls) in braces.