Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Parse error (lack thereof) on incomplete loops
- X-seq: zsh-workers 43613
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: Parse error (lack thereof) on incomplete loops
- Date: Sat, 6 Oct 2018 12:55:23 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1538826925; bh=IrcCTjg692Uas30QSPEwkID1Ghnq61Ye1XvSC9VtRIU=; h=Date:From:To:Subject:In-Reply-To:References; b=m7ykQiO7K5DPhsAd4xJNt0pnbfwN1DmNuk+bc1HTczNhjEwZnW+0dHwwMPJy42cS+ os6JV9/MbzbTP2dmUgRAT4Jz82bmqTyDyOrHVe7IDPs81Dv5SmtPePRcXyyjVgXeTb DrYHKABtHMRqf/e26X1FL8gfsli1ds+Y52R/EQxdhXhPXUIP1hHtMiws0lvNawO8Mv 3B+O9uH3ovkfSOmeQzem1nAwDyB1NPCAilV0xpqPFQMWffdPYZEjJ0TCBSPit01soa O9ovVGL9rZSAgN2rmIMpqJiV0cVDgsbTIPqv9T2y/ll+6GciyuL4JgkJaOcs9Ie8R3 +5Wln6u5y4hGQ==
- In-reply-to: <20181006121519.2c006383@pws-HP.localdomain>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20181004154947epcas4p2441e109a2c4e060bf39f0f6925e98241@epcas4p2.samsung.com> <CAH+w=7awbwDuX2RXcB7pK6Hhbi8fjs=NvwkTAEGmY7gvNpLCqA@mail.gmail.com> <20181004163158eucas1p234a045be013b5463d8db44314ed217dc~adN28lJmq0822408224eucas1p2F@eucas1p2.samsung.com> <CAH+w=7ZLJ5iiph8jpsSiLKdhkozqH+o_kJk7=zfK3DLBegft8g@mail.gmail.com> <20181005091435eucas1p26edaafb362de339b01c3cb5780fbd108~aq5QQQ6pF1496014960eucas1p2g@eucas1p2.samsung.com> <CAH+w=7auLdphdcLBsKFsEqyRE0Ug6o+13TYOVx-KO3g9Z2QP2Q@mail.gmail.com> <20181006121519.2c006383@pws-HP.localdomain>
On Sat, 6 Oct 2018 12:15:19 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author