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 b7714cd7 for ; Sat, 15 Dec 2018 20:26:43 +0000 (UTC) Received: (qmail 26453 invoked by alias); 15 Dec 2018 20:26:22 -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: 43896 Received: (qmail 25009 invoked by uid 1010); 15 Dec 2018 20:26:22 -0000 X-Qmail-Scanner-Diagnostics: from mail-pg1-f176.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.215.176):SA:0(1.0/5.0):. Processed in 2.126481 secs); 15 Dec 2018 20:26:22 -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=hXbOfmG2TWgTJR3lEDGk/Cwz171UkVtObqqvJo5dxAI=; b=r5ayieUddETeSf0kzk24W8MMqgfFmpFuUOG0NfUlTHR5cGwZVwulD61wLxTyYUwF37 gIZLA0Bk2v67S4HuHJzvoDOccufdNtfRaz1ik/RxFBiyAPZlKD5X9gg0aw0ZdnN0d7mc Kz/8KOAqE3QHHj3yuQEvXqXH3qCV8OhkXAwHIO7tEWiVSPVZ8GKWLsxOVRKE/9Og2aHO f5PaUf7EqEqNlA1rHba0XRlid8UHN5z6AJCkfOOi66M9DawFhS4Z+j+mBCE8kX2/b28x 3qx/uj6WqXhUUnmENI6mElsKH+1muM7113ZkfiEG/b7DR4D3+I/nGpr0oL2GdHWpa+xR wWrw== 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=hXbOfmG2TWgTJR3lEDGk/Cwz171UkVtObqqvJo5dxAI=; b=g7cQjYKEvN2w42nsf2lchg79+dWTnI2dyYoGLeb4LWGYBHJFBiAjY7Ls+GCiShBef6 v5G6mTmt6eSFVSHFaNZbQicYZi7F6fiZ7n1Ls47D1g5l2lw7lt0Wn26DWcza20uRBgSP wH0cNFKDGefgw2AWoKtOoT80QcK9Z+xLh68luAWppyZxilqh4q2JHi80FxpTIAe/Xmq8 uebwIl0qrYrRX7RWUYye/higGJcg21BKllsp487qLMuwxCdo+GUeWmrdco0Je1hvR458 +t541zvOvqYuwq34lVAashaKFMsm1sOs1bpxqs25brF07eL7VUcl0PZc/QRjphDaHDqk vJiQ== X-Gm-Message-State: AA+aEWYY0j8CGViaggFPZ1Ibdg2yYb+E04KoVXRbejXNcx/ltkSC0w32 KMICHau8GO0axf/Gw5r87aGG5qHI X-Google-Smtp-Source: AFSGD/WV/l+ueunkGW9dbQinZcU44vHWtIpPFl9U3Vx5sqVjwghh3Tn/+a1+BLHhd9pAHoKf82uEVw== X-Received: by 2002:a63:dc0c:: with SMTP id s12mr7248054pgg.398.1544905576343; Sat, 15 Dec 2018 12:26:16 -0800 (PST) Date: Sat, 15 Dec 2018 10:26:13 -1000 From: Joey Pabalinas To: Zsh Workers Mailing List Cc: Joey Pabalinas Subject: [PATCH] zshmisc(1): document implicit append of `term` when `in word` is omitted Message-ID: <8afdae3ebc75741d47d657f29fb7d2876f9536b2.1544905398.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="lj55gt5exvjmvloh" Content-Disposition: inline User-Agent: NeoMutt/20180716 --lj55gt5exvjmvloh 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 `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(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, -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. =20 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 --=20 Cheers, Joey Pabalinas --lj55gt5exvjmvloh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEENpTlWU2hUK/KMvHp2rGdfm9DtVIFAlwVY2QACgkQ2rGdfm9D tVIb+A//YZmMb5XczCv53oykXW0Ykf6d2/5aJs9T+l3e5ziGnkKXsXFWEXwu8wes CtHm4uIN07n70JEyp2LHRH0P9cxXiSeCP4VxYY1njukzQ4eUMVzguTrYf+CO4Gie wu6ESg1QOSdJXbi6i+T/zQ9QZXogLinsbCx85OSEGU1YoxqkQzsfBPy6VGwyh+wM JGKnJ7W0TSH3t7lF/yGk6GrquynPYA4V4MWph4boC9PiX/EFQYAqRVo7saoElRnx jHSGNCwwcl7GfETN119UfbzrPhXWpqEJS9pgUtYKzYdCN79/h5bz4BCi66Atkv0T oIs3aOh/HzDUcPKOkPxP+WfpJQaTjSjq45se4u/N1Jmp2jYmGEBDNu/wfxzm0fJ1 WmUQXUJ7xU8gnc6PAqX0MGfmZpye+QRYIvmdAyjWreQYHxouxeiGff19BDJgIeni tjahRcs0itBv+mIL+Zxto3Xlz1A07bW1FfDfNk4sbgnqh2to8lKJfcrlQkOybmm5 zCp/s+dPIiv5w+x8miFXth3gwzn+VkxTscVpbkTVaL55e4s0xMIzXrEKftd1SCU3 nHfjKhIWhONbPZW6cxQ6/PRgeklDh8/fGBzZa3CnloMf9d1PSA45wXH7nZKE8By4 WgicldV0H8JYS5zKNBBSAHw1TMz7ljzw32KDNEznf0dLFsIZP/U= =aRMo -----END PGP SIGNATURE----- --lj55gt5exvjmvloh--