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 FAA11527 for ; Tue, 23 Jul 1996 05:56:15 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id PAA00999; Mon, 22 Jul 1996 15:54:34 -0400 (EDT) Resent-Date: Mon, 22 Jul 1996 15:53:35 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199607221951.VAA07888@bolyai.cs.elte.hu> Subject: Re: Bug in case stmt with '(' To: segal@morgan.com (Morris M. Siegel) Date: Mon, 22 Jul 1996 21:51:48 +0200 (MET DST) Cc: schaefer@nbn.com, zsh-users@math.gatech.edu In-Reply-To: <9607221526.ZM3177@morgan.com> from "Morris M. Siegel" at "Jul 22, 96 03:26:46 pm" Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368 X-Mailer: ELM [version 2.4ME+ PL16 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"UqrNp1.0.hE.-mzyn"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/324 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > I'm ready to believe that my suggestion doesn't simplify the parser It would allow removing three lines. [...] > What I am suggesting is that the trailing ')' (which if present is UNbalanced) > not be required to be present. I.e., each well-formed case-prefix pattern > (which may have internal parens or '|'s) is terminated by an [external] > '|', ')', or whitespace; if by whitespace, then the parser considers the > following token: if it is '|' or ')', then parsing of the case-prefix continues, > else the case-prefix is considered complete (the parser regards the whitespace > as equivalent to a trailing ')', if you will), and the token is taken to be > the initial token of the case-clause body. Accordingly, I believe that There is no whitespace token. Whitespace is a separator and not a token. Note that case foo in f* | b* ) echo yes;; esac is a valid case statement. Autoconf use this kind of case in many places. Allowing space around | makes the script more readable. This means that your new syntax would introduce an ambiguity: case foo in f* | echo echo yes;; esac The question is wether the first echo is part of the pattern of a command and | denotes an empty pattern. Of course you may say that if a pattern ends in a trailing | it must be followed by a ). It would really mean that 3 line simplification in the code but it would make the syntax more complicated. It think that case works pretty well after my patch and Bart's latest patch. 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. Zoltan