zsh-users
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh-users@zsh.org
Subject: Re: ${(z)} parsing of multiple array assignments
Date: Tue, 24 Dec 2019 15:34:08 -0500	[thread overview]
Message-ID: <20191224203408.GA35101@osmium.pennocktech.home.arpa> (raw)
In-Reply-To: <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=(
    )


  reply	other threads:[~2019-12-24 20:34 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 [this message]
2019-12-24 23:16   ` Sebastian Gniazdowski
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=20191224203408.GA35101@osmium.pennocktech.home.arpa \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-users@zsh.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).