| 454 |
int i, j; |
int i, j; |
| 455 |
int clen, dlen; |
int clen, dlen; |
| 456 |
unsigned int c, d; |
unsigned int c, d; |
| 457 |
|
int forced_fail = 0; |
| 458 |
|
int reached_end = 0; |
| 459 |
|
|
| 460 |
/* Make the new state list into the active state list and empty the |
/* Make the new state list into the active state list and empty the |
| 461 |
new state list. */ |
new state list. */ |
| 626 |
ADD_ACTIVE(state_offset - GET(code, 1), 0); |
ADD_ACTIVE(state_offset - GET(code, 1), 0); |
| 627 |
} |
} |
| 628 |
} |
} |
| 629 |
else if (ptr > current_subject || (md->moptions & PCRE_NOTEMPTY) == 0) |
else |
| 630 |
{ |
{ |
| 631 |
if (match_count < 0) match_count = (offsetcount >= 2)? 1 : 0; |
reached_end++; /* Count branches that reach the end */ |
| 632 |
else if (match_count > 0 && ++match_count * 2 >= offsetcount) |
if (ptr > current_subject || (md->moptions & PCRE_NOTEMPTY) == 0) |
| 633 |
match_count = 0; |
{ |
| 634 |
count = ((match_count == 0)? offsetcount : match_count * 2) - 2; |
if (match_count < 0) match_count = (offsetcount >= 2)? 1 : 0; |
| 635 |
if (count > 0) memmove(offsets + 2, offsets, count * sizeof(int)); |
else if (match_count > 0 && ++match_count * 2 >= offsetcount) |
| 636 |
if (offsetcount >= 2) |
match_count = 0; |
| 637 |
{ |
count = ((match_count == 0)? offsetcount : match_count * 2) - 2; |
| 638 |
offsets[0] = current_subject - start_subject; |
if (count > 0) memmove(offsets + 2, offsets, count * sizeof(int)); |
| 639 |
offsets[1] = ptr - start_subject; |
if (offsetcount >= 2) |
| 640 |
DPRINTF(("%.*sSet matched string = \"%.*s\"\n", rlevel*2-2, SP, |
{ |
| 641 |
offsets[1] - offsets[0], current_subject)); |
offsets[0] = current_subject - start_subject; |
| 642 |
} |
offsets[1] = ptr - start_subject; |
| 643 |
if ((md->moptions & PCRE_DFA_SHORTEST) != 0) |
DPRINTF(("%.*sSet matched string = \"%.*s\"\n", rlevel*2-2, SP, |
| 644 |
{ |
offsets[1] - offsets[0], current_subject)); |
| 645 |
DPRINTF(("%.*sEnd of internal_dfa_exec %d: returning %d\n" |
} |
| 646 |
"%.*s---------------------\n\n", rlevel*2-2, SP, rlevel, |
if ((md->moptions & PCRE_DFA_SHORTEST) != 0) |
| 647 |
match_count, rlevel*2-2, SP)); |
{ |
| 648 |
return match_count; |
DPRINTF(("%.*sEnd of internal_dfa_exec %d: returning %d\n" |
| 649 |
} |
"%.*s---------------------\n\n", rlevel*2-2, SP, rlevel, |
| 650 |
|
match_count, rlevel*2-2, SP)); |
| 651 |
|
return match_count; |
| 652 |
|
} |
| 653 |
|
} |
| 654 |
} |
} |
| 655 |
break; |
break; |
| 656 |
|
|
| 808 |
} |
} |
| 809 |
else left_word = 0; |
else left_word = 0; |
| 810 |
|
|
| 811 |
if (clen > 0) right_word = c < 256 && (ctypes[c] & ctype_word) != 0; |
if (clen > 0) |
| 812 |
else right_word = 0; |
right_word = c < 256 && (ctypes[c] & ctype_word) != 0; |
| 813 |
|
else /* This is a fudge to ensure that if this is the */ |
| 814 |
|
{ /* last item in the pattern, we don't count it as */ |
| 815 |
|
reached_end--; /* reached, thus disabling a partial match. */ |
| 816 |
|
right_word = 0; |
| 817 |
|
} |
| 818 |
|
|
| 819 |
if ((left_word == right_word) == (codevalue == OP_NOT_WORD_BOUNDARY)) |
if ((left_word == right_word) == (codevalue == OP_NOT_WORD_BOUNDARY)) |
| 820 |
{ ADD_ACTIVE(state_offset + 1, 0); } |
{ ADD_ACTIVE(state_offset + 1, 0); } |
| 2173 |
though the other "backtracking verbs" are not supported. */ |
though the other "backtracking verbs" are not supported. */ |
| 2174 |
|
|
| 2175 |
case OP_FAIL: |
case OP_FAIL: |
| 2176 |
|
forced_fail++; /* Count FAILs for multiple states */ |
| 2177 |
break; |
break; |
| 2178 |
|
|
| 2179 |
case OP_ASSERT: |
case OP_ASSERT: |
| 2481 |
/* We have finished the processing at the current subject character. If no |
/* We have finished the processing at the current subject character. If no |
| 2482 |
new states have been set for the next character, we have found all the |
new states have been set for the next character, we have found all the |
| 2483 |
matches that we are going to find. If we are at the top level and partial |
matches that we are going to find. If we are at the top level and partial |
| 2484 |
matching has been requested, check for appropriate conditions. */ |
matching has been requested, check for appropriate conditions. The "forced_ |
| 2485 |
|
fail" variable counts the number of (*F) encountered for the character. If it |
| 2486 |
|
is equal to the original active_count (saved in workspace[1]) it means that |
| 2487 |
|
(*F) was found on every active state. In this case we don't want to give a |
| 2488 |
|
partial match. */ |
| 2489 |
|
|
| 2490 |
if (new_count <= 0) |
if (new_count <= 0) |
| 2491 |
{ |
{ |
| 2492 |
if (rlevel == 1 && /* Top level, and */ |
if (rlevel == 1 && /* Top level, and */ |
| 2493 |
|
reached_end != workspace[1] && /* Not all reached end */ |
| 2494 |
|
forced_fail != workspace[1] && /* Not all forced fail & */ |
| 2495 |
( /* either... */ |
( /* either... */ |
| 2496 |
(md->moptions & PCRE_PARTIAL_HARD) != 0 /* Hard partial */ |
(md->moptions & PCRE_PARTIAL_HARD) != 0 /* Hard partial */ |
| 2497 |
|| /* or... */ |
|| /* or... */ |
| 2889 |
don't do this when the string is sufficiently long. |
don't do this when the string is sufficiently long. |
| 2890 |
|
|
| 2891 |
ALSO: this processing is disabled when partial matching is requested, and can |
ALSO: this processing is disabled when partial matching is requested, and can |
| 2892 |
also be explicitly deactivated. */ |
also be explicitly deactivated. Furthermore, we have to disable when |
| 2893 |
|
restarting after a partial match, because the required character may have |
| 2894 |
|
already been matched. */ |
| 2895 |
|
|
| 2896 |
if ((options & PCRE_NO_START_OPTIMIZE) == 0 && |
if ((options & PCRE_NO_START_OPTIMIZE) == 0 && |
| 2897 |
req_byte >= 0 && |
req_byte >= 0 && |
| 2898 |
end_subject - current_subject < REQ_BYTE_MAX && |
end_subject - current_subject < REQ_BYTE_MAX && |
| 2899 |
(options & PCRE_PARTIAL) == 0) |
(options & (PCRE_PARTIAL_HARD|PCRE_PARTIAL_SOFT|PCRE_DFA_RESTART)) == 0) |
| 2900 |
{ |
{ |
| 2901 |
register const uschar *p = current_subject + ((first_byte >= 0)? 1 : 0); |
register const uschar *p = current_subject + ((first_byte >= 0)? 1 : 0); |
| 2902 |
|
|