Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${(z)} parsing of multiple array assignments
- X-seq: zsh-users 24575
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: ${(z)} parsing of multiple array assignments
- Date: Tue, 24 Dec 2019 15:34:08 -0500
- Cc: zsh-users@xxxxxxx
- In-reply-to: <20191223173115.bvhwbpfmqgqhngle@tarpaulin.shahaf.local2>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Openpgp: url=https://www.security.spodhuis.org/PGP/keys/0x4D1E900E14C1CC04.asc
- References: <20191223173115.bvhwbpfmqgqhngle@tarpaulin.shahaf.local2>
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=(
)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author