zsh-workers
 help / color / mirror / code / Atom feed
From: "Zefram" <zefram@tao.co.uk>
To: pws@ibmth.df.unipi.it (Peter Stephenson)
Cc: zsh-workers@math.gatech.edu
Subject: Re: PATCH: 3.1.5 - (Sven) Case-insensitive globbing
Date: Mon, 2 Nov 1998 18:06:32 +0000 (GMT)	[thread overview]
Message-ID: <199811021806.SAA10170@diamond.tao.co.uk> (raw)
In-Reply-To: <9811021707.AA24379@ibmth.df.unipi.it> from "Peter Stephenson" at Nov 2, 98 06:07:41 pm

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


  parent reply	other threads:[~1998-11-02 18:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-31 10:14 Bart Schaefer
1998-11-02  9:21 ` Zefram
1998-11-02 17:07   ` Peter Stephenson
1998-11-02 17:45     ` Bruce Stephens
1998-11-02 18:06     ` Zefram [this message]
1998-11-03  8:12       ` Sven Wischnowsky
1998-11-03 12:22         ` Bruce Stephens
1998-11-03 12:47           ` Bruce Stephens
1998-11-03 15:01             ` Zefram
1998-11-03 15:27               ` Bruce Stephens
     [not found]         ` <MLIST_vbn269dkyw.fsf@snake.isode.com>
1998-11-03 18:09           ` Jarkko Hietaniemi
1998-11-03 18:54             ` Zefram
1998-11-03 19:14               ` Jarkko Hietaniemi
1998-11-03 19:27                 ` Zefram
1998-11-03 19:36                   ` Jarkko Hietaniemi
1998-11-04 18:48                     ` Bart Schaefer
1998-11-05  9:26                       ` PATCH: 3.1.5: Case-insensitive globbing (2) Peter Stephenson
1998-11-05 18:15                         ` Bart Schaefer
1998-11-06 11:01                           ` PATCH: 3.1.5: doc fix, was re: Case-insensitive globbing Peter Stephenson
1998-11-06 13:43                             ` Bruce Stephens
1998-11-06  9:24                     ` Approximate matching Bart Schaefer

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=199811021806.SAA10170@diamond.tao.co.uk \
    --to=zefram@tao.co.uk \
    --cc=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@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).