Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Parse error (lack thereof) on incomplete loops



Peter Stephenson wrote on Fri, 05 Oct 2018 10:14 +0100:
> {
>   while false
>     true
> }
...
> Without a "do" while doesn't know where the expression ends.  That's
> fundamental to how SHORT_LOOPS works and why I regard it as so
> ill-defined as to be useless in all but the simplest cases.  This new
> (accidental) feature is giving it a particularly straightforward way of
> telling it where the expression ends.
> 
> Anyway, I'm perfectly happy either restoring the parse error or not,
> depending on the opinions of people more likely to use or fall foul of
> this kind of syntax but I don't think the reason "it's all a bit weird"
> is good enough on its own for restoring it.  Short loops *are* weird.

Point taken :-)

Can we come up with a one-sided parsing rule for syntactically valid cases?
That is, a rule that says guarantees that some constructs are syntactically
valid, but doesn't necessarily say anything about other constructs.

(I'm thinking of something like the last paragraph of users/23696, though
I have no opinion on what the rule should be.  My only intersection with
shortloops is that I use the short form of 'for' in interactive shells.)

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author