On Thu, 6 Feb 2020, Sven Schreiber wrote:
Am 06.02.2020 um 12:35 schrieb Riccardo (Jack) Lucchetti:
> works ok, but the conditional assignment statement
>
> <hansl>
> string sep = $windows ? "\" : "/"
> </hansl>
>
> gives an error, because the backslash is considered an escaping
> character. This breaks the xy_color packages (and possibly some more).
The thread in December "problem with sprintf in ternary statement" looks
related. Allin fixed a bug there by removing a special-casing treatment
of \" , but this may be a side effect.
OK, I've had a further go at fixing this in git. It seems there
_was_ a rationale for the old special-casing of backslash-quote in the
conditional assignment context, but it should be turned off whenever
the sub-context is sprintf().
Both of the following tests now work:
<hansl>
# Sven's case
string s = 1 ? sprintf("\"hey\"") : "other"
print s
# Jack's case
string sep = $windows ? "\" : "/"
print sep
</hansl>
Allin