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 coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id HAA11628 for ; Tue, 23 Jul 1996 07:53:24 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id RAA03090; Mon, 22 Jul 1996 17:51:24 -0400 (EDT) Resent-Date: Mon, 22 Jul 1996 17:50:14 -0400 (EDT) From: "Bart Schaefer" Message-Id: <960722145116.ZM10226@candle.brasslantern.com> Date: Mon, 22 Jul 1996 14:51:16 -0700 In-Reply-To: Zoltan Hidvegi "Re: Bug in case stmt with '('" (Jul 22, 9:51pm) References: <199607221951.VAA07888@bolyai.cs.elte.hu> <9607221648.ZM3416@morgan.com> In-Reply-To: segal@morgan.com (Morris M. Siegel) "Re: Bug in case stmt with '('" (Jul 22, 4:48pm) Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.702 02jul96) To: Zoltan Hidvegi , segal@morgan.com (Morris M. Siegel), zsh-users@math.gatech.edu Subject: Re: Bug in case stmt with '(' MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"uEBrM3.0.pk.LU_yn"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/327 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Jul 22, 9:51pm, Zoltan Hidvegi wrote: } Subject: Re: Bug in case stmt with '(' } } Unfortunately there is still an incompatibility in case: } } case foo in } ( f* | b* ) echo yes } esac } } should print yes but in zsh it works as } } case foo in } \ f*\ |\ b*\ ) echo yes;; } esac } } To fix this would be really difficult I think. On Jul 22, 4:48pm, Morris M. Siegel wrote: } Subject: Re: Bug in case stmt with '(' } } Considering the fact that glob patterns in general are supposed to generate } file names, which usually do not contain blanks I dispute that assertion. Ever used a filesystem that's shared with a Macintosh? } zsh might also ignore } unescaped whitespace in glob patterns (in general, not just in 'case' } statements). There's no such thing as "unescaped whitespace in glob patterns." Zsh lexes glob patterns as a STRING token. By the time filename generation gets around to interpreting the string as a glob pattern, any spaces that are left MUST have been "escaped" somehow, to make it through the lexer. Putting parens around the pattern is one such possible quoting. There is exactly one place where we know in advance that we're reading a glob pattern: case statements. Hence I think the fix for this is really quite simple: *** Src/lex.c.0 Thu Jul 18 19:15:13 1996 --- Src/lex.c Mon Jul 22 14:38:56 1996 *************** *** 638,643 **** --- 638,647 ---- if (inblank(c) && !in_brace_param && !pct) act = LX2_BREAK; else { + if (incasepat && pct == 1 && !in_brace_param && iblank(c)) { + c = hgetc(); + continue; + } act = lexact2[STOUC(c)]; c = lextok2[STOUC(c)]; } *************** This works even for: zsh% case "foo bar" in > ((foo bar) | boing) echo yes;; > esac yes zsh% case "foo bar" in > "foo bar" | boing ) echo yes;; > esac yes zsh% case "foo bar" in > foo\ bar | boing ) echo yes;; > esac yes zsh% However, there's another bug lurking in filename generation. Note: zsh% setopt nobadpattern nonomatch zsh% echo ( Make | buy ) zsh: no match -- 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"