Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Unexpected ${%F{}} evaluation
- X-seq: zsh-workers 33837
- From: Marc Finet <m.dreadlock@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Unexpected ${%F{}} evaluation
- Date: Wed, 3 Dec 2014 22:20:02 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-transfer-encoding; bh=3pwSQeNXXkXkxC7AzYWTQBHA5W4U+FjEf0ioh4D0kJ0=; b=QeLkko0N7ugD94SEnrg71Q+CtQqA1IF4/U5aAU/O5cYklQvvJI4mXD+2Rkpp1QJMuQ LMjIOH8vi95371+2xmJ0+wCeNhh70bDxF0Gh8EEsVoJeqAiWp5bug4i8vni6iDHXiEq3 AmSg4t6g1h1vYPU6hL5XPPcI4gVAIdKL6G+A1xe3CR1SeEDxz/+8jiH38+3J1wGrxhts 1Epvo8tHnU+xpQ21KfDWkZEugHpLiFXgLtz0jdj20EeV8mwssjGyeVWLEI+fjxpQnmZ+ AleRL68N8PhQOAEtVHJ1O5JCUQ3cMOnaSgkO9xFIlxevqwLtGT75siFKVnlV0o0uGpTm 5qVQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hello,
While hacking a small script I fall on the following case:
# x="${(%):-%F{red}}XX"; echo $x
}XX
# x=${(%):-%F{red}}XX; echo $x
XX
In both cases, the color was correct, i.e. (%) + %F{} did it job, but
note the extra } in the first case.
It seems that the double-quotes of the first case associated the first
'}' to the '${': its value is Outbrace in stringsubst(). The '{' after
the %F and the second '}' remain {}, and the first { is Inbrace.
In the second case, the two '}' are converted into Outbrace, and both
'{' are also converted into Inbrace.
For the first case, {} are not balanced according to what I expected,
(outer {} for $ and inner {} for %F), but first } for first {, i.e. ${}.
My questions are the following:
- is this behavior intended, i.e. break an expression inside ${} to
the first } ? At first, I thought that it was a limitation (of ""), but
testing the second case showed me that correct parsing could be done.
- is it normal that %F{xx works as %F{xx} ?
Thanks,
Marc.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author