zsh-workers
 help / color / mirror / code / Atom feed
* Possible parsing bug with alternate for-loop syntax
@ 2016-06-11 15:48 Mikael Magnusson
  2016-06-11 18:31 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2016-06-11 15:48 UTC (permalink / raw)
  To: zsh workers

17:44:25 <Mikachu> > for a (1) {echo hi}
17:44:26 <machabot> Mikachu: hi
17:44:29 <Mikachu> > for a (1) {a=hi}; echo $a
17:44:38 <machabot> Mikachu: Timeout (no output).
17:44:36 <Mikachu> > for a (1) {a=hi} }; echo $a
17:44:39 <machabot> Mikachu: hi}
17:45:17 <Mikachu> > for a (1) {builtin local a=hi}; echo $a
17:45:18 <machabot> Mikachu: hi
17:45:22 <Mikachu> > for a (1) {local a=hi}; echo $a
17:45:30 <machabot> Mikachu: Timeout (no output).
17:45:26 <Mikachu> nice
17:45:37 <Mikachu> you get the bug for reserved word local but not for
builtin local

The documentation does state the syntax is { list } with the space
included, but this still seemed somewhat surprising to me.

-- 
Mikael Magnusson


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

* Re: Possible parsing bug with alternate for-loop syntax
  2016-06-11 15:48 Possible parsing bug with alternate for-loop syntax Mikael Magnusson
@ 2016-06-11 18:31 ` Bart Schaefer
  2016-06-11 19:21   ` Mikael Magnusson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2016-06-11 18:31 UTC (permalink / raw)
  To: zsh workers, zsh workers

Doesn't have anything to do with for-loop syntax:

torch% a=hi}; echo $a
hi}
torch% {a=hi}; echo $a
cursh> 

It's assignment parsing.  The "}" is always considered part of the
value assigned to the variable.


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

* Re: Possible parsing bug with alternate for-loop syntax
  2016-06-11 18:31 ` Bart Schaefer
@ 2016-06-11 19:21   ` Mikael Magnusson
  0 siblings, 0 replies; 3+ messages in thread
From: Mikael Magnusson @ 2016-06-11 19:21 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh workers

On Sat, Jun 11, 2016 at 8:31 PM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> Doesn't have anything to do with for-loop syntax:
>
> torch% a=hi}; echo $a
> hi}
> torch% {a=hi}; echo $a
> cursh>
>
> It's assignment parsing.  The "}" is always considered part of the
> value assigned to the variable.

Ah, you're right, the same thing happens with function parsing as well,
% () {a=hi}
function>

-- 
Mikael Magnusson


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

end of thread, other threads:[~2016-06-11 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-11 15:48 Possible parsing bug with alternate for-loop syntax Mikael Magnusson
2016-06-11 18:31 ` Bart Schaefer
2016-06-11 19:21   ` Mikael Magnusson

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