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=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 a074c51a for ; Mon, 30 Dec 2019 18:14:22 +0000 (UTC) Received: (qmail 16623 invoked by alias); 30 Dec 2019 18:14:15 -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: 24582 Received: (qmail 9903 invoked by uid 1010); 30 Dec 2019 18:14:15 -0000 X-Qmail-Scanner-Diagnostics: from wout5-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25677. spamassassin: 3.4.2. Clear:RC:0(64.147.123.21):SA:0(-2.6/5.0):. Processed in 0.73478 secs); 30 Dec 2019 18:14:15 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdefhedguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjfgesth dttddttdervdenucfhrhhomhepffgrnhhivghlucfuhhgrhhgrfhcuoegurdhssegurghn ihgvlhdrshhhrghhrghfrdhnrghmvgeqnecukfhppeejledrudektddrheejrdduudelne curfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhn rghmvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Date: Mon, 30 Dec 2019 18:13:39 +0000 From: Daniel Shahaf To: zsh-users@zsh.org Subject: Re: ${(z)} parsing of multiple array assignments Message-ID: <20191230181339.hg7ryxivv75ae73r@tarpaulin.shahaf.local2> References: <20191223173115.bvhwbpfmqgqhngle@tarpaulin.shahaf.local2> <7b7a941ddc3c20bea6a6b69b1e7ac35d827f320d.camel@ntlworld.com> <373ee4b006198f68c835c902c0bc35242796b33d.camel@ntlworld.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <373ee4b006198f68c835c902c0bc35242796b33d.camel@ntlworld.com> User-Agent: NeoMutt/20170113 (1.7.2) Peter Stephenson wrote on Sun, Dec 29, 2019 at 23:45:00 +0000: > On Sun, 2019-12-29 at 20:55 +0000, Peter Stephenson wrote: > > Unless I'm missing some trick, bufferwords() is the function where we > > need to update any parser state --- ctxtlex() is too low level for that, > > it just handles the next token given the current state. So it's > > probably something like this. Will need a new test adding. > > We also need to do something similar for completion, otherwise > > foo=(stuff) bar=(... > > looks like a glob qualifier. > > In this case it's already half handled, so there's a variable to hook > into. Thanks for the fix; it didn't occur to me to change bufferwords(). Here's a test. diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index c91af1a9c..899b8f498 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -640,6 +640,74 @@ >echo >$(|||) bar + argv=( + $'a=() b=()' + $'a=(foo) b=(bar)' + $'a=(foo) b=() c=() d=(bar) e=(baz) f=() g=()' + $'a=(foo) b=() c=() d=(bar)\ne=(baz) f=() g=()' + $'a=(foo) b=() d=(bar)' + ) + for 1; print -rl -- ${(z)1} && print +0:${(z)} regression test: multiple array assignments +>a=( +>) +>b=( +>) +> +>a=( +>foo +>) +>b=( +>bar +>) +> +>a=( +>foo +>) +>b=( +>) +>c=( +>) +>d=( +>bar +>) +>e=( +>baz +>) +>f=( +>) +>g=( +>) +> +>a=( +>foo +>) +>b=( +>) +>c=( +>) +>d=( +>bar +>) +>; +>e=( +>baz +>) +>f=( +>) +>g=( +>) +> +>a=( +>foo +>) +>b=( +>) +>d=( +>bar +>) +> + foo=$'\x06ZUI\x1f text-field example: \x1azuitfieldtfield1_1\x1a\'\'\x1a\'\'\x1a1\x1aZUI\\[my_tfield1_width\\]\x1aZUI\\[my_tfield1_start\\]\x1aZUI\\[my_tfield1_data\\]\x1c' print "${#${(z@)foo}}" 0:Test real-world data that once seemed to fail Cheers, Daniel