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

Re: PATCH: rewrite of completion matching



On Mon, 16 Jun 2008 00:17:00 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> I *think* you mean that m:{[:punct:]}={[:space:]} is "any single
> punctuation character matches any single whitespace character,"
> whereas m:{[:lower:]}={[:upper:]} is "each lower case character
> matches the corresponding upper case character."  That is, the former
> works like "sed 's/[[:punct:]]/[[:space:]]/g'" but the latter works
> like "tr '[:lower:]' '[:upper:]'".

Yes.  I missed a special case, in fact: if the classes are the same,
then the character is forced to be the same as well.  (If you don't want
that, obviously you should use ordinary character classes.)

Index: Doc/Zsh/compwid.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compwid.yo,v
retrieving revision 1.41
diff -u -r1.41 compwid.yo
--- Doc/Zsh/compwid.yo	8 Jun 2008 17:53:55 -0000	1.41
+++ Doc/Zsh/compwid.yo	16 Jun 2008 12:52:25 -0000
@@ -944,8 +944,12 @@
 to be a future extension, at which point this syntax will handle
 arbitrary alphabets; hence this form, rather than the use of explicit
 ranges, is the recommended form.  In other cases
-`tt([:)var(name)tt(:])' forms are allowed, but imply no special
-constraint on the characters beyond that implied by the test itself.
+`tt([:)var(name)tt(:])' forms are allowed.  If the two forms on the left
+and right are the same, the characters must match exactly.  In remaining
+cases, the corresponding tests are applied to both characters, but they
+are not otherwise constrained; any matching character in one set goes
+with any matching character in the other set:  this is equivalent to the
+behaviour of ordinary character classes.
 
 The pattern var(tpat) may also be one or two stars, `tt(*)' or
 `tt(**)'. This means that the pattern on the command line can match

-- 
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