about summary refs log tree commit diff
path: root/Doc
diff options
context:
space:
mode:
authorJoey Pabalinas <joeypabalinas@gmail.com>2018-12-17 00:54:24 -1000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2018-12-17 12:02:43 +0000
commit552ebe6082407b2cd3b9c9434394bad46fc59154 (patch)
tree90521d07b75f19b9769768dd59bd0fd221d01d54 /Doc
parente64bd2ad4c8740477a6fad6ca692b42da9e64f36 (diff)
downloadzsh-552ebe6082407b2cd3b9c9434394bad46fc59154.tar.gz
zsh-552ebe6082407b2cd3b9c9434394bad46fc59154.tar.xz
zsh-552ebe6082407b2cd3b9c9434394bad46fc59154.zip
43904 (plus tweak): zshmisc(1): document term being optional if `in word' is omitted
In code such as:

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

the implicit positional parameters added when the `in word ...'
list is omitted also implicitly append the separator term, making
the above code valid, albeit seemingly violating the syntax listed
in the documentation.

This is related to the various forms of alternative syntax and is
the intended behavior of the parsing code, so correct the minor
contradiction in the for loop documentation.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Zsh/grammar.yo9
1 files changed, 6 insertions, 3 deletions
diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index d2c7cd29c..d30c9d2d7 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -183,12 +183,15 @@ findex(for)
 cindex(for loops)
 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,
+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.
 
+The var(term) consists of one or more newline or tt(;)
+which terminate the var(word)s, and are optional when the
+`tt(in) var(word)' is omitted.
+
 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