Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${(z)} parsing of multiple array assignments
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author