From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id a04adc08 for ; Mon, 17 Dec 2018 10:54:51 +0000 (UTC) Received: (qmail 25931 invoked by alias); 17 Dec 2018 10:54:33 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43904 Received: (qmail 552 invoked by uid 1010); 17 Dec 2018 10:54:33 -0000 X-Qmail-Scanner-Diagnostics: from mail-pf1-f194.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(209.85.210.194):SA:0(1.7/5.0):. Processed in 2.107307 secs); 17 Dec 2018 10:54:33 -0000 X-Envelope-From: joeypabalinas@gmail.com X-Qmail-Scanner-Mime-Attachments: |signature.asc| X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=SUgvMofS1YRL4ZQW1pHknLLvvrzUeO+P3DWtC+sPVjI=; b=lSUMaa8QxfL47VT/pCA2bvv3lIuGrpPfes68j5dw7dxkPtZiTHQgl6T+Wa2RXghfBP MWtm4PCCBzUOBn7F2Xw+EfNQGzkDr2ySkiz+DM+++MhYf4BK/ZBKg2ujFjML1j3Ioluw 1d9G53WPERfddbivcx/cugftUM/rqSK23766WETOVrcxGEI6P90BwuoHXJDpkqBqjWzI ZeiUMroxj3Gun8xaxQAREnDwYoYICYTWXfzenoIWUVdaGV0UaYvXIoL4maX1ism23+Jr hsmdziOTCScZtJH+bU4cd8WSS6D0eL9+NiSVwXxnRzxjzAkDNNIi1Adie4N52e9NNOw2 Do9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:mime-version:content-disposition:user-agent; bh=SUgvMofS1YRL4ZQW1pHknLLvvrzUeO+P3DWtC+sPVjI=; b=aHfjGQMtRafQaxX4nwqoZU2GUWtENYzE/tsPjQK4og3Kg52H1If0fA4sdrXTL5LcIA uyVZHUVA2ONcM6CmRYVnuhVjE4YMTsXkalYGH3QXhhMgWRqi26wEUH8RFsa4LysXZNn+ jhbW+X5xX9S/SFmbhXn29H3wOw3utO/7hhlzK8/KjVI3XkeyHqZGQ3cqpL5dK1BC8rza hTrOoRk/yKetJ0qJfYb8fZHVBMRxA5StfeLy6En2FLUu8otHX4UduN1dkM0vcAA4fyBX NdlgAarQGBU3/pj1JilwBV1VJakv9lZrtiGHZr8jw5GVpfqpITiAfIsfgc/U/NS81KSk SuiA== X-Gm-Message-State: AA+aEWZJADQF+su+fP38wyTrP1vGaImbihMFF7SvAzmnGV1tkYYACJSk 6Mfks6Oo1O8TL9dmXhyvNKahr10G X-Google-Smtp-Source: AFSGD/UpgD61R5bmbfHYfhTjLmfcXFpEBq36VY0AR05ABF4LUVWVA3fkO6SrCcEj/rT3OS5SCS6+0A== X-Received: by 2002:a62:1a91:: with SMTP id a139mr3446021pfa.64.1545044067476; Mon, 17 Dec 2018 02:54:27 -0800 (PST) Date: Mon, 17 Dec 2018 00:54:24 -1000 From: Joey Pabalinas To: Zsh Workers Mailing List Cc: Joey Pabalinas Subject: [PATCH v2] zshmisc(1): document term being optional if `in word' is omitted Message-ID: <0877607db0d5033efa86947d554bfbe1b8ddbcc2.1545043873.git.joeypabalinas@gmail.com> Mail-Followup-To: Joey Pabalinas , Zsh Workers Mailing List MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oijeswkt2sn3ohe7" Content-Disposition: inline User-Agent: NeoMutt/20180716 --oijeswkt2sn3ohe7 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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(l= ist) 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. =20 +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 --=20 Cheers, Joey Pabalinas --oijeswkt2sn3ohe7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEENpTlWU2hUK/KMvHp2rGdfm9DtVIFAlwXgGAACgkQ2rGdfm9D tVItyQ//bXrOzdPyCn8ihbgNEjAzrAjAuCu+fHU/LJb7uUgo4H3ej7y1u5yM4OMx zMBKbERqhqhbbUUTBmWqzOJrNOzaCP+me4n0e325zXzcR+xkKZWpnsrOnJI7oV4g Ja+1i8y4y5fVNDGwYt+ZjY77cUSz4csumLVKVUf8Xk/6vFjiQgsnITqhxsuTAMQp lyERcSoChzE7BNgq8H/Nq433nvSU7hgp7Nrr/6NRLPfCcBup1Sm6gH9tQuLzHMbf 571+K5/nD9UYZrongmXJ8+vrhCoL9AZr6zRGioXzVy1wZmV7CoCjTSudfrMviZEk kf9anuih0ncVpUmlQ5Il0bfA9PdbVfOoRiPK6Wp97yuJaS7TeUHjGAIdYSXm/KC4 cOKmPjL97nJKXPKTEYK0pudCh8OSUIv76UWoqlvjE7yC8i3It3FMtaleZ2Gb0bGB QW2igp2I/w/BGm/X/9z+ovdfpJdkm1wf4SgD1Ci/KoaI2/GJ2VNNrx1HfylBJrAl cWSQh0aPt6VjKqno3CccVlkLfYj2Vblm81OZduVkL6AmmDOkEun0dG4JNYwRNXHz 0UdFfAImpR1+2EO0pjHoVlZukLSmmSKrcnDdUpPdFSHsubFlvs9kW/hCvcGTYopa dJ4Mz4x97pdYBij2NP2kfx1cZUJlGcsBpmZT96EpsKh1q33oMMI= =QHeE -----END PGP SIGNATURE----- --oijeswkt2sn3ohe7--