rewrite_ternary_to_select

Function rewrite_ternary_to_select 

Source
pub(crate) fn rewrite_ternary_to_select(src: &str) -> String
Expand description

Lower every cond ? a : b to select(b, a, cond). WGSL has no ternary operator and the regex translator doesn’t recognise the ?/: tokens. Many presets hit expected ';'; found '?' before this pass.

Handles nested ternaries by emitting one edit per top-level ternary (in source order) and rendering inner ternaries inside the replacement string via a recursive expression emitter. That keeps text edits non-overlapping, which the apply_edits machinery requires.