From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id RAA21229 for ; Mon, 22 Jul 1996 17:04:25 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id CAA18843; Mon, 22 Jul 1996 02:52:30 -0400 (EDT) Resent-Date: Mon, 22 Jul 1996 02:52:30 -0400 (EDT) From: "Bart Schaefer" Message-Id: <960721235322.ZM22844@candle.brasslantern.com> Date: Sun, 21 Jul 1996 23:53:22 -0700 In-Reply-To: "Bart Schaefer" "Re: Bug in case stmt with '('" (Jul 21, 11:31pm) References: <199607191600.SAA08613@bolyai.cs.elte.hu> <9607211853.ZM979@morgan.com> <960721233102.ZM22696@candle.brasslantern.com> Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.702 02jul96) To: zsh-workers@math.gatech.edu, Zoltan Hidvegi Subject: Re: Bug in case stmt with '(' MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"9rXfS.0.Ic4.jKoyn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1734 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Jul 21, 11:31pm, Bart Schaefer wrote: } Subject: Re: Bug in case stmt with '(' } } I think we should leave it POSIX-style. } } However, there is a remaining bug in Zoltan's patch. } } zagzig<8> case foo in } > (foo) echo yes;; } zsh: parse error near `echo' } } Apparently there still needs to be at least one token between the close } paren and the first word of the actual command. I thought Zoltan's "if" cascade looked a little too easy. Here's the fix. *** Src/parse.c.0 Fri Jul 19 11:17:12 1996 --- Src/parse.c Sun Jul 21 23:45:10 1996 *************** *** 522,544 **** str2[sl] = Bar; str2[sl+1] = '\0'; str = str2; ! } else if (tok == STRING) { ! char *str2; int sl = strlen(str); ! if (str[sl - 1] != Bar) ! YYERRORV; ! str2 = ncalloc(sl + strlen(tokstr) + 1); ! strcpy(str2, str); ! strcpy(str2 + sl, tokstr); ! str = str2; ! } else { ! /* POSIX allows (foo*) patterns */ ! char *s = str; ! if (skipparens(Inpar, Outpar, &s) || *s) ! YYERRORV; ! break; } } addlinknode(pats, str); --- 522,547 ---- str2[sl] = Bar; str2[sl+1] = '\0'; str = str2; ! } else { int sl = strlen(str); ! if (str[sl - 1] != Bar) { ! /* POSIX allows (foo*) patterns */ ! char *s = str; ! if (skipparens(Inpar, Outpar, &s) || *s) ! YYERRORV; ! break; ! } else { ! char *str2; ! ! if (tok != STRING) ! YYERRORV; ! str2 = ncalloc(sl + strlen(tokstr) + 1); ! strcpy(str2, str); ! strcpy(str2 + sl, tokstr); ! str = str2; ! } } } addlinknode(pats, str); *************** -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.nbn.com/people/lantern New male in /home/schaefer: >N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"