Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Parse error (lack thereof) on incomplete loops
- X-seq: zsh-workers 43610
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Parse error (lack thereof) on incomplete loops
- Date: Fri, 05 Oct 2018 17:04:39 +0000
- 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==
- In-reply-to: <20181005134800eucas1p22010dd23c9b937d3435e1b757c48f43d~aun_y-rQy2277122771eucas1p2E@eucas1p2.samsung.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20181004154947epcas4p2441e109a2c4e060bf39f0f6925e98241@epcas4p2.samsung.com> <CAH+w=7awbwDuX2RXcB7pK6Hhbi8fjs=NvwkTAEGmY7gvNpLCqA@mail.gmail.com> <20181004163158eucas1p234a045be013b5463d8db44314ed217dc~adN28lJmq0822408224eucas1p2F@eucas1p2.samsung.com> <CAH+w=7ZLJ5iiph8jpsSiLKdhkozqH+o_kJk7=zfK3DLBegft8g@mail.gmail.com> <20181005091435eucas1p26edaafb362de339b01c3cb5780fbd108~aq5QQQ6pF1496014960eucas1p2g@eucas1p2.samsung.com> <1538745992.2833942.1531910952.26C1157A@webmail.messagingengine.com> <20181005134800eucas1p22010dd23c9b937d3435e1b757c48f43d~aun_y-rQy2277122771eucas1p2E@eucas1p2.samsung.com>
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 cases?
> > That is, a rule that says guarantees that some constructs are syntactically
> > valid, but doesn't necessarily say anything about other constructs.
>
> That's pretty much what the the parser in practice does. If you look at
> the code, it's got tests that read...
>
> - If SHORTLOOPS isn't set panic at this point.
>
> - Otherwise go on and see if we can get anything sensible out of what
> we did find.
>
> So for example the while loop code has...
>
> } else if (unset(SHORTLOOPS)) {
> YYERRORV(oecused);
> } else
> par_save_list1(cmplx);
>
> 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).
>
> 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 <this case> 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 needs
to be able to be used to decide whether the change from 5.5 to 5.6 was a bugfix
or a regression.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author