zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Parse error (lack thereof) on incomplete loops
Date: Sat, 6 Oct 2018 12:55:23 +0100	[thread overview]
Message-ID: <20181006125523.103fab65@pws-HP.localdomain> (raw)
In-Reply-To: <20181006121519.2c006383@pws-HP.localdomain>

On Sat, 6 Oct 2018 12:15:19 +0100
Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> But that's not what's implemented --- it just calls the code to parse
> what the shell refers to as a "sublist", which is a component of the
> normal parse tree.  There's never been any special short-loops code,
> despite what the doc claims.  Hence there's no question, in general,
> of throwing a syntax error if it isn't in the above form (unless
> SHORT_LOOPS is unset).

Hence, in fact, the following is the best we're going to be able to do
without a rewrite.

In summary, the current implementation isn't sufficiently restricted
that attempting to keep it in check in terms of empty command lists
makes sense --- but for the same reason you shouldn't be relying on that
behaviour.

pws

diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index d2c7cd29c..11326586e 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -409,6 +409,12 @@ tt(for), tt(repeat), tt(case) and tt(select) commands no such special form
 for the arguments is necessary, but the other condition (the special form
 of var(sublist) or use of the tt(SHORT_LOOPS) option) still applies.
 
+Note that use of the tt(SHORT_LOOPS) option is currently implemented
+loosely in the shell, so that no check of the form of the condition is made
+before attempting to parse the subsequent command list.  This means that
+other forms not documented below may be allowed; these should not be relied
+on.
+
 startitem()
 item(tt(if) var(list) tt({) var(list) tt(}) [ tt(elif) var(list) tt({) var(list) tt(}) ] ... [ tt(else {) var(list) tt(}) ])(
 An alternate form of tt(if).  The rules mean that


  reply	other threads:[~2018-10-06 11:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181004154947epcas4p2441e109a2c4e060bf39f0f6925e98241@epcas4p2.samsung.com>
2018-10-04 15:49 ` Bart Schaefer
2018-10-04 16:31   ` Peter Stephenson
2018-10-04 20:04     ` Marc Chantreux
2018-10-04 20:37       ` Bart Schaefer
2018-10-05  6:04         ` Marc Chantreux
2018-10-04 20:34     ` Bart Schaefer
2018-10-05  9:14       ` Peter Stephenson
2018-10-05 13:26         ` Daniel Shahaf
2018-10-05 13:47           ` Peter Stephenson
2018-10-05 17:04             ` Daniel Shahaf
2018-10-06  1:47         ` Bart Schaefer
2018-10-06 11:15           ` Peter Stephenson
2018-10-06 11:55             ` Peter Stephenson [this message]
2018-10-06 18:21           ` Peter Stephenson
2018-10-07  3:51             ` Bart Schaefer
2018-10-07 18:16               ` Bart Schaefer
2018-10-08 10:07               ` Peter Stephenson

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=20181006125523.103fab65@pws-HP.localdomain \
    --to=p.w.stephenson@ntlworld.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).