zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>, Zsh Users <zsh-users@zsh.org>
Subject: Re: ${(z)} parsing of multiple array assignments
Date: Wed, 25 Dec 2019 00:16:09 +0100	[thread overview]
Message-ID: <CAKc7PVCKy2ubK3SybpVAAqpOzqGDcL0LJ=TYN4fAPLMhkyJ3-A@mail.gmail.com> (raw)
In-Reply-To: <20191224203408.GA35101@osmium.pennocktech.home.arpa>

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@spodhuis.org> 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

  reply	other threads:[~2019-12-24 23:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23 17:31 Daniel Shahaf
2019-12-24 20:34 ` Phil Pennock
2019-12-24 23:16   ` Sebastian Gniazdowski [this message]
2019-12-29 20:55 ` Peter Stephenson
2019-12-29 23:45   ` Peter Stephenson
2019-12-30 18:13     ` Daniel Shahaf
2019-12-30 18:21       ` Daniel Shahaf
2019-12-30 22:37         ` Peter Stephenson
2019-12-30 23:46           ` Daniel Shahaf
2019-12-31 11:58             ` Daniel Shahaf
2019-12-31 18:35             ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKc7PVCKy2ubK3SybpVAAqpOzqGDcL0LJ=TYN4fAPLMhkyJ3-A@mail.gmail.com' \
    --to=sgniazdowski@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-users@zsh.org \
    --cc=zsh-workers+phil.pennock@spodhuis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).