Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: anonymous functions, full patch
- X-seq: zsh-workers 25262
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: "Zsh hackers list" <zsh-workers@xxxxxxxxxx>
- Subject: Re: PATCH: anonymous functions, full patch
- Date: Tue, 1 Jul 2008 19:32:20 +0100
- In-reply-to: <237967ef0807011043kf53a910v91867eab4a4f4c6c@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <18441.1214488302@xxxxxxx> <9646.1214491732@thecus> <200806261506.m5QF6aCd019139@xxxxxxxxxxxxxx> <080626101233.ZM2893@xxxxxxxxxxxxxxxxxxxxxx> <200806261729.m5QHSr5F021201@xxxxxxxxxxxxxx> <20080630112722.3e7eb215@news01> <237967ef0807011043kf53a910v91867eab4a4f4c6c@xxxxxxxxxxxxxx>
On Tue, 1 Jul 2008 19:43:49 +0200
"Mikael Magnusson" <mikachu@xxxxxxxxx> wrote:
> I played a bit with this to see what works and what doesn't, and I
> came across this non-working syntax (which is also obviously useless,
> but still):
>
> () a=b
> zsh: parse error near `\n'
This isn't new, you always got this, even if there was a function name
in front. It's there because there's a test that a function body
consists of sufficiently complex code that it can't be simplified to
executing a single shell structure. As this can, you get the error.
That seems an odd thing to test at this point in the code, and the more
I look at it the more I think it should be testing the return value of
the function instead... It's odd this hasn't shown up before, but I
suppose there was a reasonable chance of a parse error occurring before
the parameter had been set to 1.
Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.69
diff -u -r1.69 parse.c
--- Src/parse.c 14 Mar 2008 11:40:59 -0000 1.69
+++ Src/parse.c 1 Jul 2008 18:29:00 -0000
@@ -1687,8 +1687,7 @@
sl = ecadd(0);
pl = ecadd(WCB_PIPE(WC_PIPE_END, 0));
- par_cmd(&c);
- if (!c) {
+ if (!par_cmd(&c)) {
cmdpop();
YYERROR(oecused);
}
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author