From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-return-43610-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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 d5be1a4f for ; Fri, 5 Oct 2018 17:17:11 +0000 (UTC) Received: (qmail 28531 invoked by alias); 5 Oct 2018 17:16:54 -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: 43610 Received: (qmail 12522 invoked by uid 1010); 5 Oct 2018 17:16:54 -0000 X-Qmail-Scanner-Diagnostics: from out3-smtp.messagingengine.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(66.111.4.27):SA:0(-2.6/5.0):. Processed in 7.168776 secs); 05 Oct 2018 17:16:54 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:references:date :in-reply-to:subject; s=fm1; bh=S+qeOMxDQ0qo9En2N88hjfne6ZHMDN9k v41IxvPJtSI=; b=XHJzhFM9sERtKdyq7vrY/WkIQ5Ab5TCYIdNoHlKwQGitR4WC n2hEkC2hEYJ1Qu5DwPhhDFwkYh7k66BFZU5S40aMQyp8eSZkuHEtKPImf3Vgi0yt ICKsEtmnESINmYrvisfjTO/lqSqffRjyy0HDu/hRnvfMhR8gTDKZKzg//gMv23ab sL8rbjhbj5L29nP+dTaUZh1oDy+md7JADFJKJjqMBEkpTWDxFgjCn52fPIg7h0Cq vyBT5JqJL3V9CEon2r9OAdru7mL96v2LOx+vUEmz9Y0mED0f+BkPmq9FylIZ1QGa y13JDGlRS+ciJJDsKmEDNImHiAFwHjesd1mFSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=S+qeOMxDQ0qo9En2N88hjfne6ZHMDN9kv41IxvPJt SI=; b=WdLQfG4AoQc+STeYqt3PbCk+B67W/M0g4TS0Ak4YFsGS0M/edLiOd9rsp xqP5KWjkvCViQras0XCQXcWxtw+9V2e4Hm0mgiVci/b7lFJX/1XzwObUWmrtsiRF l7nf8MdRipCUWrc0XKCkvKLM9g5AUaORfgNUtTODKxwqjD4bFZ5DmQcDNfmBoPkE lBAE+nOtkMLljwXviByvzGZRaQHyD1PNgy1OQlSoK+iVul5p95zza4xmDRKYGWIo 0hqB3fKx5VCYB+3kQ+YvPBwu5TcyyVRXjW1ecTw4yUGxD338dkY0+SKfC/uXi+3a j5fkyXSRTSMdrndg56EDW21TUjBsw== X-ME-Sender: X-ME-Proxy: Message-Id: <1538759079.2901416.1532150520.23638520@webmail.messagingengine.com> From: Daniel Shahaf To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-929b9749 References: <20181004163158eucas1p234a045be013b5463d8db44314ed217dc~adN28lJmq0822408224eucas1p2F@eucas1p2.samsung.com> <20181005091435eucas1p26edaafb362de339b01c3cb5780fbd108~aq5QQQ6pF1496014960eucas1p2g@eucas1p2.samsung.com> <1538745992.2833942.1531910952.26C1157A@webmail.messagingengine.com> <20181005134800eucas1p22010dd23c9b937d3435e1b757c48f43d~aun_y-rQy2277122771eucas1p2E@eucas1p2.samsung.com> Date: Fri, 05 Oct 2018 17:04:39 +0000 In-Reply-To: <20181005134800eucas1p22010dd23c9b937d3435e1b757c48f43d~aun_y-rQy2277122771eucas1p2E@eucas1p2.samsung.com> Subject: Re: Parse error (lack thereof) on incomplete loops Peter Stephenson wrote on Fri, 05 Oct 2018 13:47 +0000: > On Fri, 2018-10-05 at 13:26 +0000, Daniel Shahaf wrote: > > Can we come up with a one-sided parsing rule for syntactically valid ca= ses? > > That is, a rule that says guarantees that some constructs are syntactic= ally > > valid, but doesn't necessarily say anything about other constructs. >=20 > That's pretty much what the the parser in practice does.=C2=A0=C2=A0If yo= u look at > the code, it's got tests that read... >=20 > - If SHORTLOOPS isn't set panic at this point. >=20 > - Otherwise go on and see if we can get anything sensible out of what > we did find. >=20 > So for example the while loop code has... >=20 > =C2=A0=C2=A0=C2=A0=C2=A0} else if (unset(SHORTLOOPS)) { > YYERRORV(oecused); > =C2=A0=C2=A0=C2=A0=C2=A0} else > par_save_list1(cmplx); >=20 > The case that brought this up is that we don't check the return value > from par_save_list1() (actually a macro at the moment). >=20 > For more explicit rules it's a question of decoding the tests above (if > we got a "do" then blah, else if we got a "{" then etc. etc.). Thanks, but that's not quite what I meant. I meant, we should have a documented rule for which constructs are syntactically valid when SHORT_LOOPS is set. Then whenever a question such as "should raise a parse error?" comes up, we'd answer that according to the rule we'd decided upon in advance. This way the syntax will be predictable. The rule should not be defined in terms of the implementation, since it nee= ds to be able to be used to decide whether the change from 5.5 to 5.6 was a bu= gfix or a regression. Cheers, Daniel