From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: segal@morgan.com (Morris M. Siegel)
Cc: zsh-users@math.gatech.edu
Subject: Re: Suggested "case" syntax extension
Date: Tue, 9 Jul 1996 23:07:21 +0200 (MET DST) [thread overview]
Message-ID: <199607092107.XAA18460@bolyai.cs.elte.hu> (raw)
In-Reply-To: <9607091609.ZM9713@morgan.com> from "Morris M. Siegel" at "Jul 9, 96 04:09:07 pm"
> > case foo in
> > (f*) echo yes;;
> > (*) echo no;;
> > esac
> >
> > works.
>
> I'm glad to learn this has already been implemented. (The last time I tried it
> was with 2.6-beta20, I believe.) However, I double-checked in the zsh-3.0-pre2
> distribution, and both man/man1/zshmisc.1 and Doc/zshmisc.man lack any mention
> of an optional leading '('. This should be fairly easy to remedy.
Here it is. It also improves parsing a little bit.
Zoltan
*** Src/parse.c 1996/07/08 01:56:51 2.16
--- Src/parse.c 1996/07/09 20:57:16
***************
*** 488,494 ****
lists = newlinklist();
for (;;) {
char *str;
- int barct;
while (tok == SEPER)
yylex();
--- 488,493 ----
***************
*** 503,515 ****
break;
}
str = tokstr;
- barct = 0;
yylex();
while (tok == BAR) {
char *str2;
int sl = strlen(str);
- barct++;
yylex();
if (tok == OUTPAR) {
str2 = ncalloc(sl + 2);
--- 502,512 ----
***************
*** 532,538 ****
incmdpos = 1;
if (tok != OUTPAR) {
/* POSIX allows (foo*) patterns */
! if (barct || str[strlen(str)-1] != Outpar)
YYERRORV;
} else
yylex();
--- 529,537 ----
incmdpos = 1;
if (tok != OUTPAR) {
/* POSIX allows (foo*) patterns */
! char *s = str;
!
! if (skipparens(Inpar, Outpar, &s) || *s)
YYERRORV;
} else
yylex();
*** Doc/zshmisc.man 1996/07/07 16:00:21 2.10
--- Doc/zshmisc.man 1996/07/09 21:00:13
***************
*** 172,178 ****
.PP
.PD 0
.TP
! \fBcase\fP \fIword\fP \fBin\fP [ \fIpattern\fP ) \fIlist\fP ;; ] ... \fBesac\fP
Execute the \fIlist\fP associated with the first \fIpattern\fP
that matches \fIword\fP, if any. The form of the patterns
is the same as that used for filename generation. See
--- 172,178 ----
.PP
.PD 0
.TP
! \fBcase\fP \fIword\fP \fBin\fP [ [\fB(\fP] \fIpattern\fP \fB)\fP \fIlist\fP ;; ] ... \fBesac\fP
Execute the \fIlist\fP associated with the first \fIpattern\fP
that matches \fIword\fP, if any. The form of the patterns
is the same as that used for filename generation. See
***************
*** 181,187 ****
.PP
.PD 0
.TP
! \fBcase\fP \fIword\fP \fB{\fP [ \fIpattern\fP ) \fIlist\fP ;; ] ... \fB}\fP
Another form of \fBcase\fP.
.PD
.PP
--- 181,187 ----
.PP
.PD 0
.TP
! \fBcase\fP \fIword\fP \fB{\fP [ [\fB(\fP] \fIpattern\fP \fB)\fP \fIlist\fP ;; ] ... \fB}\fP
Another form of \fBcase\fP.
.PD
.PP
*** Doc/zsh.texi 1996/07/09 17:11:50 2.7
--- Doc/zsh.texi 1996/07/09 21:02:23
***************
*** 616,622 ****
@item repeat @var{word} @var{sublist}
This is a short form of @code{repeat}.
! @item case @var{word} in [ @var{pattern} ) @var{list} ;; ] @dots{} esac
@findex case
@cindex case selection
@cindex selection, case
--- 616,622 ----
@item repeat @var{word} @var{sublist}
This is a short form of @code{repeat}.
! @item case @var{word} in [ [(] @var{pattern} ) @var{list} ;; ] @dots{} esac
@findex case
@cindex case selection
@cindex selection, case
***************
*** 624,630 ****
matches @var{word}, if any. The form of the patterns is the same as
that used for filename generation. @xref{Filename Generation}.
! @item case @var{word} @{ [ @var{pattern} ) @var{list} ;; ] @dots{} @}
Another form of @code{case}.
@item select @var{name} [ in @var{word} @dots{} ]
--- 624,630 ----
matches @var{word}, if any. The form of the patterns is the same as
that used for filename generation. @xref{Filename Generation}.
! @item case @var{word} @{ [ [(] @var{pattern} ) @var{list} ;; ] @dots{} @}
Another form of @code{case}.
@item select @var{name} [ in @var{word} @dots{} ]
prev parent reply other threads:[~1996-07-09 21:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-08 23:46 Morris M. Siegel
1996-07-09 0:33 ` Zoltan Hidvegi
1996-07-09 20:09 ` Morris M. Siegel
1996-07-09 21:07 ` Zoltan Hidvegi [this message]
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=199607092107.XAA18460@bolyai.cs.elte.hu \
--to=hzoli@cs.elte.hu \
--cc=segal@morgan.com \
--cc=zsh-users@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).