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

Re: (alpha sequence missing in zsh) Re: FYI: BashDiff

On Tue, 09 Oct 2007 10:29:24 +0200
"Zvi Har'El" <rl@xxxxxxxxxxxxxxxxxxx> wrote:
> I wondered why the diffence betwen the {1..9} and {a-z} syntax, and read
> the BRACE EXPANSION section in zshexpn(1).

The difference in syntax is historical.  The BRACE_CCL form came earlier,
out of zsh prehistory.  I wanted to add a numeric form that didn't depend
on BRACE_CCL and borrowed the syntax for that from Perl since it didn't
look like an expression you'd have by accident.

> I wonder: What is a "search set"? I couldn't find it anywhere in zshall(1).

It simply means a [...] pattern expression.  This bit isn't very helpful.

I note multibyte characters aren't handled.  That probably isn't much of an
issue for X-Y but you might want to be able to use individual ones.  That
looks like it would be a little work.

Index: Doc/Zsh/expn.yo
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/expn.yo,v
retrieving revision 1.81
diff -u -r1.81 expn.yo
--- Doc/Zsh/expn.yo	22 Aug 2007 10:46:42 -0000	1.81
+++ Doc/Zsh/expn.yo	9 Oct 2007 08:51:55 -0000
@@ -1229,12 +1229,17 @@
 resulting sequence will also be in decreasing order.
 If a brace expression matches none of the above forms, it is left
-unchanged, unless the tt(BRACE_CCL) option is set.
+unchanged, unless the option tt(BRACE_CCL) (an abbreviation for `brace
+character class') is set.
 pindex(BRACE_CCL, use of)
-In that case, it is expanded to a sorted list of the individual
-characters between the braces, in the manner of a search set.
-`tt(-)' is treated specially as in a search set, but `tt(^)' or `tt(!)' as
-the first character is treated normally.
+In that case, it is expanded to a list of the individual
+characters between the braces sorted into the order of the characters
+in the ASCII character set (multibyte characters are not currently
+handled).  The syntax is similar to a
+tt([)...tt(]) expression in filename generation:
+`tt(-)' is treated specially to denote a range of characters, but `tt(^)' or
+`tt(!)' as the first character is treated normally.  For example,
+`tt({abcdef0-9})' expands to 16 words tt(0 1 2 3 4 5 6 7 8 9 a b c d e f).
 Note that brace expansion is not part of filename generation (globbing); an
 expression such as tt(*/{foo,bar}) is split into two separate words

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

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