From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4564 invoked from network); 2 Nov 1998 18:15:06 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 2 Nov 1998 18:15:06 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id NAA23095; Mon, 2 Nov 1998 13:08:05 -0500 (EST) Resent-Date: Mon, 2 Nov 1998 13:08:05 -0500 (EST) Message-Id: <199811021806.SAA10170@diamond.tao.co.uk> Subject: Re: PATCH: 3.1.5 - (Sven) Case-insensitive globbing To: pws@ibmth.df.unipi.it (Peter Stephenson) Date: Mon, 2 Nov 1998 18:06:32 +0000 (GMT) From: "Zefram" Cc: zsh-workers@math.gatech.edu In-Reply-To: <9811021707.AA24379@ibmth.df.unipi.it> from "Peter Stephenson" at Nov 2, 98 06:07:41 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"_pCP.0.oe5.5KVFs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4506 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Peter Stephenson wrote: >I've got two possible implentations to propose (I have them both >working, the differences aren't so great). Both are based on the way >it's done in perl 5: the closure operator, in our case #, at the >start of a group signifies that flags follow. This doesn't clash with >any existing syntax. Obviously you need EXTENDED_GLOB set. Good. I'd considered this extension mechanism, but for some reason dismissed it as impractical -- maybe I was confused by the dependence on EXTENDED_GLOB. >Syntax 1 Syntax 2 >(#ifoo)bar ((#i)foo)bar match FOObar FoObar fOobar, not FOOBAR >bar(#ifoo) bar(#i)foo same with the bits the other way round >(#lfooBAR) (#l)fooBAR match FOOBAR FoOBAR fOoBAR, not foobar >(#ifoo(#cbar)) (#i)foo(#c)bar same as first example; #c negates i or l Let's go for the more Perl-like syntax. I think your syntax 1 is slightly more logical, but the difference is minimal so I think it would be wise to follow precedent. >#s (for significant) could be an alternative to #c; #l corresponds to >Sven's (f) qualifier, i.e. only lower case letters in the pattern >match case-insensitively in the target string. If there were just two senses to the flag, I'd argue for #i and #I (#I being the opposite of #i). In this case perhaps #i, #l and #I could be used. I'd prefer a better mnemonic for the one-way case insensitivity, though. > The only real bind with this is with KSH_GLOB, where the >second set of examples would have to become @(@(#i)foo)bar, >@(#l)fooBAR and @(#i)foo@(#c)bar. Considering the circumstances under which KSH_GLOB will be used, I don't think that making it pleasant to mix with EXTENDED_GLOB is a major consideration. >shell doesn't need the @ if it comes across the left parenthesis >before anything else, so you can drop the first @ in each case, but >this is deliberately undocumented.) It's not explicitly documented, but it's intentional, and should be derivable from the documentation. Basically, KSH_GLOB doesn't turn off the effects of "("; it just makes certain characters special immediately before a "(". >One point about this is that you need to turn on case-insensitivity at >any segment of the path where you need it: I'm rather dubious about this. () grouping doesn't have to be on a component-by-component basis; I think these modifiers' effects should last up to the end of the textual group, even if this spans multiple pathname components. It's the principle of least surprise. -zefram