zsh-workers
 help / Atom feed
* [PATCH v2] zshmisc(1): document term being optional if `in word' is omitted
@ 2018-12-17 10:54 Joey Pabalinas
  2018-12-17 12:05 ` Daniel Shahaf
  0 siblings, 1 reply; 3+ messages in thread
From: Joey Pabalinas @ 2018-12-17 10:54 UTC (permalink / raw)
  To: Zsh Workers Mailing List; +Cc: Joey Pabalinas

[-- 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 --]

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

* Re: [PATCH v2] zshmisc(1): document term being optional if `in word' is omitted
  2018-12-17 10:54 [PATCH v2] zshmisc(1): document term being optional if `in word' is omitted Joey Pabalinas
@ 2018-12-17 12:05 ` Daniel Shahaf
  2018-12-17 12:11   ` Joey Pabalinas
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Shahaf @ 2018-12-17 12:05 UTC (permalink / raw)
  To: Joey Pabalinas, Zsh Workers Mailing List

Thanks for the patch!  I committed it with one tweak:

Joey Pabalinas wrote on Mon, 17 Dec 2018 00:54 -1000:
> +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.

s/to/which/ since I couldn't parse the sentence otherwise (no pun
intended).  Happy to tweak this further if needed.

Thanks,

Daniel

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

* Re: [PATCH v2] zshmisc(1): document term being optional if `in word' is omitted
  2018-12-17 12:05 ` Daniel Shahaf
@ 2018-12-17 12:11   ` Joey Pabalinas
  0 siblings, 0 replies; 3+ messages in thread
From: Joey Pabalinas @ 2018-12-17 12:11 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Joey Pabalinas, Zsh Workers Mailing List

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

On Mon, Dec 17, 2018 at 12:05:03PM +0000, Daniel Shahaf wrote:
> Thanks for the patch!  I committed it with one tweak:
> 
> Joey Pabalinas wrote on Mon, 17 Dec 2018 00:54 -1000:
> > +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.
> 
> s/to/which/ since I couldn't parse the sentence otherwise (no pun
> intended).  Happy to tweak this further if needed.

The original I based on the select description, but a which flows
a bit better now that I sound it out in my head.

No objections here.


-- 
Cheers,
Joey Pabalinas

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

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-17 10:54 [PATCH v2] zshmisc(1): document term being optional if `in word' is omitted Joey Pabalinas
2018-12-17 12:05 ` Daniel Shahaf
2018-12-17 12:11   ` Joey Pabalinas

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/ public-inbox