| 2453 |
goto FAILED; |
goto FAILED; |
| 2454 |
} |
} |
| 2455 |
|
|
| 2456 |
/* If the first character is '^', set the negation flag and skip it. */ |
/* If the first character is '^', set the negation flag and skip it. Also, |
| 2457 |
|
if the first few characters (either before or after ^) are \Q\E or \E we |
| 2458 |
if ((c = *(++ptr)) == '^') |
skip them too. This makes for compatibility with Perl. */ |
| 2459 |
|
|
| 2460 |
|
negate_class = FALSE; |
| 2461 |
|
for (;;) |
| 2462 |
{ |
{ |
|
negate_class = TRUE; |
|
| 2463 |
c = *(++ptr); |
c = *(++ptr); |
| 2464 |
} |
if (c == '\\') |
| 2465 |
else |
{ |
| 2466 |
{ |
if (ptr[1] == 'E') ptr++; |
| 2467 |
negate_class = FALSE; |
else if (strncmp((const char *)ptr+1, "Q\\E", 3) == 0) ptr += 3; |
| 2468 |
} |
else break; |
| 2469 |
|
} |
| 2470 |
|
else if (!negate_class && c == '^') |
| 2471 |
|
negate_class = TRUE; |
| 2472 |
|
else break; |
| 2473 |
|
} |
| 2474 |
|
|
| 2475 |
/* Keep a count of chars with values < 256 so that we can optimize the case |
/* Keep a count of chars with values < 256 so that we can optimize the case |
| 2476 |
of just a single character (as long as it's < 256). However, For higher |
of just a single character (as long as it's < 256). However, For higher |
| 2610 |
of the specials, which just set a flag. The sequence \b is a special |
of the specials, which just set a flag. The sequence \b is a special |
| 2611 |
case. Inside a class (and only there) it is treated as backspace. |
case. Inside a class (and only there) it is treated as backspace. |
| 2612 |
Elsewhere it marks a word boundary. Other escapes have preset maps ready |
Elsewhere it marks a word boundary. Other escapes have preset maps ready |
| 2613 |
to or into the one we are building. We assume they have more than one |
to 'or' into the one we are building. We assume they have more than one |
| 2614 |
character in them, so set class_charcount bigger than one. */ |
character in them, so set class_charcount bigger than one. */ |
| 2615 |
|
|
| 2616 |
if (c == '\\') |
if (c == '\\') |
| 3075 |
*errorcodeptr = ERR6; |
*errorcodeptr = ERR6; |
| 3076 |
goto FAILED; |
goto FAILED; |
| 3077 |
} |
} |
| 3078 |
|
|
| 3079 |
/* If class_charcount is 1, we saw precisely one character whose value is |
/* If class_charcount is 1, we saw precisely one character whose value is |
| 3080 |
less than 256. In non-UTF-8 mode we can always optimize. In UTF-8 mode, we |
less than 256. In non-UTF-8 mode we can always optimize. In UTF-8 mode, we |
| 3081 |
can optimize the negative case only if there were no characters >= 128 |
can optimize the negative case only if there were no characters >= 128 |