From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: schaefer@nbn.com
Cc: zsh-workers@math.gatech.edu
Subject: Re: Misc. unresolved stuff
Date: Fri, 19 Jul 1996 21:30:30 +0200 (MET DST) [thread overview]
Message-ID: <199607191930.VAA09905@bolyai.cs.elte.hu> (raw)
In-Reply-To: <960719111210.ZM3055@candle.brasslantern.com> from Bart Schaefer at "Jul 19, 96 11:12:10 am"
> In article 1397, Zoltan said he'd fix $[$[1+2]+3], and apparently he has.
> Is there some reason why $((...)) doesn't nest? I asked in article 1414
> whether there other differences between $[...] and $((...)). There's
> exactly one mention of $((...)) in zshexpn.man, which says only that it's
> the same as $[...].
That's a bug again. The fix is below.
> In article 1426, I asked why array subscript flags such as $foo[(f)...]
> don't work with $foo[@] and $foo[*]. Does anyone else want them to?
That's a bit more difficult because in this case $foo should be split.
$foo[(f)@] is interpreted in params.c while splitting is done in subst.c so
this cahnge is not trivial (but it is probably not difficult).
> In article 1428, I pointed out that zsh's "getopts" builtin doesn't seem
> to properly handle some error cases, by comparison to bash. I don't have
> ksh to compare to that. Does anyone think "getopts" is a problem?
I think that zsh getopts is ksh and POSIX compatible. I do not use getopts
but you can compare it with the ksh version. pdksh is free and the AT&T
ksh93 can also be downloaded and used free from
http://www.research.att.com/orgs/ssr/book/reuse/.
> In zsh-users article 257, I asked why there's no (:L) modifier, to go
> with the (L) flag; similarly (U) and (:U). I also hoped for a better
> error message for unrecognized modifiers. Any comment?
I think we can live with this inconsistency. The biggest problem here that
there are too few letters in the alphabet. Probably that's why (L) is not
(l). But there is a bug in the parameter modifier code when a modifier is
used on an empty array and the diagnostics can certainly be improved.
Tell me if you like the behaviour after applying this patch.
Zoltan
rcsdiff -qc -kk -r2.41 -r2.43 Src/subst.c
*** Src/subst.c
--- Src/subst.c 1996/07/19 19:25:14 2.43
***************
*** 128,148 ****
char endchar;
int l1, l2;
! if (*str == Inpar)
! endchar = Outpar, str[-1] = '\0';
! else
! endchar = *str, *str = '\0';
!
! while (*++str != endchar)
! #ifdef DEBUG
! if (!*str) {
! /* This shoud never happen */
! zerr("Oops. parse error in command substitution", NULL, 0);
! return NULL;
! }
! #else
! ;
! #endif
*str++ = '\0';
if (endchar == Outpar && str2[1] == '(' && str[-2] == ')') {
/* Math substitution of the form $((...)) */
--- 128,146 ----
char endchar;
int l1, l2;
! if (*str == Inpar) {
! endchar = Outpar;
! str[-1] = '\0';
! if (skipparens(Inpar, Outpar, &str))
! DPUTS(1, "Oops. parse error in command substitution");
! str--;
! } else {
! endchar = *str;
! *str = '\0';
!
! while (*++str != endchar)
! DPUTS(!*str, "Oops. parse error in command substitution");
! }
*str++ = '\0';
if (endchar == Outpar && str2[1] == '(' && str[-2] == ')') {
/* Math substitution of the form $((...)) */
***************
*** 1201,1207 ****
if (!isarr)
modify(&val, &s);
else {
! char *ss = s;
char **ap = aval;
char **pp = aval = (char **)ncalloc(sizeof(char *) * (arrlen(aval) + 1));
--- 1199,1205 ----
if (!isarr)
modify(&val, &s);
else {
! char *ss;
char **ap = aval;
char **pp = aval = (char **)ncalloc(sizeof(char *) * (arrlen(aval) + 1));
***************
*** 1209,1215 ****
--- 1207,1226 ----
ss = s;
modify(pp++, &ss);
}
+ if (pp == aval) {
+ char t[] = "";
+ ss = s;
+ s = t;
+ modify(&s, &ss);
+ }
s = ss;
+ }
+ if (inbrace && *s != Outbrace) {
+ if (*s == ':' && !imeta(s[1]))
+ zerr("unrecognized modifier `%c'", NULL, s[1]);
+ else
+ zerr("unrecognized modifier", NULL, 0);
+ return NULL;
}
}
}
next prev parent reply other threads:[~1996-07-19 19:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-19 18:12 Bart Schaefer
1996-07-19 19:30 ` Zoltan Hidvegi [this message]
1996-07-19 19:59 ` Bart Schaefer
1996-07-19 20:27 ` Zoltan Hidvegi
1996-07-19 20:38 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199607191930.VAA09905@bolyai.cs.elte.hu \
--to=hzoli@cs.elte.hu \
--cc=schaefer@nbn.com \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).