- while ((ch = *p) && (ch != ':' || p[1] != ']')) p++;
- if (!ch)
- return FALSE;
- i = p - s;
- ch = *text;
- if ((CC_EQ(s,i, "alnum") && isalnum(ch))
- || (CC_EQ(s,i, "alpha") && isalpha(ch))
- || (CC_EQ(s,i, "blank") && isblank(ch))
- || (CC_EQ(s,i, "cntrl") && iscntrl(ch))
- || (CC_EQ(s,i, "digit") && isdigit(ch))
- || (CC_EQ(s,i, "graph") && isgraph(ch))
- || (CC_EQ(s,i, "lower") && islower(ch))
- || (CC_EQ(s,i, "print") && isprint(ch))
- || (CC_EQ(s,i, "punct") && ispunct(ch))
- || (CC_EQ(s,i, "space") && isspace(ch))
- || (CC_EQ(s,i, "upper") && isupper(ch))
- || (CC_EQ(s,i,"xdigit") && isxdigit(ch)))
- matched = TRUE;
- p++;
- ch = 0; /* This makes "prev" get set to 0. */
- }
- else if (*text == ch)
+ for (s = p += 2; (p_ch = *p) && p_ch != ']'; p++) {}
+ if (!p_ch)
+ return ABORT_ALL;
+ i = p - s - 1;
+ if (i < 0 || p[-1] != ':') {
+ /* Didn't find ":]", so treat like a normal set. */
+ p = s - 2;
+ p_ch = '[';
+ if (t_ch == p_ch)
+ matched = TRUE;
+ continue;
+ }
+ if (CC_EQ(s,i, "alnum")) {
+ if (ISALNUM(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "alpha")) {
+ if (ISALPHA(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "blank")) {
+ if (ISBLANK(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "cntrl")) {
+ if (ISCNTRL(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "digit")) {
+ if (ISDIGIT(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "graph")) {
+ if (ISGRAPH(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "lower")) {
+ if (ISLOWER(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "print")) {
+ if (ISPRINT(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "punct")) {
+ if (ISPUNCT(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "space")) {
+ if (ISSPACE(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "upper")) {
+ if (ISUPPER(t_ch))
+ matched = TRUE;
+ } else if (CC_EQ(s,i, "xdigit")) {
+ if (ISXDIGIT(t_ch))
+ matched = TRUE;
+ } else /* malformed [:class:] string */
+ return ABORT_ALL;
+ p_ch = 0; /* This makes "prev_ch" get set to 0. */
+ } else if (t_ch == p_ch)