| 1409 |
|
|
| 1410 |
/* For other groups, scan the branches. */ |
/* For other groups, scan the branches. */ |
| 1411 |
|
|
| 1412 |
if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE) |
if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE || c == OP_COND) |
| 1413 |
{ |
{ |
| 1414 |
BOOL empty_branch; |
BOOL empty_branch; |
| 1415 |
if (GET(code, 1) == 0) return TRUE; /* Hit unclosed bracket */ |
if (GET(code, 1) == 0) return TRUE; /* Hit unclosed bracket */ |
| 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 |
|
skip them too. This makes for compatibility with Perl. */ |
| 2459 |
|
|
| 2460 |
if ((c = *(++ptr)) == '^') |
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 |
| 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 == '\\') |