From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-users@zsh.org
Subject: Re: ${(z)} parsing of multiple array assignments
Date: Mon, 30 Dec 2019 18:13:39 +0000 [thread overview]
Message-ID: <20191230181339.hg7ryxivv75ae73r@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <373ee4b006198f68c835c902c0bc35242796b33d.camel@ntlworld.com>
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
next prev parent reply other threads:[~2019-12-30 18:14 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
2019-12-29 20:55 ` Peter Stephenson
2019-12-29 23:45 ` Peter Stephenson
2019-12-30 18:13 ` Daniel Shahaf [this message]
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=20191230181339.hg7ryxivv75ae73r@tarpaulin.shahaf.local2 \
--to=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).