Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: rewrite of completion matching



Bart Schaefer wrote:
> OK, then what do each of the following mean, and how could I figure it
> out from the documentation?

Well, by reading it, obviously.  Here's what I think it says, please tell
me if you think it says something different and what I should do about
it since there's no point in me simply playing guessing games about what
you think it should say.

- [:lower:] matches [:upper:] explicitly for one pair of characters (a/A)
  and vice versa.  This is the only really useful case for
  correspondence classes.  (Consequently, quite possibly this is the only one
  worth mentioning under the heading of correspondence classes to
  avoid complicating the issue.)
- [:ANY:] matches [:ANY:] explicitly character by character (X matches X for
  any X that matches [:ANY:])
- Anything else is no different from character classes on the
  appropriate side.

The only particular caes are:

>   m:{[:lower:]0-9}={[:upper:][:digit:]}

0-9 vs. [:digit:] isn't documented as working, so avoid.  I think I know
what it does but it doesn't appear useful and I don't want people using
it.

>   m:{[:lower:][:digit:]}={[:alnum:]}

The hanging [:digit:] is treated as an ordinary character class; that's
already documented for bits left over in correspondence classes.

> } I missed a special case, in fact: if the classes are the same,
> } then the character is forced to be the same as well.
> 
> So m:{[:alnum:]}={[:alnum:]} is effectively an expensive no-op?

In that it doesn't give you behaviour beyond what completion would do
with a match specifier, yes.  Although

m:{[:alnum:][:upper:]}={[:alnum:][:lower:]}

is of very minor interest (match lower against upper provided some
alphanumeric, not specified but forced to be the same on both sides,
occurred in the previous character), and it's hard to think of good use
in practice.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author