zsh-workers
 help / color / mirror / code / Atom feed
* Re:  PATCH: 3.1.5-pws-3: (subscripts) Re: Problem with associative arrays
@ 1998-12-17 11:53 Sven Wischnowsky
  1998-12-17 12:46 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 1998-12-17 11:53 UTC (permalink / raw)
  To: zsh-workers


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


^ permalink raw reply	[flat|nested] 3+ messages in thread
* Problem with associative arrays
@ 1998-12-16 14:31 Sven Wischnowsky
  1998-12-16 17:53 ` PATCH: 3.1.5-pws-3: (subscripts) " Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 1998-12-16 14:31 UTC (permalink / raw)
  To: zsh-workers


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).

I don't have the time to fix this now since our LAN will soon be
upgraded but if noone else gives it a try I'll have a lokk at it.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-12-17 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-17 11:53 PATCH: 3.1.5-pws-3: (subscripts) Re: Problem with associative arrays Sven Wischnowsky
1998-12-17 12:46 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
1998-12-16 14:31 Sven Wischnowsky
1998-12-16 17:53 ` PATCH: 3.1.5-pws-3: (subscripts) " Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).