zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] zshmisc(1): document implicit append of `term` when `in word` is omitted
@ 2018-12-15 20:26 Joey Pabalinas
       [not found] ` <1544925190.621790.1610325216.065C6F48@webmail.messagingengine.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Joey Pabalinas @ 2018-12-15 20:26 UTC (permalink / raw)
  To: Zsh Workers Mailing List; +Cc: Joey Pabalinas

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

In code such as:

> hobbes% () { for arg do print -r $arg; done; } 1 2 3
> 1
> 2
> 3

the implicit `in "$@"` added when the `in word ...` list is omitted
also implicitly appends the separator term, making the above
code valid.

This is fairly innocuous behavior and is POSIX-compliant, so document
this odd edge case rather than risk regressions attempting to change
the lexer/parser code.
---
 Doc/Zsh/grammar.yo | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index d2c7cd29c289287066..33aa3a4c5965771971 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -185,11 +185,12 @@ cindex(loops, for)
 item(tt(for) var(name) ... [ tt(in) var(word) ... ] var(term) tt(do) var(list) tt(done))(
 where var(term) is at least one newline or tt(;).
 Expand the list of var(word)s, and set the parameter
 var(name) to each of them in turn, executing
 var(list) each time.  If the tt(in) var(word) is omitted,
-use the positional parameters instead of the var(word)s.
+use the positional parameters with a var(term) implicitly
+appended instead of the var(word)s.
 
 More than one parameter var(name) can appear before the list of
 var(word)s.  If var(N) var(name)s are given, then on each execution of the
 loop the next var(N) var(word)s are assigned to the corresponding
 parameters.  If there are more var(name)s than remaining var(word)s, the
-- 
Cheers,
Joey Pabalinas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-12-16 22:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-15 20:26 [PATCH] zshmisc(1): document implicit append of `term` when `in word` is omitted Joey Pabalinas
     [not found] ` <1544925190.621790.1610325216.065C6F48@webmail.messagingengine.com>
2018-12-16  2:01   ` Joey Pabalinas
2018-12-16 11:54     ` Daniel Shahaf
2018-12-16 17:41       ` Peter Stephenson
2018-12-16 19:15       ` Joey Pabalinas
2018-12-16 19:41         ` Bart Schaefer
2018-12-16 22:00           ` Joey Pabalinas

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