Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ${(z)} parsing of multiple array assignments



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