1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-28 05:00:59 +01:00

15765: introduce [:ascii:] class

This commit is contained in:
Clint Adams 2001-09-09 06:17:02 +00:00
parent 9a31296b3e
commit a11772c617
3 changed files with 24 additions and 13 deletions

View file

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