From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-return-43615-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIMWL_WL_MED autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id ffe58b5b for ; Sun, 7 Oct 2018 03:52:23 +0000 (UTC) Received: (qmail 15153 invoked by alias); 7 Oct 2018 03:52:07 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43615 Received: (qmail 15611 invoked by uid 1010); 7 Oct 2018 03:52:06 -0000 X-Qmail-Scanner-Diagnostics: from mail-lf1-f45.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.167.45):SA:0(-1.9/5.0):. Processed in 3.973003 secs); 07 Oct 2018 03:52:06 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kgsu9BlhyzwgG9baWaGrt5S4g5TXDoUSYwscJ9Whysw=; b=ZQYWP9M0gARbekEGErl+MVOUmdkJPWHA0lVn73NeHZ0iS2Jg1ecmnhFAT3ox0AB5ho SMms0n5jyDgjHqFAvCXwfRqO65RfSW7yr1sKu1zRH7sAYSxF8OlbkqOYmAMnk1P7Sztv tk3YGCsOjLdU4A2KMwCVxWMHbGUnC1cIJ5fC9UPQh8W/p/Of+mhpnNR56mZ7+UGlLT36 KY3kr3UwVFWBhKvo7y2J1lSN2mxguZl06qi5QyNjFxe5WvugqnnPTdJ8NaP9Ywha03xN bioBzp6KLLcW6ZFcK9J0nNDv8gkh1cPlqI3dp3FvdRuMn/dryDnlhpvtFiF0XzzpmPyn YtQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kgsu9BlhyzwgG9baWaGrt5S4g5TXDoUSYwscJ9Whysw=; b=klYut/LCYpQdzvGcDXCtSnIEnkQ5tQEuB6uy0KPnR1NrDBIfo5ufaXVANYSJGemBlW ruLkoYvCnxZbf9QsXkMgop6hAEgfqA+r0GbqZfCuML0SFzO/Ejaca/SK0C2+sFkRQhWV j1W+cJKTrjH/X9itSdUjTih2Pxg0whEHtm50KS5WA+3P+qGLwD8EvjNm0wxFROfvIZFf mzH/nFQIRme6uymHxghVb2km8tOMWAosJHdkzzx7ClRDXdtpW7RVurcF0qEnvsmlKjpf DinS/bC3XwKmAYXlS/5NqlVHVzr8flS7EXWo3KMpxZ4p4UWwwkmXzjPEY9ahTDzzp82j w9hg== X-Gm-Message-State: ABuFfoiSFtb2XxI32puned9QXFX/ICyTjygfo/3vJbjtoG2KBmKgIRni /Xi5vAX0ohnyka4Ouy9xhITIWhDQwvxCb8Cjg75s4g== X-Google-Smtp-Source: ACcGV60Fmgc2yOxB3XnYHxPsKd3aOzqRzVMZkvhfK9euRAMp4Rdx3/fu6L0rlJ+YojphHiSQVrNlUfDggCpg2QfDvj0= X-Received: by 2002:a19:c189:: with SMTP id r131-v6mr9175251lff.59.1538884317551; Sat, 06 Oct 2018 20:51:57 -0700 (PDT) MIME-Version: 1.0 References: <20181004163158eucas1p234a045be013b5463d8db44314ed217dc~adN28lJmq0822408224eucas1p2F@eucas1p2.samsung.com> <20181005091435eucas1p26edaafb362de339b01c3cb5780fbd108~aq5QQQ6pF1496014960eucas1p2g@eucas1p2.samsung.com> <20181006192104.4a66da1a@pws-HP.localdomain> In-Reply-To: <20181006192104.4a66da1a@pws-HP.localdomain> From: Bart Schaefer Date: Sat, 6 Oct 2018 20:51:45 -0700 Message-ID: Subject: Re: Parse error (lack thereof) on incomplete loops To: Peter Stephenson Cc: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" So ... I've been looking through the git history of Doc/Zsh/grammar.yo ... On Sat, Oct 6, 2018 at 11:21 AM Peter Stephenson wrote: > > On Fri, 5 Oct 2018 18:47:01 -0700 > Bart Schaefer wrote: > > 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. > > Looked at this a bit more and I have fairly major doubts about the > documentation (although I don't mean about the intention suggested by > Bart which does seem reaonsble). 2001-07-05 Peter Stephenson + * 15264: Doc/Zsh/grammar.yo: improve description of use of + variant complex command forms to avoid confusing the present + writer. + So apparently you've had doubts about this for a long time. > The short versions below only work if var(sublist) is of the form `tt({) > var(list) tt(})' or if the tt(SHORT_LOOPS) option is set. This appears to be a reference to item(tt(if) var(list) var(sublist)) and similar doc of "for", "repeat", and "select". These also have the "{ list }" forms documented separately so I don't know why the "sublist" form of while and until was never made explicit (see guess at it below). > so maybe that "{ list }" should really be "sublist"? Or the form should just be added for congruence with the doc of the other complex commands. If they'd all been there separately in the first place, the sentence about "var(sublist) is of the form ..." might never have been needed. It's also quite likely (I haven't dug into this in the Src commits) that "while" and "until" originally did NOT work with only a sublist and that they do is another accidental feature from some even earlier parser change. > 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. > Perhapse someone who may have to be Bart (I can't say I consider myself > an expert in this having only just found out what's going on and I can't > say anyone else is likely to, either) should suggest some words of > wisdom to document SHORT_LOOPS as separate text rather than as part of > the variant syntax section? I don't mind writing this up. I may have time to take a stab at this tomorrow, can't promise. Maybe the above is a start. I also don't presently have a computer with "yum" installed/working.