From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4222 invoked from network); 18 Sep 2002 15:08:17 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 18 Sep 2002 15:08:17 -0000 Received: (qmail 28975 invoked by alias); 18 Sep 2002 15:07:34 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17692 Received: (qmail 28950 invoked from network); 18 Sep 2002 15:07:31 -0000 From: "Bart Schaefer" Message-Id: <1020918150700.ZM10605@candle.brasslantern.com> Date: Wed, 18 Sep 2002 15:07:00 +0000 In-Reply-To: <11934.1032191960@csr.com> Comments: In reply to Peter Stephenson "Re: PATCH Re: Parameter error trapped too late" (Sep 16, 4:59pm) References: <11934.1032191960@csr.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH (revised) Re: Parameter error trapped too late MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 16, 4:59pm, Peter Stephenson wrote: } Subject: Re: PATCH Re: Parameter error trapped too late } } > 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. } } Yes, but bash doesn't allow `30=foo' as a normal assignment whereas zsh } does, so I think a different error message here might be better. } Something like `identifier not allowed in this context'. How about the following, then. Is there any reason that zerrnam() was not already being used for the "not an identifier" complaint? To pretend that the error came from the parser, perhaps? Bash2's error in this same case includes the name of the command. Index: builtin.c =================================================================== RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/builtin.c,v retrieving revision 1.17 diff -c -r1.17 builtin.c --- builtin.c 12 Sep 2002 07:59:07 -0000 1.17 +++ builtin.c 18 Sep 2002 14:49:06 -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 @@ -1918,7 +1918,10 @@ DPUTS(!pm, "BUG: parameter not created"); pm->ct = auxlen; } else { - zerr("not an identifier: %s", pname, 0); + if (isident(pname)) + zerrnam(cname, "not valid in this context: %s", pname, 0); + else + zerrnam(cname, "not an identifier: %s", pname, 0); return NULL; } -- 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