From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14482 invoked from network); 2 Jun 2002 17:57:45 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 2 Jun 2002 17:57:45 -0000 Received: (qmail 3267 invoked by alias); 2 Jun 2002 17:57:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17273 Received: (qmail 3252 invoked from network); 2 Jun 2002 17:57:38 -0000 To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Subject: PATCH: parsing inner function definition. Date: Sun, 02 Jun 2002 18:58:25 +0100 From: Peter Stephenson Message-Id: <20020602175830.835C41C0B4@pwstephenson.fsnet.co.uk> I've been hacking Eprog to provide reference counts, which should allow code chunks to be freed immediately they stop being used instead of at the outermost command level. This seems to be going OK so far, but I'd better check it a bit more before letting it loose on the world. Meanwhile, a typo revealed this nasty bug in parsing which has been there a long time (and hence this will go on the 4.0 line, too). % outer() { inner(); } % Whoops, that should have been a parse error. Now run outer, then inner, and you will see a segmentation violation or something equally nasty. The easiest fix I can see in this case is the following, but it may well be there is more to it. By the way, this bug showed up by way of attempting to parse the non-standard form `fn() print code goes directly here;' which I doubt if anyone ever uses. Hence another attempt to fix it would be to allow this form and insert a dummy Eprog at this point. But I don't like that as much. Note that, owing to numerous excuses for not working (e.g. the Queen's Golden Jubilee, the world cup, ...) I will be fairly unresponsive until Wednesday. Index: Src/parse.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/parse.c,v retrieving revision 1.33 diff -u -r1.33 parse.c --- Src/parse.c 7 Mar 2002 16:20:04 -0000 1.33 +++ Src/parse.c 2 Jun 2002 17:44:08 -0000 @@ -1590,6 +1590,8 @@ pl = ecadd(WCB_PIPE(WC_PIPE_END, 0)); par_cmd(&c); + if (!c) + YYERROR(oecused); set_sublist_code(sl, WC_SUBLIST_END, 0, ecused - 1 - sl, c); set_list_code(ll, (Z_SYNC | Z_END), c); -- Peter Stephenson Work: pws@csr.com Web: http://www.pwstephenson.fsnet.co.uk