zsh-workers
 help / color / mirror / code / Atom feed
* Strange brace(}) behavior with multiple for loops
@ 2022-11-14 17:54 Jim
  2022-11-14 18:08 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Jim @ 2022-11-14 17:54 UTC (permalink / raw)
  To: devs

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

Hi everyone,

Checked on 5.7, 5.7.1, 5.8, 5.8.1 and 5.9

I had a problem with multiple for loop termination, so I simplified it.
On the command line I entered the following anonymous function:

% ()
{
  emulate -L zsh
  local     A B C
  local -a  T=(1 2 3)
  for A ($T) { for B ($T) { for C ($T) {  print -- $A $B $C }}}
} | less

  "} } }" , "}} }" and "} }}"  work
  "}}}" waits with "function for> " message

Depending on how I terminate the loops(see above) the anonymous function
either
works or fails if using 3 braces(}}}) togather(no spaces).

Q:  Is this a bug, or am I missing something?

Google search so far hasn't yielded anything useful.

Regards,

Jim Murphy

[-- Attachment #2: Type: text/html, Size: 1061 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Strange brace(}) behavior with multiple for loops
  2022-11-14 17:54 Strange brace(}) behavior with multiple for loops Jim
@ 2022-11-14 18:08 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2022-11-14 18:08 UTC (permalink / raw)
  To: linuxtechguy; +Cc: devs

On Mon, Nov 14, 2022 at 9:56 AM Jim <linux.tech.guy@gmail.com> wrote:
>
> Depending on how I terminate the loops(see above) the anonymous function either
> works or fails if using 3 braces(}}}) togather(no spaces).
>
> Q:  Is this a bug, or am I missing something?

I suppose it's technically a bug, but "}" is either a token or not
depending on context, so it's generally a good idea to put spaces
around them, just like in the previous thread about alias expansions.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-14 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 17:54 Strange brace(}) behavior with multiple for loops Jim
2022-11-14 18:08 ` Bart Schaefer

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