From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4018 invoked from network); 16 Sep 2002 15:00:58 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 16 Sep 2002 15:00:58 -0000 Received: (qmail 29282 invoked by alias); 16 Sep 2002 15:00:50 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17680 Received: (qmail 29268 invoked from network); 16 Sep 2002 15:00:48 -0000 From: "Bart Schaefer" Message-Id: <1020916150017.ZM7997@candle.brasslantern.com> Date: Mon, 16 Sep 2002 15:00:17 +0000 In-Reply-To: <1444.1032185019@csr.com> Comments: In reply to Peter Stephenson "Parameter error trapped too late" (Sep 16, 3:03pm) References: <1444.1032185019@csr.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Peter Stephenson , zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH Re: Parameter error trapped too late MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 16, 3:03pm, Peter Stephenson wrote: } Subject: Parameter error trapped too late } } % zsh -c 'fn() { local 30=foo; }; fn' } BUG: parameter recreated with wrong flags } fn:local: 30: can't assign initial value for array The simplest fix appears to be the following patch, which has the effect that instead of this error: schaefer<501> typeset 30=foo zsh: 30: can't assign initial value for array One gets this error: schaefer<501> typeset 30=foo zsh: not an identifier: 30 We could refine the error message if that's desirable, but bash2 gives a similar "not a valid identifier" in that example. Index: builtin.c =================================================================== diff -c -r1.17 builtin.c --- builtin.c 12 Sep 2002 07:59:07 -0000 1.17 +++ builtin.c 16 Sep 2002 14:49:34 -0000 @@ -1909,7 +1909,7 @@ "%s: array elements must be scalar", pname, 0); return NULL; } - } else if (isident(pname)) { + } else if (isident(pname) && !idigit(*pname)) { /* * Create a new node for a parameter with the flags in `on' minus the * readonly flag Index: B02typeset.ztst =================================================================== diff -c -r1.2 B02typeset.ztst --- B02typeset.ztst 1 Sep 2002 16:47:40 -0000 1.2 +++ B02typeset.ztst 16 Sep 2002 14:49:38 -0000 @@ -223,7 +223,7 @@ >scalar a r y # The first declare works around the "not an identifier" bug with -h - declare \! \# \$ * - ? @ + declare \! \# \$ * - ? @ 0 typeset -h +g -m * unset -m * integer i=9 -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net