zsh-workers
 help / color / mirror / code / Atom feed
* Unexpected ${%F{}} evaluation
@ 2014-12-03 21:20 Marc Finet
  2014-12-03 22:55 ` Bart Schaefer
  2014-12-04  2:22 ` Mikael Magnusson
  0 siblings, 2 replies; 4+ messages in thread
From: Marc Finet @ 2014-12-03 21:20 UTC (permalink / raw)
  To: zsh-workers

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-06 20:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-03 21:20 Unexpected ${%F{}} evaluation Marc Finet
2014-12-03 22:55 ` Bart Schaefer
2014-12-04  2:22 ` Mikael Magnusson
2014-12-06 20:03   ` Marc Finet

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).