From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-return-43611-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=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 3ac5100a for ; Sat, 6 Oct 2018 01:47:51 +0000 (UTC) Received: (qmail 13991 invoked by alias); 6 Oct 2018 01:47:32 -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: 43611 Received: (qmail 19220 invoked by uid 1010); 6 Oct 2018 01:47:30 -0000 X-Qmail-Scanner-Diagnostics: from mail-lj1-f176.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.208.176):SA:0(-1.9/5.0):. Processed in 10.440447 secs); 06 Oct 2018 01:47:30 -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=fbIWSzPx7a8M3XMvJyn5dtjJnF5jFZy9ta4hMOwbctM=; b=j3hzdHc6CzPfU4jEPQU0s05jgx8A7UYRs/00AclxDOGXUp6G1v59mMciamLKLgubti WP2DtkZ/xNO+2O+R8sHCoFveNgWBIVJo4Gy1Frx9ySC8XvtQRQsvNWVxKDFDFGw2vhad pSaRMjHmHHplM9jMHQyhGLI/zzh8ZZs/JcCNXuVoQe/vfscKLHEzejH0UQXckUUfeLm3 O/x+kaucvr3wgtHB2bacFuebkSMECnGxgmNuBjwHfcB16dgNJMVr6aTRn6YXYPOpBreh wlyIgoFAiSkke/QeX3iYcbsNJGxbBo5rmo78Xwl8MdRcTew2ur0Cq2NlcHAcPXOcZfV2 du3Q== 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=fbIWSzPx7a8M3XMvJyn5dtjJnF5jFZy9ta4hMOwbctM=; b=oD/VDS2RxUmqeo++RrFMqkP2GKf3otzalhFbeOI2dhGyDrvEcUDAH7BgJvvFSlNARi 2j3n7ZFe2I0iUOSZkbnsvExAbmFwHy0BOdXzGGaE0/IJlvf4LAMoTKvxeV5FnOoUC6UY LJ+1PACkhCGs3dHts7/w3zk3bhuiJBYVuiMfnayvKLGIWyl/XlLAjaKXVNGxblTK9gxf dLr85uVFXIXDFwknimQ84TgCHFWK8QcMO+vT0Em5vLDqcccevRMg3oWoCJzlaqoEco6q mbiiwTTds4fEt8ZAqzhv2IJd19yWvXBDXXaCgq6mU8z1SLH2FnO3EHOO5WrWHIV9ffji eIVQ== X-Gm-Message-State: ABuFfohLWwgUJF6ZMZorOh7K21Etsu8pPgouQf7AdX4V7Q9ivXxM1r2Q FuMmORvVZiQw8auEwd4iW+bQr/wNts+xl2AOWsInig== X-Google-Smtp-Source: ACcGV63nk05xX3T0vHnTO21Tmgb0jTW33Mtrppz7WFiYeFnKZOGyImyyWPKRFRZexvOrwWcy2cBeDCCCsgWPoR0NXYQ= X-Received: by 2002:a2e:6353:: with SMTP id x80-v6mr8396629ljb.11.1538790434214; Fri, 05 Oct 2018 18:47:14 -0700 (PDT) MIME-Version: 1.0 References: <20181004163158eucas1p234a045be013b5463d8db44314ed217dc~adN28lJmq0822408224eucas1p2F@eucas1p2.samsung.com> <20181005091435eucas1p26edaafb362de339b01c3cb5780fbd108~aq5QQQ6pF1496014960eucas1p2g@eucas1p2.samsung.com> In-Reply-To: <20181005091435eucas1p26edaafb362de339b01c3cb5780fbd108~aq5QQQ6pF1496014960eucas1p2g@eucas1p2.samsung.com> From: Bart Schaefer Date: Fri, 5 Oct 2018 18:47:01 -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" On Fri, Oct 5, 2018 at 2:14 AM Peter Stephenson wrote: > > The original expression is parsed as > > { > while { > false > while false; do > done > }; do > done > } > > which is an infinite loop because of the point above. [...] However, > apart from that there's nothing new [...] The only new feature is that all > the "do ... done" clause has become optional if it's possible to infer > there's nothing there. That seems to me entirely consistent. I would contend that the point of SHORT_LOOPS is not to be able to omit the loop body, it's to be able to abbreviate the syntax that delimits the loop conditions and separates them from the loop body. But of what possible use, for example, is { repeat 5 } which this "accidental feature" allows? Or { select foo } or { for x } ? And if { for x } is allowed, why is { for x in z } an error, particularly if you're arguing that it's obvious the "do-done" is meant to be empty? Why should it have to be { for x in z; } when a trailing semicolon is not required in other brace expressions? > 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.