From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 34451f7a for ; Tue, 24 Dec 2019 23:17:02 +0000 (UTC) Received: (qmail 21333 invoked by alias); 24 Dec 2019 23:16:56 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24577 Received: (qmail 21014 invoked by uid 1010); 24 Dec 2019 23:16:56 -0000 X-Qmail-Scanner-Diagnostics: from mail-vs1-f42.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25670. spamassassin: 3.4.2. Clear:RC:0(209.85.217.42):SA:0(-2.0/5.0):. Processed in 1.69854 secs); 24 Dec 2019 23:16:56 -0000 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.42 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5BODKAHQCbh70BAlgHSexBjbqoQ00/NHDAnbLIxQyPU=; b=bBsbdeDGu9A2RS57cWmo9KW1z8w8IcG3r1fqhwnjT10VvDI5bwa4mt2vxJxqezrv96 1zP09NaOXqEeT9oo9qvn1tD1qgrooT3IyDyAqO1rHm1qy5mknDQwJb6bcjdVKV18YmQI bUGjTWqBxUeNeyoe1RPkDf0vtKgJqw2YH0ar0IFjLB6OGEgZQ8c2cYb88dz48wWh8YAy V2Y/ZeO4/wxWbP6IPRPRdj+MwPCBWu5fpQ7CDaIhyz8KP7d93RGTH4vf4yWor/ogBOuR WJyfRGq4n5ngel29HOhcf4KagE6oDMerjXcMTkRShJxMv2MUjKm5xOFceZWj3BmhRa48 ktRg== X-Gm-Message-State: APjAAAUZjlGV6MHZkfIoUojNOpT3ic2OvDRosr0H6e0XrOCiDl0aJIte h6DTgy9903/2yak6AKZDP5Lka7/KVC05SEMB4Ek= X-Google-Smtp-Source: APXvYqyKiRw6ImRcvbNfpOP+7UAi5Z7b0mGKt+4gRi671Sz7cMNwnDPhTjHJSwHKbaKen1PJvBBDYRnlZlvdQR1IrDs= X-Received: by 2002:a05:6102:190:: with SMTP id r16mr18344202vsq.215.1577229380790; Tue, 24 Dec 2019 15:16:20 -0800 (PST) MIME-Version: 1.0 References: <20191223173115.bvhwbpfmqgqhngle@tarpaulin.shahaf.local2> <20191224203408.GA35101@osmium.pennocktech.home.arpa> In-Reply-To: <20191224203408.GA35101@osmium.pennocktech.home.arpa> From: Sebastian Gniazdowski Date: Wed, 25 Dec 2019 00:16:09 +0100 Message-ID: Subject: Re: ${(z)} parsing of multiple array assignments To: Phil Pennock Cc: Daniel Shahaf , Zsh Users Content-Type: text/plain; charset="UTF-8" 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 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