about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2001-09-09 06:17:02 +0000
committerClint Adams <clint@users.sourceforge.net>2001-09-09 06:17:02 +0000
commita11772c6179c382b3be4cfa1c60ec723e625a5c1 (patch)
treef9611ea7bace719f3db3912457469161dbd640fa
parent9a31296b3ef3a0101963eae3bd53e771e1150537 (diff)
downloadzsh-a11772c6179c382b3be4cfa1c60ec723e625a5c1.tar.gz
zsh-a11772c6179c382b3be4cfa1c60ec723e625a5c1.tar.xz
zsh-a11772c6179c382b3be4cfa1c60ec723e625a5c1.zip
15765: introduce [:ascii:] class
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/expn.yo1
-rw-r--r--Src/pattern.c31
3 files changed, 24 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index f6f2e72b6..6ed816f42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 2001-09-08  Clint Adams  <clint@zsh.org>
 
-	* 1576x: Src/Modules/tcp.c: add -v (verbose)
+	* 15765: Doc/Zsh/expn.yo, Src/pattern.c:
+	introduce [:ascii:] class.
+
+	* 15763: Src/Modules/tcp.c: add -v (verbose)
 	for ztcp.
 
 	* 15762: Src/Modules/tcp.c, Src/Modules/tcp.h,
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 29bef50d9..834cb97c3 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -1178,6 +1178,7 @@ cindex(character classes)
 There are also several named classes of characters, in the form
 `tt([:)var(name)tt(:])' with the following meanings:  `tt([:alnum:])'
 alphanumeric, `tt([:alpha:])' alphabetic,
+`tt([:ascii:])' 7-bit,
 `tt([:blank:])' space or tab,
 `tt([:cntrl:])' control character, `tt([:digit:])' decimal
 digit, `tt([:graph:])' printable character except whitespace,
diff --git a/Src/pattern.c b/Src/pattern.c
index db5344230..f75698adc 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -158,18 +158,19 @@ typedef union upat *Upat;
  */
 #define PP_ALPHA  1
 #define PP_ALNUM  2
-#define PP_BLANK  3
-#define PP_CNTRL  4
-#define PP_DIGIT  5
-#define PP_GRAPH  6
-#define PP_LOWER  7
-#define PP_PRINT  8
-#define PP_PUNCT  9
-#define PP_SPACE  10
-#define PP_UPPER  11
-#define PP_XDIGIT 12
-#define PP_UNKWN  13
-#define PP_RANGE  14
+#define PP_ASCII  3
+#define PP_BLANK  4
+#define PP_CNTRL  5
+#define PP_DIGIT  6
+#define PP_GRAPH  7
+#define PP_LOWER  8
+#define PP_PRINT  9
+#define PP_PUNCT  10
+#define PP_SPACE  11
+#define PP_UPPER  12
+#define PP_XDIGIT 13
+#define PP_UNKWN  14
+#define PP_RANGE  15
 
 #define	P_OP(p)		((p)->l & 0xff)
 #define	P_NEXT(p)	((p)->l >> 8)
@@ -928,6 +929,8 @@ patcomppiece(int *flagp)
 			    ch = PP_ALPHA;
 			else if (!strncmp(patparse, "alnum", len))
 			    ch = PP_ALNUM;
+			else if (!strncmp(patparse, "ascii", len))
+			    ch = PP_ASCII;
 			else if (!strncmp(patparse, "blank", len))
 			    ch = PP_BLANK;
 			else if (!strncmp(patparse, "cntrl", len))
@@ -2187,6 +2190,10 @@ patmatchrange(char *range, int ch)
 		if (isalnum(ch))
 		    return 1;
 		break;
+	    case PP_ASCII:
+		if ((ch & ~0x7f) == 0)
+		    return 1;
+		break;
 	    case PP_BLANK:
 		if (ch == ' ' || ch == '\t')
 		    return 1;