Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Parse error (lack thereof) on incomplete loops
- X-seq: zsh-workers 43612
- 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:15:19 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1538824522; bh=b0mz7s9GdLPMLDTeGYdrR8Up51/+pbMeWViaaZorR90=; h=Date:From:To:Subject:In-Reply-To:References; b=qtKXWyc5jMHHoITN5O6u/IbAUWONzP/8kUK263dwp1LGCWFrJTwfJwhCzM4zhuh+V 3TTdLsIGwCR/7b6zdGcQx5vepsYdbSIvM6K2/+T1FTshgLuAPdQiVTKdogapOAv1Aq Hp7atrW7o0MM6Dqdg/etAencZrEuHoj2dmBt/T70+pgBvBMsa+E0TO/3sQss+9PDwy bl5LetLQ8/kjkCeCXRtX51Tnfc15AmsC2Xk2JU4yb1o2ArUaYZq9ybKUNYBc8tgQ0V sQicutNjX3fphj3VBKETXNQQJI8cskipnkV45j5PDu71DwvqTyWhZqXNvZSgrfp6BZ OoxsPWLfvGq9g==
- In-reply-to: <CAH+w=7auLdphdcLBsKFsEqyRE0Ug6o+13TYOVx-KO3g9Z2QP2Q@mail.gmail.com>
- 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>
On Fri, 5 Oct 2018 18:47:01 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > Without a "do" while doesn't know where the expression ends. That's
> > fundamental to how SHORT_LOOPS works
>
> No it isn't. The documentation explicitly says:
>
> For the if, while and until commands, in both these cases the test part
> of the loop must also be suitably delimited, such as by `[[ ... ]]' or
> `(( ... )), else the end of the test will not be recognized.
>
> "Both these cases" refers to:
> #1 - sublist is of the form `{ list }'
> #2 - the SHORT_LOOPS option is set
>
> So you don't get to claim that SHORT_LOOPS is intended to except you
> from that restriction. The "]]" or "))" tell while where the
> expression ends.
>
> In none of the examples given in this thread so far has the test
> expression been delimited that way.
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).
I think the above is close to what Daniel is looking for --- a
statement of what does work, with anything else being left to
the user's peril.
It seems quite clear I should leave well alone. If anyone thinks they
can write code that tightens it up in the above fashion, feel free.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author