zsh-workers
 help / color / mirror / code / Atom feed
* Re: ${(z)} parsing of multiple array assignments
       [not found]   ` <CAKc7PVCKy2ubK3SybpVAAqpOzqGDcL0LJ=TYN4fAPLMhkyJ3-A@mail.gmail.com>
@ 2019-12-24 23:32     ` Daniel Shahaf
  0 siblings, 0 replies; only message in thread
From: Daniel Shahaf @ 2019-12-24 23:32 UTC (permalink / raw)
  To: zsh-workers

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-24 23:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191223173115.bvhwbpfmqgqhngle@tarpaulin.shahaf.local2>
     [not found] ` <20191224203408.GA35101@osmium.pennocktech.home.arpa>
     [not found]   ` <CAKc7PVCKy2ubK3SybpVAAqpOzqGDcL0LJ=TYN4fAPLMhkyJ3-A@mail.gmail.com>
2019-12-24 23:32     ` ${(z)} parsing of multiple array assignments Daniel Shahaf

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).