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

Re: Parse error (lack thereof) on incomplete loops



On Sat, 2018-10-06 at 20:51 -0700, Bart Schaefer wrote:
> So ... I've been looking through the git history of Doc/Zsh/grammar.yo ...
> > It's also not clearly (or at all?  I can't see it) documented that you
> > only get the SHORT_LOOPS effect if there's no delimiter --- if you stick
> > one in it looks like a normal command list which it'll just go on parsing.
>
> True that this is not called out, but implicitly from the grammar:
> var(list) var(sep) var(sublist) matches a production yielding
> var(list), so if there is a var(sep) then the var(list) isn't done
> yet.  You have to have a grammatically concluded var(list) as the
> conditional before you can tack on a var(sublist) as the body.

Probably superfluous to say this now, since we can certainly improve
the documentation without dwelling on the details, but the definition of
a list is given as

  A em(list) is a sequence of zero or more sublists, in which each sublist
  is terminated by `tt(;)', `tt(&)', `tt(&|)', `tt(&!)', or a newline.

So while I agree about the logical implications, if you don't have a
degree in comupter science it might be thoroughly unclear what's
actually going on here.

I'm vaguely moving to the opinion that we should list the SHORT_LOOPS
forms separately with examples rather than by implication, which I
suspect is at the root of why I've always found this bit of the manual
unhelpful.

pws



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