+ }
+ else if (ch == '-' && prev && p[1] && p[1] != ']') {
+ ch = *++p;
+ if (ch == '\\') {
+ ch = *++p;
+ if (!ch)
+ return ABORT_ALL;
+ }
+ if (*text <= ch && *text >= prev)
+ matched = TRUE;
+ ch = 0; /* This makes "prev" get set to 0. */
+ }
+ else if (ch == '[' && p[1] == ':') {
+ const uchar *s;
+ int i;
+ for (s = p += 2; (ch = *p) && ch != ']'; p++) {}
+ if (!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;
+ ch = '[';
+ if (*text == ch)
+ matched = TRUE;
+ continue;
+ }
+ if (CC_EQ(s,i, "alnum")) {
+ if (ISALNUM(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "alpha")) {
+ if (ISALPHA(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "blank")) {
+ if (ISBLANK(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "cntrl")) {
+ if (ISCNTRL(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "digit")) {
+ if (ISDIGIT(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "graph")) {
+ if (ISGRAPH(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "lower")) {
+ if (ISLOWER(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "print")) {
+ if (ISPRINT(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "punct")) {
+ if (ISPUNCT(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "space")) {
+ if (ISSPACE(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "upper")) {
+ if (ISUPPER(*text))
+ matched = TRUE;
+ }
+ else if (CC_EQ(s,i, "xdigit")) {
+ if (ISXDIGIT(*text))
+ matched = TRUE;
+ }
+ else /* malformed [:class:] string */
+ return ABORT_ALL;