Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${(z)} parsing of multiple array assignments
- X-seq: zsh-workers 45140
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: ${(z)} parsing of multiple array assignments
- Date: Tue, 24 Dec 2019 23:32:40 +0000
- In-reply-to: <CAKc7PVCKy2ubK3SybpVAAqpOzqGDcL0LJ=TYN4fAPLMhkyJ3-A@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20191223173115.bvhwbpfmqgqhngle@tarpaulin.shahaf.local2> <20191224203408.GA35101@osmium.pennocktech.home.arpa> <CAKc7PVCKy2ubK3SybpVAAqpOzqGDcL0LJ=TYN4fAPLMhkyJ3-A@mail.gmail.com>
Sebastian Gniazdowski wrote on Wed, Dec 25, 2019 at 00:16:09 +0100:
> % x='a=(foo) b=() d=(bar)'
> % print -rl -- "${(z)x}"
Breadcrumb:
[[[
diff --git a/Src/lex.c b/Src/lex.c
index 1d86da94e..e6f6c8f50 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -340,13 +340,13 @@ ctxtlex(void)
case ELIF:
case ELSE:
case DOUTBRACK:
+ case OUTPAR:
incmdpos = 1;
break;
case STRING:
case TYPESET:
/* case ENVSTRING: */
case ENVARRAY:
- case OUTPAR:
case CASE:
case DINBRACK:
incmdpos = 0;
]]]
This change fixes all the cases in this thread, and passes all zsh tests and
all z-sy-h tests (which rely heavily on ${(z)} functioning correctly); however,
I don't know whether it's correct.
I'm guessing that the different meaning of parentheses are being confused for
each other:
- Array assignment
- End of subshell
- Function defnition
- Glob qualifier
Thanks,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author