From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1731 invoked from network); 17 Dec 1998 12:06:08 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 17 Dec 1998 12:06:08 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id GAA01512; Thu, 17 Dec 1998 06:54:46 -0500 (EST) Resent-Date: Thu, 17 Dec 1998 06:54:46 -0500 (EST) Date: Thu, 17 Dec 1998 12:53:14 +0100 (MET) Message-Id: <199812171153.MAA09925@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@math.gatech.edu In-reply-to: "Bart Schaefer"'s message of Wed, 16 Dec 1998 09:53:09 -0800 Subject: Re: PATCH: 3.1.5-pws-3: (subscripts) Re: Problem with associative arrays Resent-Message-ID: <"RtBeR1.0.ZN.54FUs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4831 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Bart Schaefer wrote: > > On Dec 16, 3:31pm, Sven Wischnowsky wrote: > } Subject: Problem with associative arrays > } > } And this time it's for real: > } > } % typeset -A a > } % a[x*]=foo > } zsh: bad math expression: unbalanced stack > } % echo $a[x*] > } foo > } % > } > } The problem is that isident() uses mathevalarg() to skip (!) over the > } contents of a subscript (unless the subscript contains flags). > > isident() seems to be rather inconsistent about strict checking of the > text inside the [ ]. Below is the most obvious fix (#ifdef'd for now). ...minus one `s', it seems: % typeset -A a % a[--foo--]=bar zsh: not an identifier: a[--foo--] Bye Sven *** os/params.c Thu Dec 17 12:20:23 1998 --- Src/params.c Thu Dec 17 12:49:07 1998 *************** *** 663,669 **** /* Require balanced [ ] pairs */ for (s = ss; *(s += strcspn(++ss, "[]")) && s > ss; ss = s) ; ! return (*ss == ']' && !s[1]); #endif } --- 663,669 ---- /* Require balanced [ ] pairs */ for (s = ss; *(s += strcspn(++ss, "[]")) && s > ss; ss = s) ; ! return (*ss == ']' && !ss[1]); #endif } -- Sven Wischnowsky wischnow@informatik.hu-berlin.de