Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${(z)} parsing of multiple array assignments
Looks like an empty assignment does reset the state for a single next one:
% x='a=(foo) b=() d=(bar)'
% print -rl -- "${(z)x}"
a=(
foo
)
b=
()
d=(
bar
)
On Tue, 24 Dec 2019 at 21:35, Phil Pennock
<zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
>
> On 2019-12-23 at 17:31 +0000, Daniel Shahaf wrote:
> > In the following two cases, why are the assignments to $b
> > parsed differently to the assignments to $a?
> >
> > % pz() { print -rl -- ${(qqqq)${(z)1}} }
>
> Looks to be a bug, a lack of state reset. In two places, perhaps: you
> can see that one example resets when you alternate back away from having
> empty assignment lists, where the b/c pairing here is reset by `d`, so
> that the f/g pairing matches. But I can't trigger a reset to the
> initial parse state used for `a`; unless and until I introduce a
> newline, where in the second example you can see the same parse used for
> `e`:
>
> % echo $ZSH_VERSION
> 5.7.1
>
> % x='a=(foo) b=() c=() d=(bar) e=(baz) f=() g=()'
> % print -rl -- "${(z)x}"
> a=(
> foo
> )
> b=
> ()
> c=(
> )
> d=(bar)
> e=(baz)
> f=
> ()
> g=(
> )
>
> ## differs in $'...' not '...' and \n between d and e:
>
> % x=$'a=(foo) b=() c=() d=(bar)\ne=(baz) f=() g=()'
> % print -rl -- "${(z)x}"
> a=(
> foo
> )
> b=
> ()
> c=(
> )
> d=(bar)
> ;
> e=(
> baz
> )
> f=
> ()
> g=(
> )
>
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author