zsh-workers
 help / color / mirror / code / Atom feed
From: Joey Pabalinas <joeypabalinas@gmail.com>
To: Zsh Workers Mailing List <zsh-workers@zsh.org>
Cc: Joey Pabalinas <joeypabalinas@gmail.com>
Subject: [PATCH v2] zshmisc(1): document term being optional if `in word' is omitted
Date: Mon, 17 Dec 2018 00:54:24 -1000	[thread overview]
Message-ID: <0877607db0d5033efa86947d554bfbe1b8ddbcc2.1545043873.git.joeypabalinas@gmail.com> (raw)

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

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.
---
 Doc/Zsh/grammar.yo | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index d2c7cd29c289287066..452b7fd0fc0003d652 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -181,16 +181,19 @@ is executed.
 )
 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(;)
+to 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
 parameters.  If there are more var(name)s than remaining var(word)s, the
 remaining parameters are each set to the empty string.  Execution of the

-- 
Cheers,
Joey Pabalinas

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

             reply	other threads:[~2018-12-17 10:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17 10:54 Joey Pabalinas [this message]
2018-12-17 12:05 ` Daniel Shahaf
2018-12-17 12:11   ` Joey Pabalinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0877607db0d5033efa86947d554bfbe1b8ddbcc2.1545043873.git.joeypabalinas@gmail.com \
    --to=joeypabalinas@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).