| 6 |
and semantics are as close as possible to those of the Perl 5 language. |
and semantics are as close as possible to those of the Perl 5 language. |
| 7 |
|
|
| 8 |
Written by Philip Hazel |
Written by Philip Hazel |
| 9 |
Copyright (c) 1997-2009 University of Cambridge |
Copyright (c) 1997-2010 University of Cambridge |
| 10 |
|
|
| 11 |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
| 12 |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
| 74 |
#define MATCH_COMMIT (-999) |
#define MATCH_COMMIT (-999) |
| 75 |
#define MATCH_PRUNE (-998) |
#define MATCH_PRUNE (-998) |
| 76 |
#define MATCH_SKIP (-997) |
#define MATCH_SKIP (-997) |
| 77 |
#define MATCH_THEN (-996) |
#define MATCH_SKIP_ARG (-996) |
| 78 |
|
#define MATCH_THEN (-995) |
| 79 |
|
|
| 80 |
|
/* This is a convenience macro for code that occurs many times. */ |
| 81 |
|
|
| 82 |
|
#define MRRETURN(ra) \ |
| 83 |
|
{ \ |
| 84 |
|
md->mark = markptr; \ |
| 85 |
|
RRETURN(ra); \ |
| 86 |
|
} |
| 87 |
|
|
| 88 |
/* Maximum number of ints of offset to save on the stack for recursive calls. |
/* Maximum number of ints of offset to save on the stack for recursive calls. |
| 89 |
If the offset vector is bigger, malloc is used. This should be a multiple of 3, |
If the offset vector is bigger, malloc is used. This should be a multiple of 3, |
| 98 |
|
|
| 99 |
|
|
| 100 |
|
|
| 101 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 102 |
/************************************************* |
/************************************************* |
| 103 |
* Debugging function to print chars * |
* Debugging function to print chars * |
| 104 |
*************************************************/ |
*************************************************/ |
| 150 |
{ |
{ |
| 151 |
USPTR p = md->start_subject + md->offset_vector[offset]; |
USPTR p = md->start_subject + md->offset_vector[offset]; |
| 152 |
|
|
| 153 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 154 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 155 |
printf("matching subject <null>"); |
printf("matching subject <null>"); |
| 156 |
else |
else |
| 258 |
|
|
| 259 |
/* These versions of the macros use the stack, as normal. There are debugging |
/* These versions of the macros use the stack, as normal. There are debugging |
| 260 |
versions and production versions. Note that the "rw" argument of RMATCH isn't |
versions and production versions. Note that the "rw" argument of RMATCH isn't |
| 261 |
actuall used in this definition. */ |
actually used in this definition. */ |
| 262 |
|
|
| 263 |
#ifndef NO_RECURSE |
#ifndef NO_RECURSE |
| 264 |
#define REGISTER register |
#define REGISTER register |
| 265 |
|
|
| 266 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 267 |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
| 268 |
{ \ |
{ \ |
| 269 |
printf("match() called in line %d\n", __LINE__); \ |
printf("match() called in line %d\n", __LINE__); \ |
| 270 |
rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1); \ |
rrc = match(ra,rb,mstart,markptr,rc,rd,re,rf,rg,rdepth+1); \ |
| 271 |
printf("to line %d\n", __LINE__); \ |
printf("to line %d\n", __LINE__); \ |
| 272 |
} |
} |
| 273 |
#define RRETURN(ra) \ |
#define RRETURN(ra) \ |
| 277 |
} |
} |
| 278 |
#else |
#else |
| 279 |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
| 280 |
rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1) |
rrc = match(ra,rb,mstart,markptr,rc,rd,re,rf,rg,rdepth+1) |
| 281 |
#define RRETURN(ra) return ra |
#define RRETURN(ra) return ra |
| 282 |
#endif |
#endif |
| 283 |
|
|
| 297 |
newframe->Xeptr = ra;\ |
newframe->Xeptr = ra;\ |
| 298 |
newframe->Xecode = rb;\ |
newframe->Xecode = rb;\ |
| 299 |
newframe->Xmstart = mstart;\ |
newframe->Xmstart = mstart;\ |
| 300 |
|
newframe->Xmarkptr = markptr;\ |
| 301 |
newframe->Xoffset_top = rc;\ |
newframe->Xoffset_top = rc;\ |
| 302 |
newframe->Xims = re;\ |
newframe->Xims = re;\ |
| 303 |
newframe->Xeptrb = rf;\ |
newframe->Xeptrb = rf;\ |
| 335 |
USPTR Xeptr; |
USPTR Xeptr; |
| 336 |
const uschar *Xecode; |
const uschar *Xecode; |
| 337 |
USPTR Xmstart; |
USPTR Xmstart; |
| 338 |
|
USPTR Xmarkptr; |
| 339 |
int Xoffset_top; |
int Xoffset_top; |
| 340 |
long int Xims; |
long int Xims; |
| 341 |
eptrblock *Xeptrb; |
eptrblock *Xeptrb; |
| 422 |
if (md->partial != 0 && eptr >= md->end_subject && eptr > mstart)\ |
if (md->partial != 0 && eptr >= md->end_subject && eptr > mstart)\ |
| 423 |
{\ |
{\ |
| 424 |
md->hitend = TRUE;\ |
md->hitend = TRUE;\ |
| 425 |
if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\ |
if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL);\ |
| 426 |
} |
} |
| 427 |
|
|
| 428 |
#define SCHECK_PARTIAL()\ |
#define SCHECK_PARTIAL()\ |
| 429 |
if (md->partial && eptr > mstart)\ |
if (md->partial != 0 && eptr > mstart)\ |
| 430 |
{\ |
{\ |
| 431 |
md->hitend = TRUE;\ |
md->hitend = TRUE;\ |
| 432 |
if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\ |
if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL);\ |
| 433 |
} |
} |
| 434 |
|
|
| 435 |
|
|
| 443 |
ecode pointer to current position in compiled code |
ecode pointer to current position in compiled code |
| 444 |
mstart pointer to the current match start position (can be modified |
mstart pointer to the current match start position (can be modified |
| 445 |
by encountering \K) |
by encountering \K) |
| 446 |
|
markptr pointer to the most recent MARK name, or NULL |
| 447 |
offset_top current top pointer |
offset_top current top pointer |
| 448 |
md pointer to "static" info for the match |
md pointer to "static" info for the match |
| 449 |
ims current /i, /m, and /s options |
ims current /i, /m, and /s options |
| 457 |
|
|
| 458 |
Returns: MATCH_MATCH if matched ) these values are >= 0 |
Returns: MATCH_MATCH if matched ) these values are >= 0 |
| 459 |
MATCH_NOMATCH if failed to match ) |
MATCH_NOMATCH if failed to match ) |
| 460 |
|
a negative MATCH_xxx value for PRUNE, SKIP, etc |
| 461 |
a negative PCRE_ERROR_xxx value if aborted by an error condition |
a negative PCRE_ERROR_xxx value if aborted by an error condition |
| 462 |
(e.g. stopped by repeated call or recursion limit) |
(e.g. stopped by repeated call or recursion limit) |
| 463 |
*/ |
*/ |
| 464 |
|
|
| 465 |
static int |
static int |
| 466 |
match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart, |
match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart, |
| 467 |
int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb, |
const uschar *markptr, int offset_top, match_data *md, unsigned long int ims, |
| 468 |
int flags, unsigned int rdepth) |
eptrblock *eptrb, int flags, unsigned int rdepth) |
| 469 |
{ |
{ |
| 470 |
/* These variables do not need to be preserved over recursion in this function, |
/* These variables do not need to be preserved over recursion in this function, |
| 471 |
so they can be ordinary variables in all cases. Mark some of them with |
so they can be ordinary variables in all cases. Mark some of them with |
| 493 |
frame->Xeptr = eptr; |
frame->Xeptr = eptr; |
| 494 |
frame->Xecode = ecode; |
frame->Xecode = ecode; |
| 495 |
frame->Xmstart = mstart; |
frame->Xmstart = mstart; |
| 496 |
|
frame->Xmarkptr = markptr; |
| 497 |
frame->Xoffset_top = offset_top; |
frame->Xoffset_top = offset_top; |
| 498 |
frame->Xims = ims; |
frame->Xims = ims; |
| 499 |
frame->Xeptrb = eptrb; |
frame->Xeptrb = eptrb; |
| 509 |
#define eptr frame->Xeptr |
#define eptr frame->Xeptr |
| 510 |
#define ecode frame->Xecode |
#define ecode frame->Xecode |
| 511 |
#define mstart frame->Xmstart |
#define mstart frame->Xmstart |
| 512 |
|
#define markptr frame->Xmarkptr |
| 513 |
#define offset_top frame->Xoffset_top |
#define offset_top frame->Xoffset_top |
| 514 |
#define ims frame->Xims |
#define ims frame->Xims |
| 515 |
#define eptrb frame->Xeptrb |
#define eptrb frame->Xeptrb |
| 637 |
/* OK, now we can get on with the real code of the function. Recursive calls |
/* OK, now we can get on with the real code of the function. Recursive calls |
| 638 |
are specified by the macro RMATCH and RRETURN is used to return. When |
are specified by the macro RMATCH and RRETURN is used to return. When |
| 639 |
NO_RECURSE is *not* defined, these just turn into a recursive call to match() |
NO_RECURSE is *not* defined, these just turn into a recursive call to match() |
| 640 |
and a "return", respectively (possibly with some debugging if DEBUG is |
and a "return", respectively (possibly with some debugging if PCRE_DEBUG is |
| 641 |
defined). However, RMATCH isn't like a function call because it's quite a |
defined). However, RMATCH isn't like a function call because it's quite a |
| 642 |
complicated macro. It has to be used in one particular way. This shouldn't, |
complicated macro. It has to be used in one particular way. This shouldn't, |
| 643 |
however, impact performance when true recursion is being used. */ |
however, impact performance when true recursion is being used. */ |
| 678 |
{ |
{ |
| 679 |
minimize = possessive = FALSE; |
minimize = possessive = FALSE; |
| 680 |
op = *ecode; |
op = *ecode; |
| 681 |
|
|
| 682 |
switch(op) |
switch(op) |
| 683 |
{ |
{ |
| 684 |
|
case OP_MARK: |
| 685 |
|
markptr = ecode + 2; |
| 686 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 687 |
|
ims, eptrb, flags, RM51); |
| 688 |
|
|
| 689 |
|
/* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an |
| 690 |
|
argument, and we must check whether that argument matches this MARK's |
| 691 |
|
argument. It is passed back in md->start_match_ptr (an overloading of that |
| 692 |
|
variable). If it does match, we reset that variable to the current subject |
| 693 |
|
position and return MATCH_SKIP. Otherwise, pass back the return code |
| 694 |
|
unaltered. */ |
| 695 |
|
|
| 696 |
|
if (rrc == MATCH_SKIP_ARG && |
| 697 |
|
strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0) |
| 698 |
|
{ |
| 699 |
|
md->start_match_ptr = eptr; |
| 700 |
|
RRETURN(MATCH_SKIP); |
| 701 |
|
} |
| 702 |
|
|
| 703 |
|
if (md->mark == NULL) md->mark = markptr; |
| 704 |
|
RRETURN(rrc); |
| 705 |
|
|
| 706 |
case OP_FAIL: |
case OP_FAIL: |
| 707 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 708 |
|
|
| 709 |
|
case OP_COMMIT: |
| 710 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 711 |
|
ims, eptrb, flags, RM52); |
| 712 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 713 |
|
MRRETURN(MATCH_COMMIT); |
| 714 |
|
|
| 715 |
case OP_PRUNE: |
case OP_PRUNE: |
| 716 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 717 |
ims, eptrb, flags, RM51); |
ims, eptrb, flags, RM51); |
| 718 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 719 |
RRETURN(MATCH_PRUNE); |
MRRETURN(MATCH_PRUNE); |
| 720 |
|
|
| 721 |
case OP_COMMIT: |
case OP_PRUNE_ARG: |
| 722 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 723 |
ims, eptrb, flags, RM52); |
ims, eptrb, flags, RM51); |
| 724 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 725 |
RRETURN(MATCH_COMMIT); |
md->mark = ecode + 2; |
| 726 |
|
RRETURN(MATCH_PRUNE); |
| 727 |
|
|
| 728 |
case OP_SKIP: |
case OP_SKIP: |
| 729 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 730 |
ims, eptrb, flags, RM53); |
ims, eptrb, flags, RM53); |
| 731 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 732 |
md->start_match_ptr = eptr; /* Pass back current position */ |
md->start_match_ptr = eptr; /* Pass back current position */ |
| 733 |
RRETURN(MATCH_SKIP); |
MRRETURN(MATCH_SKIP); |
| 734 |
|
|
| 735 |
|
case OP_SKIP_ARG: |
| 736 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 737 |
|
ims, eptrb, flags, RM53); |
| 738 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 739 |
|
|
| 740 |
|
/* Pass back the current skip name by overloading md->start_match_ptr and |
| 741 |
|
returning the special MATCH_SKIP_ARG return code. This will either be |
| 742 |
|
caught by a matching MARK, or get to the top, where it is treated the same |
| 743 |
|
as PRUNE. */ |
| 744 |
|
|
| 745 |
|
md->start_match_ptr = ecode + 2; |
| 746 |
|
RRETURN(MATCH_SKIP_ARG); |
| 747 |
|
|
| 748 |
case OP_THEN: |
case OP_THEN: |
| 749 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 750 |
ims, eptrb, flags, RM54); |
ims, eptrb, flags, RM54); |
| 751 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 752 |
|
MRRETURN(MATCH_THEN); |
| 753 |
|
|
| 754 |
|
case OP_THEN_ARG: |
| 755 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 756 |
|
ims, eptrb, flags, RM54); |
| 757 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 758 |
|
md->mark = ecode + 2; |
| 759 |
RRETURN(MATCH_THEN); |
RRETURN(MATCH_THEN); |
| 760 |
|
|
| 761 |
/* Handle a capturing bracket. If there is space in the offset vector, save |
/* Handle a capturing bracket. If there is space in the offset vector, save |
| 777 |
number = GET2(ecode, 1+LINK_SIZE); |
number = GET2(ecode, 1+LINK_SIZE); |
| 778 |
offset = number << 1; |
offset = number << 1; |
| 779 |
|
|
| 780 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 781 |
printf("start bracket %d\n", number); |
printf("start bracket %d\n", number); |
| 782 |
printf("subject="); |
printf("subject="); |
| 783 |
pchars(eptr, 16, TRUE, md); |
pchars(eptr, 16, TRUE, md); |
| 811 |
md->offset_vector[offset+1] = save_offset2; |
md->offset_vector[offset+1] = save_offset2; |
| 812 |
md->offset_vector[md->offset_end - number] = save_offset3; |
md->offset_vector[md->offset_end - number] = save_offset3; |
| 813 |
|
|
| 814 |
|
if (rrc != MATCH_THEN) md->mark = markptr; |
| 815 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
| 816 |
} |
} |
| 817 |
|
|
| 851 |
|
|
| 852 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
| 853 |
eptrb, flags, RM48); |
eptrb, flags, RM48); |
| 854 |
RRETURN(rrc); |
if (rrc == MATCH_NOMATCH) md->mark = markptr; |
| 855 |
|
RRETURN(rrc); |
| 856 |
} |
} |
| 857 |
|
|
| 858 |
/* For non-final alternatives, continue the loop for a NOMATCH result; |
/* For non-final alternatives, continue the loop for a NOMATCH result; |
| 895 |
cb.capture_top = offset_top/2; |
cb.capture_top = offset_top/2; |
| 896 |
cb.capture_last = md->capture_last; |
cb.capture_last = md->capture_last; |
| 897 |
cb.callout_data = md->callout_data; |
cb.callout_data = md->callout_data; |
| 898 |
if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH); |
if ((rrc = (*pcre_callout)(&cb)) > 0) MRRETURN(MATCH_NOMATCH); |
| 899 |
if (rrc < 0) RRETURN(rrc); |
if (rrc < 0) RRETURN(rrc); |
| 900 |
} |
} |
| 901 |
ecode += _pcre_OP_lengths[OP_CALLOUT]; |
ecode += _pcre_OP_lengths[OP_CALLOUT]; |
| 905 |
|
|
| 906 |
/* Now see what the actual condition is */ |
/* Now see what the actual condition is */ |
| 907 |
|
|
| 908 |
if (condcode == OP_RREF) /* Recursion test */ |
if (condcode == OP_RREF || condcode == OP_NRREF) /* Recursion test */ |
| 909 |
{ |
{ |
| 910 |
offset = GET2(ecode, LINK_SIZE + 2); /* Recursion group number*/ |
if (md->recursive == NULL) /* Not recursing => FALSE */ |
| 911 |
condition = md->recursive != NULL && |
{ |
| 912 |
(offset == RREF_ANY || offset == md->recursive->group_num); |
condition = FALSE; |
| 913 |
ecode += condition? 3 : GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 914 |
|
} |
| 915 |
|
else |
| 916 |
|
{ |
| 917 |
|
int recno = GET2(ecode, LINK_SIZE + 2); /* Recursion group number*/ |
| 918 |
|
condition = (recno == RREF_ANY || recno == md->recursive->group_num); |
| 919 |
|
|
| 920 |
|
/* If the test is for recursion into a specific subpattern, and it is |
| 921 |
|
false, but the test was set up by name, scan the table to see if the |
| 922 |
|
name refers to any other numbers, and test them. The condition is true |
| 923 |
|
if any one is set. */ |
| 924 |
|
|
| 925 |
|
if (!condition && condcode == OP_NRREF && recno != RREF_ANY) |
| 926 |
|
{ |
| 927 |
|
uschar *slotA = md->name_table; |
| 928 |
|
for (i = 0; i < md->name_count; i++) |
| 929 |
|
{ |
| 930 |
|
if (GET2(slotA, 0) == recno) break; |
| 931 |
|
slotA += md->name_entry_size; |
| 932 |
|
} |
| 933 |
|
|
| 934 |
|
/* Found a name for the number - there can be only one; duplicate |
| 935 |
|
names for different numbers are allowed, but not vice versa. First |
| 936 |
|
scan down for duplicates. */ |
| 937 |
|
|
| 938 |
|
if (i < md->name_count) |
| 939 |
|
{ |
| 940 |
|
uschar *slotB = slotA; |
| 941 |
|
while (slotB > md->name_table) |
| 942 |
|
{ |
| 943 |
|
slotB -= md->name_entry_size; |
| 944 |
|
if (strcmp((char *)slotA + 2, (char *)slotB + 2) == 0) |
| 945 |
|
{ |
| 946 |
|
condition = GET2(slotB, 0) == md->recursive->group_num; |
| 947 |
|
if (condition) break; |
| 948 |
|
} |
| 949 |
|
else break; |
| 950 |
|
} |
| 951 |
|
|
| 952 |
|
/* Scan up for duplicates */ |
| 953 |
|
|
| 954 |
|
if (!condition) |
| 955 |
|
{ |
| 956 |
|
slotB = slotA; |
| 957 |
|
for (i++; i < md->name_count; i++) |
| 958 |
|
{ |
| 959 |
|
slotB += md->name_entry_size; |
| 960 |
|
if (strcmp((char *)slotA + 2, (char *)slotB + 2) == 0) |
| 961 |
|
{ |
| 962 |
|
condition = GET2(slotB, 0) == md->recursive->group_num; |
| 963 |
|
if (condition) break; |
| 964 |
|
} |
| 965 |
|
else break; |
| 966 |
|
} |
| 967 |
|
} |
| 968 |
|
} |
| 969 |
|
} |
| 970 |
|
|
| 971 |
|
/* Chose branch according to the condition */ |
| 972 |
|
|
| 973 |
|
ecode += condition? 3 : GET(ecode, 1); |
| 974 |
|
} |
| 975 |
} |
} |
| 976 |
|
|
| 977 |
else if (condcode == OP_CREF) /* Group used test */ |
else if (condcode == OP_CREF || condcode == OP_NCREF) /* Group used test */ |
| 978 |
{ |
{ |
| 979 |
offset = GET2(ecode, LINK_SIZE+2) << 1; /* Doubled ref number */ |
offset = GET2(ecode, LINK_SIZE+2) << 1; /* Doubled ref number */ |
| 980 |
condition = offset < offset_top && md->offset_vector[offset] >= 0; |
condition = offset < offset_top && md->offset_vector[offset] >= 0; |
| 981 |
|
|
| 982 |
|
/* If the numbered capture is unset, but the reference was by name, |
| 983 |
|
scan the table to see if the name refers to any other numbers, and test |
| 984 |
|
them. The condition is true if any one is set. This is tediously similar |
| 985 |
|
to the code above, but not close enough to try to amalgamate. */ |
| 986 |
|
|
| 987 |
|
if (!condition && condcode == OP_NCREF) |
| 988 |
|
{ |
| 989 |
|
int refno = offset >> 1; |
| 990 |
|
uschar *slotA = md->name_table; |
| 991 |
|
|
| 992 |
|
for (i = 0; i < md->name_count; i++) |
| 993 |
|
{ |
| 994 |
|
if (GET2(slotA, 0) == refno) break; |
| 995 |
|
slotA += md->name_entry_size; |
| 996 |
|
} |
| 997 |
|
|
| 998 |
|
/* Found a name for the number - there can be only one; duplicate names |
| 999 |
|
for different numbers are allowed, but not vice versa. First scan down |
| 1000 |
|
for duplicates. */ |
| 1001 |
|
|
| 1002 |
|
if (i < md->name_count) |
| 1003 |
|
{ |
| 1004 |
|
uschar *slotB = slotA; |
| 1005 |
|
while (slotB > md->name_table) |
| 1006 |
|
{ |
| 1007 |
|
slotB -= md->name_entry_size; |
| 1008 |
|
if (strcmp((char *)slotA + 2, (char *)slotB + 2) == 0) |
| 1009 |
|
{ |
| 1010 |
|
offset = GET2(slotB, 0) << 1; |
| 1011 |
|
condition = offset < offset_top && |
| 1012 |
|
md->offset_vector[offset] >= 0; |
| 1013 |
|
if (condition) break; |
| 1014 |
|
} |
| 1015 |
|
else break; |
| 1016 |
|
} |
| 1017 |
|
|
| 1018 |
|
/* Scan up for duplicates */ |
| 1019 |
|
|
| 1020 |
|
if (!condition) |
| 1021 |
|
{ |
| 1022 |
|
slotB = slotA; |
| 1023 |
|
for (i++; i < md->name_count; i++) |
| 1024 |
|
{ |
| 1025 |
|
slotB += md->name_entry_size; |
| 1026 |
|
if (strcmp((char *)slotA + 2, (char *)slotB + 2) == 0) |
| 1027 |
|
{ |
| 1028 |
|
offset = GET2(slotB, 0) << 1; |
| 1029 |
|
condition = offset < offset_top && |
| 1030 |
|
md->offset_vector[offset] >= 0; |
| 1031 |
|
if (condition) break; |
| 1032 |
|
} |
| 1033 |
|
else break; |
| 1034 |
|
} |
| 1035 |
|
} |
| 1036 |
|
} |
| 1037 |
|
} |
| 1038 |
|
|
| 1039 |
|
/* Chose branch according to the condition */ |
| 1040 |
|
|
| 1041 |
ecode += condition? 3 : GET(ecode, 1); |
ecode += condition? 3 : GET(ecode, 1); |
| 1042 |
} |
} |
| 1043 |
|
|
| 1098 |
break; |
break; |
| 1099 |
|
|
| 1100 |
|
|
| 1101 |
|
/* Before OP_ACCEPT there may be any number of OP_CLOSE opcodes, |
| 1102 |
|
to close any currently open capturing brackets. */ |
| 1103 |
|
|
| 1104 |
|
case OP_CLOSE: |
| 1105 |
|
number = GET2(ecode, 1); |
| 1106 |
|
offset = number << 1; |
| 1107 |
|
|
| 1108 |
|
#ifdef PCRE_DEBUG |
| 1109 |
|
printf("end bracket %d at *ACCEPT", number); |
| 1110 |
|
printf("\n"); |
| 1111 |
|
#endif |
| 1112 |
|
|
| 1113 |
|
md->capture_last = number; |
| 1114 |
|
if (offset >= md->offset_max) md->offset_overflow = TRUE; else |
| 1115 |
|
{ |
| 1116 |
|
md->offset_vector[offset] = |
| 1117 |
|
md->offset_vector[md->offset_end - number]; |
| 1118 |
|
md->offset_vector[offset+1] = eptr - md->start_subject; |
| 1119 |
|
if (offset_top <= offset) offset_top = offset + 2; |
| 1120 |
|
} |
| 1121 |
|
ecode += 3; |
| 1122 |
|
break; |
| 1123 |
|
|
| 1124 |
|
|
| 1125 |
/* End of the pattern, either real or forced. If we are in a top-level |
/* End of the pattern, either real or forced. If we are in a top-level |
| 1126 |
recursion, we should restore the offsets appropriately and continue from |
recursion, we should restore the offsets appropriately and continue from |
| 1127 |
after the call. */ |
after the call. */ |
| 1135 |
md->recursive = rec->prevrec; |
md->recursive = rec->prevrec; |
| 1136 |
memmove(md->offset_vector, rec->offset_save, |
memmove(md->offset_vector, rec->offset_save, |
| 1137 |
rec->saved_max * sizeof(int)); |
rec->saved_max * sizeof(int)); |
| 1138 |
mstart = rec->save_start; |
offset_top = rec->save_offset_top; |
| 1139 |
ims = original_ims; |
ims = original_ims; |
| 1140 |
ecode = rec->after_call; |
ecode = rec->after_call; |
| 1141 |
break; |
break; |
| 1142 |
} |
} |
| 1143 |
|
|
| 1144 |
/* Otherwise, if PCRE_NOTEMPTY is set, fail if we have matched an empty |
/* Otherwise, if we have matched an empty string, fail if PCRE_NOTEMPTY is |
| 1145 |
string - backtracking will then try other alternatives, if any. */ |
set, or if PCRE_NOTEMPTY_ATSTART is set and we have matched at the start of |
| 1146 |
|
the subject. In both cases, backtracking will then try other alternatives, |
| 1147 |
|
if any. */ |
| 1148 |
|
|
| 1149 |
|
if (eptr == mstart && |
| 1150 |
|
(md->notempty || |
| 1151 |
|
(md->notempty_atstart && |
| 1152 |
|
mstart == md->start_subject + md->start_offset))) |
| 1153 |
|
MRRETURN(MATCH_NOMATCH); |
| 1154 |
|
|
| 1155 |
|
/* Otherwise, we have a match. */ |
| 1156 |
|
|
|
if (md->notempty && eptr == mstart) RRETURN(MATCH_NOMATCH); |
|
| 1157 |
md->end_match_ptr = eptr; /* Record where we ended */ |
md->end_match_ptr = eptr; /* Record where we ended */ |
| 1158 |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
| 1159 |
md->start_match_ptr = mstart; /* and the start (\K can modify) */ |
md->start_match_ptr = mstart; /* and the start (\K can modify) */ |
| 1160 |
RRETURN(MATCH_MATCH); |
MRRETURN(MATCH_MATCH); |
| 1161 |
|
|
| 1162 |
/* Change option settings */ |
/* Change option settings */ |
| 1163 |
|
|
| 1179 |
{ |
{ |
| 1180 |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
| 1181 |
RM4); |
RM4); |
| 1182 |
if (rrc == MATCH_MATCH) break; |
if (rrc == MATCH_MATCH) |
| 1183 |
|
{ |
| 1184 |
|
mstart = md->start_match_ptr; /* In case \K reset it */ |
| 1185 |
|
break; |
| 1186 |
|
} |
| 1187 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
| 1188 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 1189 |
} |
} |
| 1190 |
while (*ecode == OP_ALT); |
while (*ecode == OP_ALT); |
| 1191 |
if (*ecode == OP_KET) RRETURN(MATCH_NOMATCH); |
if (*ecode == OP_KET) MRRETURN(MATCH_NOMATCH); |
| 1192 |
|
|
| 1193 |
/* If checking an assertion for a condition, return MATCH_MATCH. */ |
/* If checking an assertion for a condition, return MATCH_MATCH. */ |
| 1194 |
|
|
| 1202 |
offset_top = md->end_offset_top; |
offset_top = md->end_offset_top; |
| 1203 |
continue; |
continue; |
| 1204 |
|
|
| 1205 |
/* Negative assertion: all branches must fail to match */ |
/* Negative assertion: all branches must fail to match. Encountering SKIP, |
| 1206 |
|
PRUNE, or COMMIT means we must assume failure without checking subsequent |
| 1207 |
|
branches. */ |
| 1208 |
|
|
| 1209 |
case OP_ASSERT_NOT: |
case OP_ASSERT_NOT: |
| 1210 |
case OP_ASSERTBACK_NOT: |
case OP_ASSERTBACK_NOT: |
| 1212 |
{ |
{ |
| 1213 |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
| 1214 |
RM5); |
RM5); |
| 1215 |
if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH); |
if (rrc == MATCH_MATCH) MRRETURN(MATCH_NOMATCH); |
| 1216 |
|
if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT) |
| 1217 |
|
{ |
| 1218 |
|
do ecode += GET(ecode,1); while (*ecode == OP_ALT); |
| 1219 |
|
break; |
| 1220 |
|
} |
| 1221 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
| 1222 |
ecode += GET(ecode,1); |
ecode += GET(ecode,1); |
| 1223 |
} |
} |
| 1241 |
while (i-- > 0) |
while (i-- > 0) |
| 1242 |
{ |
{ |
| 1243 |
eptr--; |
eptr--; |
| 1244 |
if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH); |
if (eptr < md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1245 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 1246 |
} |
} |
| 1247 |
} |
} |
| 1252 |
|
|
| 1253 |
{ |
{ |
| 1254 |
eptr -= GET(ecode, 1); |
eptr -= GET(ecode, 1); |
| 1255 |
if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH); |
if (eptr < md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1256 |
} |
} |
| 1257 |
|
|
| 1258 |
/* Save the earliest consulted character, then skip to next op code */ |
/* Save the earliest consulted character, then skip to next op code */ |
| 1281 |
cb.capture_top = offset_top/2; |
cb.capture_top = offset_top/2; |
| 1282 |
cb.capture_last = md->capture_last; |
cb.capture_last = md->capture_last; |
| 1283 |
cb.callout_data = md->callout_data; |
cb.callout_data = md->callout_data; |
| 1284 |
if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH); |
if ((rrc = (*pcre_callout)(&cb)) > 0) MRRETURN(MATCH_NOMATCH); |
| 1285 |
if (rrc < 0) RRETURN(rrc); |
if (rrc < 0) RRETURN(rrc); |
| 1286 |
} |
} |
| 1287 |
ecode += 2 + 2*LINK_SIZE; |
ecode += 2 + 2*LINK_SIZE; |
| 1336 |
|
|
| 1337 |
memcpy(new_recursive.offset_save, md->offset_vector, |
memcpy(new_recursive.offset_save, md->offset_vector, |
| 1338 |
new_recursive.saved_max * sizeof(int)); |
new_recursive.saved_max * sizeof(int)); |
| 1339 |
new_recursive.save_start = mstart; |
new_recursive.save_offset_top = offset_top; |
|
mstart = eptr; |
|
| 1340 |
|
|
| 1341 |
/* OK, now we can do the recursion. For each top-level alternative we |
/* OK, now we can do the recursion. For each top-level alternative we |
| 1342 |
restore the offset and recursion data. */ |
restore the offset and recursion data. */ |
| 1353 |
md->recursive = new_recursive.prevrec; |
md->recursive = new_recursive.prevrec; |
| 1354 |
if (new_recursive.offset_save != stacksave) |
if (new_recursive.offset_save != stacksave) |
| 1355 |
(pcre_free)(new_recursive.offset_save); |
(pcre_free)(new_recursive.offset_save); |
| 1356 |
RRETURN(MATCH_MATCH); |
MRRETURN(MATCH_MATCH); |
| 1357 |
} |
} |
| 1358 |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
| 1359 |
{ |
{ |
| 1374 |
md->recursive = new_recursive.prevrec; |
md->recursive = new_recursive.prevrec; |
| 1375 |
if (new_recursive.offset_save != stacksave) |
if (new_recursive.offset_save != stacksave) |
| 1376 |
(pcre_free)(new_recursive.offset_save); |
(pcre_free)(new_recursive.offset_save); |
| 1377 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1378 |
} |
} |
| 1379 |
/* Control never reaches here */ |
/* Control never reaches here */ |
| 1380 |
|
|
| 1383 |
a move back into the brackets. Friedl calls these "atomic" subpatterns. |
a move back into the brackets. Friedl calls these "atomic" subpatterns. |
| 1384 |
Check the alternative branches in turn - the matching won't pass the KET |
Check the alternative branches in turn - the matching won't pass the KET |
| 1385 |
for this kind of subpattern. If any one branch matches, we carry on as at |
for this kind of subpattern. If any one branch matches, we carry on as at |
| 1386 |
the end of a normal bracket, leaving the subject pointer. */ |
the end of a normal bracket, leaving the subject pointer, but resetting |
| 1387 |
|
the start-of-match value in case it was changed by \K. */ |
| 1388 |
|
|
| 1389 |
case OP_ONCE: |
case OP_ONCE: |
| 1390 |
prev = ecode; |
prev = ecode; |
| 1393 |
do |
do |
| 1394 |
{ |
{ |
| 1395 |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM7); |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM7); |
| 1396 |
if (rrc == MATCH_MATCH) break; |
if (rrc == MATCH_MATCH) |
| 1397 |
|
{ |
| 1398 |
|
mstart = md->start_match_ptr; |
| 1399 |
|
break; |
| 1400 |
|
} |
| 1401 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
| 1402 |
ecode += GET(ecode,1); |
ecode += GET(ecode,1); |
| 1403 |
} |
} |
| 1516 |
} |
} |
| 1517 |
else saved_eptr = NULL; |
else saved_eptr = NULL; |
| 1518 |
|
|
| 1519 |
/* If we are at the end of an assertion group, stop matching and return |
/* If we are at the end of an assertion group or an atomic group, stop |
| 1520 |
MATCH_MATCH, but record the current high water mark for use by positive |
matching and return MATCH_MATCH, but record the current high water mark for |
| 1521 |
assertions. Do this also for the "once" (atomic) groups. */ |
use by positive assertions. We also need to record the match start in case |
| 1522 |
|
it was changed by \K. */ |
| 1523 |
|
|
| 1524 |
if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT || |
if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT || |
| 1525 |
*prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT || |
*prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT || |
| 1527 |
{ |
{ |
| 1528 |
md->end_match_ptr = eptr; /* For ONCE */ |
md->end_match_ptr = eptr; /* For ONCE */ |
| 1529 |
md->end_offset_top = offset_top; |
md->end_offset_top = offset_top; |
| 1530 |
RRETURN(MATCH_MATCH); |
md->start_match_ptr = mstart; |
| 1531 |
|
MRRETURN(MATCH_MATCH); |
| 1532 |
} |
} |
| 1533 |
|
|
| 1534 |
/* For capturing groups we have to check the group number back at the start |
/* For capturing groups we have to check the group number back at the start |
| 1542 |
number = GET2(prev, 1+LINK_SIZE); |
number = GET2(prev, 1+LINK_SIZE); |
| 1543 |
offset = number << 1; |
offset = number << 1; |
| 1544 |
|
|
| 1545 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 1546 |
printf("end bracket %d", number); |
printf("end bracket %d", number); |
| 1547 |
printf("\n"); |
printf("\n"); |
| 1548 |
#endif |
#endif |
| 1564 |
recursion_info *rec = md->recursive; |
recursion_info *rec = md->recursive; |
| 1565 |
DPRINTF(("Recursion (%d) succeeded - continuing\n", number)); |
DPRINTF(("Recursion (%d) succeeded - continuing\n", number)); |
| 1566 |
md->recursive = rec->prevrec; |
md->recursive = rec->prevrec; |
|
mstart = rec->save_start; |
|
| 1567 |
memcpy(md->offset_vector, rec->offset_save, |
memcpy(md->offset_vector, rec->offset_save, |
| 1568 |
rec->saved_max * sizeof(int)); |
rec->saved_max * sizeof(int)); |
| 1569 |
|
offset_top = rec->save_offset_top; |
| 1570 |
ecode = rec->after_call; |
ecode = rec->after_call; |
| 1571 |
ims = original_ims; |
ims = original_ims; |
| 1572 |
break; |
break; |
| 1623 |
/* Start of subject unless notbol, or after internal newline if multiline */ |
/* Start of subject unless notbol, or after internal newline if multiline */ |
| 1624 |
|
|
| 1625 |
case OP_CIRC: |
case OP_CIRC: |
| 1626 |
if (md->notbol && eptr == md->start_subject) RRETURN(MATCH_NOMATCH); |
if (md->notbol && eptr == md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1627 |
if ((ims & PCRE_MULTILINE) != 0) |
if ((ims & PCRE_MULTILINE) != 0) |
| 1628 |
{ |
{ |
| 1629 |
if (eptr != md->start_subject && |
if (eptr != md->start_subject && |
| 1630 |
(eptr == md->end_subject || !WAS_NEWLINE(eptr))) |
(eptr == md->end_subject || !WAS_NEWLINE(eptr))) |
| 1631 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1632 |
ecode++; |
ecode++; |
| 1633 |
break; |
break; |
| 1634 |
} |
} |
| 1637 |
/* Start of subject assertion */ |
/* Start of subject assertion */ |
| 1638 |
|
|
| 1639 |
case OP_SOD: |
case OP_SOD: |
| 1640 |
if (eptr != md->start_subject) RRETURN(MATCH_NOMATCH); |
if (eptr != md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1641 |
ecode++; |
ecode++; |
| 1642 |
break; |
break; |
| 1643 |
|
|
| 1644 |
/* Start of match assertion */ |
/* Start of match assertion */ |
| 1645 |
|
|
| 1646 |
case OP_SOM: |
case OP_SOM: |
| 1647 |
if (eptr != md->start_subject + md->start_offset) RRETURN(MATCH_NOMATCH); |
if (eptr != md->start_subject + md->start_offset) MRRETURN(MATCH_NOMATCH); |
| 1648 |
ecode++; |
ecode++; |
| 1649 |
break; |
break; |
| 1650 |
|
|
| 1662 |
if ((ims & PCRE_MULTILINE) != 0) |
if ((ims & PCRE_MULTILINE) != 0) |
| 1663 |
{ |
{ |
| 1664 |
if (eptr < md->end_subject) |
if (eptr < md->end_subject) |
| 1665 |
{ if (!IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); } |
{ if (!IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); } |
| 1666 |
else |
else |
| 1667 |
{ if (md->noteol) RRETURN(MATCH_NOMATCH); } |
{ if (md->noteol) MRRETURN(MATCH_NOMATCH); } |
| 1668 |
ecode++; |
ecode++; |
| 1669 |
break; |
break; |
| 1670 |
} |
} |
| 1671 |
else |
else |
| 1672 |
{ |
{ |
| 1673 |
if (md->noteol) RRETURN(MATCH_NOMATCH); |
if (md->noteol) MRRETURN(MATCH_NOMATCH); |
| 1674 |
if (!md->endonly) |
if (!md->endonly) |
| 1675 |
{ |
{ |
| 1676 |
if (eptr != md->end_subject && |
if (eptr != md->end_subject && |
| 1677 |
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen)) |
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen)) |
| 1678 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1679 |
ecode++; |
ecode++; |
| 1680 |
break; |
break; |
| 1681 |
} |
} |
| 1685 |
/* End of subject assertion (\z) */ |
/* End of subject assertion (\z) */ |
| 1686 |
|
|
| 1687 |
case OP_EOD: |
case OP_EOD: |
| 1688 |
if (eptr < md->end_subject) RRETURN(MATCH_NOMATCH); |
if (eptr < md->end_subject) MRRETURN(MATCH_NOMATCH); |
| 1689 |
ecode++; |
ecode++; |
| 1690 |
break; |
break; |
| 1691 |
|
|
| 1694 |
case OP_EODN: |
case OP_EODN: |
| 1695 |
if (eptr != md->end_subject && |
if (eptr != md->end_subject && |
| 1696 |
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen)) |
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen)) |
| 1697 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1698 |
ecode++; |
ecode++; |
| 1699 |
break; |
break; |
| 1700 |
|
|
| 1706 |
|
|
| 1707 |
/* Find out if the previous and current characters are "word" characters. |
/* Find out if the previous and current characters are "word" characters. |
| 1708 |
It takes a bit more work in UTF-8 mode. Characters > 255 are assumed to |
It takes a bit more work in UTF-8 mode. Characters > 255 are assumed to |
| 1709 |
be "non-word" characters. Remember the earliest consulted character for |
be "non-word" characters. Remember the earliest consulted character for |
| 1710 |
partial matching. */ |
partial matching. */ |
| 1711 |
|
|
| 1712 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1716 |
{ |
{ |
| 1717 |
USPTR lastptr = eptr - 1; |
USPTR lastptr = eptr - 1; |
| 1718 |
while((*lastptr & 0xc0) == 0x80) lastptr--; |
while((*lastptr & 0xc0) == 0x80) lastptr--; |
| 1719 |
if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr; |
if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr; |
| 1720 |
GETCHAR(c, lastptr); |
GETCHAR(c, lastptr); |
| 1721 |
prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
| 1722 |
} |
} |
| 1723 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1724 |
{ |
{ |
| 1725 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1726 |
cur_is_word = FALSE; |
cur_is_word = FALSE; |
| 1727 |
} |
} |
| 1728 |
else |
else |
| 1729 |
{ |
{ |
| 1739 |
{ |
{ |
| 1740 |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
| 1741 |
{ |
{ |
| 1742 |
if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1; |
if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1; |
| 1743 |
prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0); |
prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0); |
| 1744 |
} |
} |
| 1745 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1746 |
{ |
{ |
| 1747 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1748 |
cur_is_word = FALSE; |
cur_is_word = FALSE; |
| 1749 |
} |
} |
| 1750 |
else cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0); |
else cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0); |
| 1751 |
} |
} |
| 1754 |
|
|
| 1755 |
if ((*ecode++ == OP_WORD_BOUNDARY)? |
if ((*ecode++ == OP_WORD_BOUNDARY)? |
| 1756 |
cur_is_word == prev_is_word : cur_is_word != prev_is_word) |
cur_is_word == prev_is_word : cur_is_word != prev_is_word) |
| 1757 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1758 |
} |
} |
| 1759 |
break; |
break; |
| 1760 |
|
|
| 1761 |
/* Match a single character type; inline for speed */ |
/* Match a single character type; inline for speed */ |
| 1762 |
|
|
| 1763 |
case OP_ANY: |
case OP_ANY: |
| 1764 |
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); |
if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); |
| 1765 |
/* Fall through */ |
/* Fall through */ |
| 1766 |
|
|
| 1767 |
case OP_ALLANY: |
case OP_ALLANY: |
| 1768 |
if (eptr++ >= md->end_subject) |
if (eptr++ >= md->end_subject) |
| 1769 |
{ |
{ |
| 1770 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1771 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1772 |
} |
} |
| 1773 |
if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 1774 |
ecode++; |
ecode++; |
| 1775 |
break; |
break; |
| 1778 |
any byte, even newline, independent of the setting of PCRE_DOTALL. */ |
any byte, even newline, independent of the setting of PCRE_DOTALL. */ |
| 1779 |
|
|
| 1780 |
case OP_ANYBYTE: |
case OP_ANYBYTE: |
| 1781 |
if (eptr++ >= md->end_subject) |
if (eptr++ >= md->end_subject) |
| 1782 |
{ |
{ |
| 1783 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1784 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1785 |
} |
} |
| 1786 |
ecode++; |
ecode++; |
| 1787 |
break; |
break; |
| 1788 |
|
|
| 1789 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 1790 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1791 |
{ |
{ |
| 1792 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1793 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1794 |
} |
} |
| 1795 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1796 |
if ( |
if ( |
| 1797 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1799 |
#endif |
#endif |
| 1800 |
(md->ctypes[c] & ctype_digit) != 0 |
(md->ctypes[c] & ctype_digit) != 0 |
| 1801 |
) |
) |
| 1802 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1803 |
ecode++; |
ecode++; |
| 1804 |
break; |
break; |
| 1805 |
|
|
| 1806 |
case OP_DIGIT: |
case OP_DIGIT: |
| 1807 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1808 |
{ |
{ |
| 1809 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1810 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1811 |
} |
} |
| 1812 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1813 |
if ( |
if ( |
| 1814 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1816 |
#endif |
#endif |
| 1817 |
(md->ctypes[c] & ctype_digit) == 0 |
(md->ctypes[c] & ctype_digit) == 0 |
| 1818 |
) |
) |
| 1819 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1820 |
ecode++; |
ecode++; |
| 1821 |
break; |
break; |
| 1822 |
|
|
| 1823 |
case OP_NOT_WHITESPACE: |
case OP_NOT_WHITESPACE: |
| 1824 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1825 |
{ |
{ |
| 1826 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1827 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1828 |
} |
} |
| 1829 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1830 |
if ( |
if ( |
| 1831 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1833 |
#endif |
#endif |
| 1834 |
(md->ctypes[c] & ctype_space) != 0 |
(md->ctypes[c] & ctype_space) != 0 |
| 1835 |
) |
) |
| 1836 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1837 |
ecode++; |
ecode++; |
| 1838 |
break; |
break; |
| 1839 |
|
|
| 1840 |
case OP_WHITESPACE: |
case OP_WHITESPACE: |
| 1841 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1842 |
{ |
{ |
| 1843 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1844 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1845 |
} |
} |
| 1846 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1847 |
if ( |
if ( |
| 1848 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1850 |
#endif |
#endif |
| 1851 |
(md->ctypes[c] & ctype_space) == 0 |
(md->ctypes[c] & ctype_space) == 0 |
| 1852 |
) |
) |
| 1853 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1854 |
ecode++; |
ecode++; |
| 1855 |
break; |
break; |
| 1856 |
|
|
| 1857 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 1858 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1859 |
{ |
{ |
| 1860 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1861 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1862 |
} |
} |
| 1863 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1864 |
if ( |
if ( |
| 1865 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1867 |
#endif |
#endif |
| 1868 |
(md->ctypes[c] & ctype_word) != 0 |
(md->ctypes[c] & ctype_word) != 0 |
| 1869 |
) |
) |
| 1870 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1871 |
ecode++; |
ecode++; |
| 1872 |
break; |
break; |
| 1873 |
|
|
| 1874 |
case OP_WORDCHAR: |
case OP_WORDCHAR: |
| 1875 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1876 |
{ |
{ |
| 1877 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1878 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1879 |
} |
} |
| 1880 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1881 |
if ( |
if ( |
| 1882 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1884 |
#endif |
#endif |
| 1885 |
(md->ctypes[c] & ctype_word) == 0 |
(md->ctypes[c] & ctype_word) == 0 |
| 1886 |
) |
) |
| 1887 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1888 |
ecode++; |
ecode++; |
| 1889 |
break; |
break; |
| 1890 |
|
|
| 1891 |
case OP_ANYNL: |
case OP_ANYNL: |
| 1892 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1893 |
{ |
{ |
| 1894 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1895 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1896 |
} |
} |
| 1897 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1898 |
switch(c) |
switch(c) |
| 1899 |
{ |
{ |
| 1900 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 1901 |
case 0x000d: |
case 0x000d: |
| 1902 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 1903 |
break; |
break; |
| 1910 |
case 0x0085: |
case 0x0085: |
| 1911 |
case 0x2028: |
case 0x2028: |
| 1912 |
case 0x2029: |
case 0x2029: |
| 1913 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 1914 |
break; |
break; |
| 1915 |
} |
} |
| 1916 |
ecode++; |
ecode++; |
| 1917 |
break; |
break; |
| 1918 |
|
|
| 1919 |
case OP_NOT_HSPACE: |
case OP_NOT_HSPACE: |
| 1920 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1921 |
{ |
{ |
| 1922 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1923 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1924 |
} |
} |
| 1925 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1926 |
switch(c) |
switch(c) |
| 1927 |
{ |
{ |
| 1945 |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 1946 |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 1947 |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 1948 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1949 |
} |
} |
| 1950 |
ecode++; |
ecode++; |
| 1951 |
break; |
break; |
| 1952 |
|
|
| 1953 |
case OP_HSPACE: |
case OP_HSPACE: |
| 1954 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1955 |
{ |
{ |
| 1956 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1957 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1958 |
} |
} |
| 1959 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1960 |
switch(c) |
switch(c) |
| 1961 |
{ |
{ |
| 1962 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 1963 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 1964 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 1965 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 1985 |
break; |
break; |
| 1986 |
|
|
| 1987 |
case OP_NOT_VSPACE: |
case OP_NOT_VSPACE: |
| 1988 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1989 |
{ |
{ |
| 1990 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1991 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1992 |
} |
} |
| 1993 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1994 |
switch(c) |
switch(c) |
| 1995 |
{ |
{ |
| 2001 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 2002 |
case 0x2028: /* LINE SEPARATOR */ |
case 0x2028: /* LINE SEPARATOR */ |
| 2003 |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 2004 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2005 |
} |
} |
| 2006 |
ecode++; |
ecode++; |
| 2007 |
break; |
break; |
| 2008 |
|
|
| 2009 |
case OP_VSPACE: |
case OP_VSPACE: |
| 2010 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2011 |
{ |
{ |
| 2012 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2013 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2014 |
} |
} |
| 2015 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2016 |
switch(c) |
switch(c) |
| 2017 |
{ |
{ |
| 2018 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 2019 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 2020 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 2021 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 2034 |
|
|
| 2035 |
case OP_PROP: |
case OP_PROP: |
| 2036 |
case OP_NOTPROP: |
case OP_NOTPROP: |
| 2037 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2038 |
{ |
{ |
| 2039 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2040 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2041 |
} |
} |
| 2042 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2043 |
{ |
{ |
| 2044 |
const ucd_record *prop = GET_UCD(c); |
const ucd_record *prop = GET_UCD(c); |
| 2046 |
switch(ecode[1]) |
switch(ecode[1]) |
| 2047 |
{ |
{ |
| 2048 |
case PT_ANY: |
case PT_ANY: |
| 2049 |
if (op == OP_NOTPROP) RRETURN(MATCH_NOMATCH); |
if (op == OP_NOTPROP) MRRETURN(MATCH_NOMATCH); |
| 2050 |
break; |
break; |
| 2051 |
|
|
| 2052 |
case PT_LAMP: |
case PT_LAMP: |
| 2053 |
if ((prop->chartype == ucp_Lu || |
if ((prop->chartype == ucp_Lu || |
| 2054 |
prop->chartype == ucp_Ll || |
prop->chartype == ucp_Ll || |
| 2055 |
prop->chartype == ucp_Lt) == (op == OP_NOTPROP)) |
prop->chartype == ucp_Lt) == (op == OP_NOTPROP)) |
| 2056 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2057 |
break; |
break; |
| 2058 |
|
|
| 2059 |
case PT_GC: |
case PT_GC: |
| 2060 |
if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP)) |
if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP)) |
| 2061 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2062 |
break; |
break; |
| 2063 |
|
|
| 2064 |
case PT_PC: |
case PT_PC: |
| 2065 |
if ((ecode[2] != prop->chartype) == (op == OP_PROP)) |
if ((ecode[2] != prop->chartype) == (op == OP_PROP)) |
| 2066 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2067 |
break; |
break; |
| 2068 |
|
|
| 2069 |
case PT_SC: |
case PT_SC: |
| 2070 |
if ((ecode[2] != prop->script) == (op == OP_PROP)) |
if ((ecode[2] != prop->script) == (op == OP_PROP)) |
| 2071 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2072 |
break; |
break; |
| 2073 |
|
|
| 2074 |
default: |
default: |
| 2083 |
is in the binary; otherwise a compile-time error occurs. */ |
is in the binary; otherwise a compile-time error occurs. */ |
| 2084 |
|
|
| 2085 |
case OP_EXTUNI: |
case OP_EXTUNI: |
| 2086 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2087 |
{ |
{ |
| 2088 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2089 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2090 |
} |
} |
| 2091 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2092 |
{ |
{ |
| 2093 |
int category = UCD_CATEGORY(c); |
int category = UCD_CATEGORY(c); |
| 2094 |
if (category == ucp_M) RRETURN(MATCH_NOMATCH); |
if (category == ucp_M) MRRETURN(MATCH_NOMATCH); |
| 2095 |
while (eptr < md->end_subject) |
while (eptr < md->end_subject) |
| 2096 |
{ |
{ |
| 2097 |
int len = 1; |
int len = 1; |
| 2167 |
break; |
break; |
| 2168 |
|
|
| 2169 |
default: /* No repeat follows */ |
default: /* No repeat follows */ |
| 2170 |
if (!match_ref(offset, eptr, length, md, ims)) |
if (!match_ref(offset, eptr, length, md, ims)) |
| 2171 |
{ |
{ |
| 2172 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2173 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2174 |
} |
} |
| 2175 |
eptr += length; |
eptr += length; |
| 2176 |
continue; /* With the main loop */ |
continue; /* With the main loop */ |
| 2177 |
} |
} |
| 2178 |
|
|
| 2179 |
/* If the length of the reference is zero, just continue with the |
/* If the length of the reference is zero, just continue with the |
| 2180 |
main loop. */ |
main loop. */ |
| 2181 |
|
|
| 2182 |
if (length == 0) continue; |
if (length == 0) continue; |
| 2183 |
|
|
| 2184 |
/* First, ensure the minimum number of matches are present. We get back |
/* First, ensure the minimum number of matches are present. We get back |
| 2190 |
if (!match_ref(offset, eptr, length, md, ims)) |
if (!match_ref(offset, eptr, length, md, ims)) |
| 2191 |
{ |
{ |
| 2192 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2193 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2194 |
} |
} |
| 2195 |
eptr += length; |
eptr += length; |
| 2196 |
} |
} |
| 2208 |
{ |
{ |
| 2209 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14); |
| 2210 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2211 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2212 |
if (!match_ref(offset, eptr, length, md, ims)) |
if (!match_ref(offset, eptr, length, md, ims)) |
| 2213 |
{ |
{ |
| 2214 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2215 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2216 |
} |
} |
| 2217 |
eptr += length; |
eptr += length; |
| 2218 |
} |
} |
| 2226 |
pp = eptr; |
pp = eptr; |
| 2227 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 2228 |
{ |
{ |
| 2229 |
if (!match_ref(offset, eptr, length, md, ims)) break; |
if (!match_ref(offset, eptr, length, md, ims)) |
| 2230 |
|
{ |
| 2231 |
|
CHECK_PARTIAL(); |
| 2232 |
|
break; |
| 2233 |
|
} |
| 2234 |
eptr += length; |
eptr += length; |
| 2235 |
} |
} |
| 2236 |
while (eptr >= pp) |
while (eptr >= pp) |
| 2239 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2240 |
eptr -= length; |
eptr -= length; |
| 2241 |
} |
} |
| 2242 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2243 |
} |
} |
| 2244 |
} |
} |
| 2245 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2301 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2302 |
{ |
{ |
| 2303 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2304 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2305 |
} |
} |
| 2306 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 2307 |
if (c > 255) |
if (c > 255) |
| 2308 |
{ |
{ |
| 2309 |
if (op == OP_CLASS) RRETURN(MATCH_NOMATCH); |
if (op == OP_CLASS) MRRETURN(MATCH_NOMATCH); |
| 2310 |
} |
} |
| 2311 |
else |
else |
| 2312 |
{ |
{ |
| 2313 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2314 |
} |
} |
| 2315 |
} |
} |
| 2316 |
} |
} |
| 2323 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2324 |
{ |
{ |
| 2325 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2326 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2327 |
} |
} |
| 2328 |
c = *eptr++; |
c = *eptr++; |
| 2329 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2330 |
} |
} |
| 2331 |
} |
} |
| 2332 |
|
|
| 2348 |
{ |
{ |
| 2349 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16); |
| 2350 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2351 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2352 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2353 |
{ |
{ |
| 2354 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2355 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2356 |
} |
} |
| 2357 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 2358 |
if (c > 255) |
if (c > 255) |
| 2359 |
{ |
{ |
| 2360 |
if (op == OP_CLASS) RRETURN(MATCH_NOMATCH); |
if (op == OP_CLASS) MRRETURN(MATCH_NOMATCH); |
| 2361 |
} |
} |
| 2362 |
else |
else |
| 2363 |
{ |
{ |
| 2364 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2365 |
} |
} |
| 2366 |
} |
} |
| 2367 |
} |
} |
| 2373 |
{ |
{ |
| 2374 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17); |
| 2375 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2376 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2377 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2378 |
{ |
{ |
| 2379 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2380 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2381 |
} |
} |
| 2382 |
c = *eptr++; |
c = *eptr++; |
| 2383 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2384 |
} |
} |
| 2385 |
} |
} |
| 2386 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2399 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 2400 |
{ |
{ |
| 2401 |
int len = 1; |
int len = 1; |
| 2402 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 2403 |
|
{ |
| 2404 |
|
SCHECK_PARTIAL(); |
| 2405 |
|
break; |
| 2406 |
|
} |
| 2407 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 2408 |
if (c > 255) |
if (c > 255) |
| 2409 |
{ |
{ |
| 2429 |
{ |
{ |
| 2430 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 2431 |
{ |
{ |
| 2432 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 2433 |
|
{ |
| 2434 |
|
SCHECK_PARTIAL(); |
| 2435 |
|
break; |
| 2436 |
|
} |
| 2437 |
c = *eptr; |
c = *eptr; |
| 2438 |
if ((data[c/8] & (1 << (c&7))) == 0) break; |
if ((data[c/8] & (1 << (c&7))) == 0) break; |
| 2439 |
eptr++; |
eptr++; |
| 2446 |
} |
} |
| 2447 |
} |
} |
| 2448 |
|
|
| 2449 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2450 |
} |
} |
| 2451 |
} |
} |
| 2452 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2498 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2499 |
{ |
{ |
| 2500 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2501 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2502 |
} |
} |
| 2503 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2504 |
if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH); |
if (!_pcre_xclass(c, data)) MRRETURN(MATCH_NOMATCH); |
| 2505 |
} |
} |
| 2506 |
|
|
| 2507 |
/* If max == min we can continue with the main loop without the |
/* If max == min we can continue with the main loop without the |
| 2518 |
{ |
{ |
| 2519 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20); |
| 2520 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2521 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2522 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2523 |
{ |
{ |
| 2524 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2525 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2526 |
} |
} |
| 2527 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2528 |
if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH); |
if (!_pcre_xclass(c, data)) MRRETURN(MATCH_NOMATCH); |
| 2529 |
} |
} |
| 2530 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2531 |
} |
} |
| 2538 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 2539 |
{ |
{ |
| 2540 |
int len = 1; |
int len = 1; |
| 2541 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 2542 |
|
{ |
| 2543 |
|
SCHECK_PARTIAL(); |
| 2544 |
|
break; |
| 2545 |
|
} |
| 2546 |
GETCHARLENTEST(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 2547 |
if (!_pcre_xclass(c, data)) break; |
if (!_pcre_xclass(c, data)) break; |
| 2548 |
eptr += len; |
eptr += len; |
| 2554 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 2555 |
if (utf8) BACKCHAR(eptr); |
if (utf8) BACKCHAR(eptr); |
| 2556 |
} |
} |
| 2557 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2558 |
} |
} |
| 2559 |
|
|
| 2560 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2570 |
length = 1; |
length = 1; |
| 2571 |
ecode++; |
ecode++; |
| 2572 |
GETCHARLEN(fc, ecode, length); |
GETCHARLEN(fc, ecode, length); |
| 2573 |
if (length > md->end_subject - eptr) |
if (length > md->end_subject - eptr) |
| 2574 |
{ |
{ |
| 2575 |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
| 2576 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2577 |
} |
} |
| 2578 |
while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH); |
while (length-- > 0) if (*ecode++ != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 2579 |
} |
} |
| 2580 |
else |
else |
| 2581 |
#endif |
#endif |
| 2582 |
|
|
| 2583 |
/* Non-UTF-8 mode */ |
/* Non-UTF-8 mode */ |
| 2584 |
{ |
{ |
| 2585 |
if (md->end_subject - eptr < 1) |
if (md->end_subject - eptr < 1) |
| 2586 |
{ |
{ |
| 2587 |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
| 2588 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2589 |
} |
} |
| 2590 |
if (ecode[1] != *eptr++) RRETURN(MATCH_NOMATCH); |
if (ecode[1] != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 2591 |
ecode += 2; |
ecode += 2; |
| 2592 |
} |
} |
| 2593 |
break; |
break; |
| 2602 |
ecode++; |
ecode++; |
| 2603 |
GETCHARLEN(fc, ecode, length); |
GETCHARLEN(fc, ecode, length); |
| 2604 |
|
|
| 2605 |
if (length > md->end_subject - eptr) |
if (length > md->end_subject - eptr) |
| 2606 |
{ |
{ |
| 2607 |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
| 2608 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2609 |
} |
} |
| 2610 |
|
|
| 2611 |
/* If the pattern character's value is < 128, we have only one byte, and |
/* If the pattern character's value is < 128, we have only one byte, and |
| 2612 |
can use the fast lookup table. */ |
can use the fast lookup table. */ |
| 2613 |
|
|
| 2614 |
if (fc < 128) |
if (fc < 128) |
| 2615 |
{ |
{ |
| 2616 |
if (md->lcc[*ecode++] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (md->lcc[*ecode++] != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2617 |
} |
} |
| 2618 |
|
|
| 2619 |
/* Otherwise we must pick up the subject character */ |
/* Otherwise we must pick up the subject character */ |
| 2632 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2633 |
if (dc != UCD_OTHERCASE(fc)) |
if (dc != UCD_OTHERCASE(fc)) |
| 2634 |
#endif |
#endif |
| 2635 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2636 |
} |
} |
| 2637 |
} |
} |
| 2638 |
} |
} |
| 2641 |
|
|
| 2642 |
/* Non-UTF-8 mode */ |
/* Non-UTF-8 mode */ |
| 2643 |
{ |
{ |
| 2644 |
if (md->end_subject - eptr < 1) |
if (md->end_subject - eptr < 1) |
| 2645 |
{ |
{ |
| 2646 |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
| 2647 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2648 |
} |
} |
| 2649 |
if (md->lcc[ecode[1]] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (md->lcc[ecode[1]] != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2650 |
ecode += 2; |
ecode += 2; |
| 2651 |
} |
} |
| 2652 |
break; |
break; |
| 2699 |
case OP_MINQUERY: |
case OP_MINQUERY: |
| 2700 |
c = *ecode++ - OP_STAR; |
c = *ecode++ - OP_STAR; |
| 2701 |
minimize = (c & 1) != 0; |
minimize = (c & 1) != 0; |
| 2702 |
|
|
| 2703 |
min = rep_min[c]; /* Pick up values from tables; */ |
min = rep_min[c]; /* Pick up values from tables; */ |
| 2704 |
max = rep_max[c]; /* zero for max => infinity */ |
max = rep_max[c]; /* zero for max => infinity */ |
| 2705 |
if (max == 0) max = INT_MAX; |
if (max == 0) max = INT_MAX; |
| 2740 |
else |
else |
| 2741 |
{ |
{ |
| 2742 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2743 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2744 |
} |
} |
| 2745 |
} |
} |
| 2746 |
|
|
| 2752 |
{ |
{ |
| 2753 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22); |
| 2754 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2755 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2756 |
if (eptr <= md->end_subject - length && |
if (eptr <= md->end_subject - length && |
| 2757 |
memcmp(eptr, charptr, length) == 0) eptr += length; |
memcmp(eptr, charptr, length) == 0) eptr += length; |
| 2758 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2763 |
else |
else |
| 2764 |
{ |
{ |
| 2765 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2766 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2767 |
} |
} |
| 2768 |
} |
} |
| 2769 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2781 |
eptr <= md->end_subject - oclength && |
eptr <= md->end_subject - oclength && |
| 2782 |
memcmp(eptr, occhars, oclength) == 0) eptr += oclength; |
memcmp(eptr, occhars, oclength) == 0) eptr += oclength; |
| 2783 |
#endif /* SUPPORT_UCP */ |
#endif /* SUPPORT_UCP */ |
| 2784 |
else break; |
else |
| 2785 |
|
{ |
| 2786 |
|
CHECK_PARTIAL(); |
| 2787 |
|
break; |
| 2788 |
|
} |
| 2789 |
} |
} |
| 2790 |
|
|
| 2791 |
if (possessive) continue; |
if (possessive) continue; |
| 2794 |
{ |
{ |
| 2795 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23); |
| 2796 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2797 |
if (eptr == pp) { RRETURN(MATCH_NOMATCH); } |
if (eptr == pp) { MRRETURN(MATCH_NOMATCH); } |
| 2798 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2799 |
eptr--; |
eptr--; |
| 2800 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 2816 |
/* When not in UTF-8 mode, load a single-byte character. */ |
/* When not in UTF-8 mode, load a single-byte character. */ |
| 2817 |
|
|
| 2818 |
fc = *ecode++; |
fc = *ecode++; |
| 2819 |
|
|
| 2820 |
/* The value of fc at this point is always less than 256, though we may or |
/* The value of fc at this point is always less than 256, though we may or |
| 2821 |
may not be in UTF-8 mode. The code is duplicated for the caseless and |
may not be in UTF-8 mode. The code is duplicated for the caseless and |
| 2822 |
caseful cases, for speed, since matching characters is likely to be quite |
caseful cases, for speed, since matching characters is likely to be quite |
| 2837 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2838 |
{ |
{ |
| 2839 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2840 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2841 |
} |
} |
| 2842 |
if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2843 |
} |
} |
| 2844 |
if (min == max) continue; |
if (min == max) continue; |
| 2845 |
if (minimize) |
if (minimize) |
| 2848 |
{ |
{ |
| 2849 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24); |
| 2850 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2851 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2852 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2853 |
{ |
{ |
| 2854 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2855 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2856 |
} |
} |
| 2857 |
if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2858 |
} |
} |
| 2859 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2860 |
} |
} |
| 2863 |
pp = eptr; |
pp = eptr; |
| 2864 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 2865 |
{ |
{ |
| 2866 |
if (eptr >= md->end_subject || fc != md->lcc[*eptr]) break; |
if (eptr >= md->end_subject) |
| 2867 |
|
{ |
| 2868 |
|
SCHECK_PARTIAL(); |
| 2869 |
|
break; |
| 2870 |
|
} |
| 2871 |
|
if (fc != md->lcc[*eptr]) break; |
| 2872 |
eptr++; |
eptr++; |
| 2873 |
} |
} |
| 2874 |
|
|
| 2880 |
eptr--; |
eptr--; |
| 2881 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2882 |
} |
} |
| 2883 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2884 |
} |
} |
| 2885 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2886 |
} |
} |
| 2894 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2895 |
{ |
{ |
| 2896 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2897 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2898 |
} |
} |
| 2899 |
if (fc != *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 2900 |
} |
} |
| 2901 |
|
|
| 2902 |
if (min == max) continue; |
if (min == max) continue; |
| 2903 |
|
|
| 2904 |
if (minimize) |
if (minimize) |
| 2905 |
{ |
{ |
| 2906 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 2907 |
{ |
{ |
| 2908 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26); |
| 2909 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2910 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2911 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2912 |
{ |
{ |
| 2913 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2914 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2915 |
} |
} |
| 2916 |
if (fc != *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 2917 |
} |
} |
| 2918 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2919 |
} |
} |
| 2922 |
pp = eptr; |
pp = eptr; |
| 2923 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 2924 |
{ |
{ |
| 2925 |
if (eptr >= md->end_subject || fc != *eptr) break; |
if (eptr >= md->end_subject) |
| 2926 |
|
{ |
| 2927 |
|
SCHECK_PARTIAL(); |
| 2928 |
|
break; |
| 2929 |
|
} |
| 2930 |
|
if (fc != *eptr) break; |
| 2931 |
eptr++; |
eptr++; |
| 2932 |
} |
} |
| 2933 |
if (possessive) continue; |
if (possessive) continue; |
| 2934 |
|
|
| 2935 |
while (eptr >= pp) |
while (eptr >= pp) |
| 2936 |
{ |
{ |
| 2937 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM27); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM27); |
| 2938 |
eptr--; |
eptr--; |
| 2939 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2940 |
} |
} |
| 2941 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2942 |
} |
} |
| 2943 |
} |
} |
| 2944 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2947 |
checking can be multibyte. */ |
checking can be multibyte. */ |
| 2948 |
|
|
| 2949 |
case OP_NOT: |
case OP_NOT: |
| 2950 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2951 |
{ |
{ |
| 2952 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2953 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2954 |
} |
} |
| 2955 |
ecode++; |
ecode++; |
| 2956 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2957 |
if ((ims & PCRE_CASELESS) != 0) |
if ((ims & PCRE_CASELESS) != 0) |
| 2960 |
if (c < 256) |
if (c < 256) |
| 2961 |
#endif |
#endif |
| 2962 |
c = md->lcc[c]; |
c = md->lcc[c]; |
| 2963 |
if (md->lcc[*ecode++] == c) RRETURN(MATCH_NOMATCH); |
if (md->lcc[*ecode++] == c) MRRETURN(MATCH_NOMATCH); |
| 2964 |
} |
} |
| 2965 |
else |
else |
| 2966 |
{ |
{ |
| 2967 |
if (*ecode++ == c) RRETURN(MATCH_NOMATCH); |
if (*ecode++ == c) MRRETURN(MATCH_NOMATCH); |
| 2968 |
} |
} |
| 2969 |
break; |
break; |
| 2970 |
|
|
| 3058 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3059 |
{ |
{ |
| 3060 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3061 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3062 |
} |
} |
| 3063 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3064 |
if (d < 256) d = md->lcc[d]; |
if (d < 256) d = md->lcc[d]; |
| 3065 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3066 |
} |
} |
| 3067 |
} |
} |
| 3068 |
else |
else |
| 3075 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3076 |
{ |
{ |
| 3077 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3078 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3079 |
} |
} |
| 3080 |
if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc == md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 3081 |
} |
} |
| 3082 |
} |
} |
| 3083 |
|
|
| 3094 |
{ |
{ |
| 3095 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28); |
| 3096 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3097 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3098 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3099 |
{ |
{ |
| 3100 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3101 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3102 |
} |
} |
| 3103 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3104 |
if (d < 256) d = md->lcc[d]; |
if (d < 256) d = md->lcc[d]; |
| 3105 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3106 |
} |
} |
| 3107 |
} |
} |
| 3108 |
else |
else |
| 3113 |
{ |
{ |
| 3114 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29); |
| 3115 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3116 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3117 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3118 |
{ |
{ |
| 3119 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3120 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3121 |
} |
} |
| 3122 |
if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc == md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 3123 |
} |
} |
| 3124 |
} |
} |
| 3125 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3139 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 3140 |
{ |
{ |
| 3141 |
int len = 1; |
int len = 1; |
| 3142 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 3143 |
|
{ |
| 3144 |
|
SCHECK_PARTIAL(); |
| 3145 |
|
break; |
| 3146 |
|
} |
| 3147 |
GETCHARLEN(d, eptr, len); |
GETCHARLEN(d, eptr, len); |
| 3148 |
if (d < 256) d = md->lcc[d]; |
if (d < 256) d = md->lcc[d]; |
| 3149 |
if (fc == d) break; |
if (fc == d) break; |
| 3164 |
{ |
{ |
| 3165 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 3166 |
{ |
{ |
| 3167 |
if (eptr >= md->end_subject || fc == md->lcc[*eptr]) break; |
if (eptr >= md->end_subject) |
| 3168 |
|
{ |
| 3169 |
|
SCHECK_PARTIAL(); |
| 3170 |
|
break; |
| 3171 |
|
} |
| 3172 |
|
if (fc == md->lcc[*eptr]) break; |
| 3173 |
eptr++; |
eptr++; |
| 3174 |
} |
} |
| 3175 |
if (possessive) continue; |
if (possessive) continue; |
| 3181 |
} |
} |
| 3182 |
} |
} |
| 3183 |
|
|
| 3184 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3185 |
} |
} |
| 3186 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3187 |
} |
} |
| 3200 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3201 |
{ |
{ |
| 3202 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3203 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3204 |
} |
} |
| 3205 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3206 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3207 |
} |
} |
| 3208 |
} |
} |
| 3209 |
else |
else |
| 3215 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3216 |
{ |
{ |
| 3217 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3218 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3219 |
} |
} |
| 3220 |
if (fc == *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc == *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3221 |
} |
} |
| 3222 |
} |
} |
| 3223 |
|
|
| 3234 |
{ |
{ |
| 3235 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32); |
| 3236 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3237 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3238 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3239 |
{ |
{ |
| 3240 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3241 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3242 |
} |
} |
| 3243 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3244 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3245 |
} |
} |
| 3246 |
} |
} |
| 3247 |
else |
else |
| 3252 |
{ |
{ |
| 3253 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33); |
| 3254 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3255 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3256 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3257 |
{ |
{ |
| 3258 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3259 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3260 |
} |
} |
| 3261 |
if (fc == *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc == *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3262 |
} |
} |
| 3263 |
} |
} |
| 3264 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3278 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 3279 |
{ |
{ |
| 3280 |
int len = 1; |
int len = 1; |
| 3281 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 3282 |
|
{ |
| 3283 |
|
SCHECK_PARTIAL(); |
| 3284 |
|
break; |
| 3285 |
|
} |
| 3286 |
GETCHARLEN(d, eptr, len); |
GETCHARLEN(d, eptr, len); |
| 3287 |
if (fc == d) break; |
if (fc == d) break; |
| 3288 |
eptr += len; |
eptr += len; |
| 3302 |
{ |
{ |
| 3303 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 3304 |
{ |
{ |
| 3305 |
if (eptr >= md->end_subject || fc == *eptr) break; |
if (eptr >= md->end_subject) |
| 3306 |
|
{ |
| 3307 |
|
SCHECK_PARTIAL(); |
| 3308 |
|
break; |
| 3309 |
|
} |
| 3310 |
|
if (fc == *eptr) break; |
| 3311 |
eptr++; |
eptr++; |
| 3312 |
} |
} |
| 3313 |
if (possessive) continue; |
if (possessive) continue; |
| 3319 |
} |
} |
| 3320 |
} |
} |
| 3321 |
|
|
| 3322 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3323 |
} |
} |
| 3324 |
} |
} |
| 3325 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3413 |
switch(prop_type) |
switch(prop_type) |
| 3414 |
{ |
{ |
| 3415 |
case PT_ANY: |
case PT_ANY: |
| 3416 |
if (prop_fail_result) RRETURN(MATCH_NOMATCH); |
if (prop_fail_result) MRRETURN(MATCH_NOMATCH); |
| 3417 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
| 3418 |
{ |
{ |
| 3419 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3420 |
{ |
{ |
| 3421 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3422 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3423 |
} |
} |
| 3424 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3425 |
} |
} |
| 3431 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3432 |
{ |
{ |
| 3433 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3434 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3435 |
} |
} |
| 3436 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3437 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 3438 |
if ((prop_chartype == ucp_Lu || |
if ((prop_chartype == ucp_Lu || |
| 3439 |
prop_chartype == ucp_Ll || |
prop_chartype == ucp_Ll || |
| 3440 |
prop_chartype == ucp_Lt) == prop_fail_result) |
prop_chartype == ucp_Lt) == prop_fail_result) |
| 3441 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3442 |
} |
} |
| 3443 |
break; |
break; |
| 3444 |
|
|
| 3448 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3449 |
{ |
{ |
| 3450 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3451 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3452 |
} |
} |
| 3453 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3454 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 3455 |
if ((prop_category == prop_value) == prop_fail_result) |
if ((prop_category == prop_value) == prop_fail_result) |
| 3456 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3457 |
} |
} |
| 3458 |
break; |
break; |
| 3459 |
|
|
| 3463 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3464 |
{ |
{ |
| 3465 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3466 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3467 |
} |
} |
| 3468 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3469 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 3470 |
if ((prop_chartype == prop_value) == prop_fail_result) |
if ((prop_chartype == prop_value) == prop_fail_result) |
| 3471 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3472 |
} |
} |
| 3473 |
break; |
break; |
| 3474 |
|
|
| 3478 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3479 |
{ |
{ |
| 3480 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3481 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3482 |
} |
} |
| 3483 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3484 |
prop_script = UCD_SCRIPT(c); |
prop_script = UCD_SCRIPT(c); |
| 3485 |
if ((prop_script == prop_value) == prop_fail_result) |
if ((prop_script == prop_value) == prop_fail_result) |
| 3486 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3487 |
} |
} |
| 3488 |
break; |
break; |
| 3489 |
|
|
| 3502 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3503 |
{ |
{ |
| 3504 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3505 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3506 |
} |
} |
| 3507 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3508 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 3509 |
if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH); |
if (prop_category == ucp_M) MRRETURN(MATCH_NOMATCH); |
| 3510 |
while (eptr < md->end_subject) |
while (eptr < md->end_subject) |
| 3511 |
{ |
{ |
| 3512 |
int len = 1; |
int len = 1; |
| 3533 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3534 |
{ |
{ |
| 3535 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3536 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3537 |
} |
} |
| 3538 |
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); |
if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); |
| 3539 |
eptr++; |
eptr++; |
| 3540 |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 3541 |
} |
} |
| 3547 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3548 |
{ |
{ |
| 3549 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3550 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3551 |
} |
} |
| 3552 |
eptr++; |
eptr++; |
| 3553 |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 3555 |
break; |
break; |
| 3556 |
|
|
| 3557 |
case OP_ANYBYTE: |
case OP_ANYBYTE: |
| 3558 |
if (eptr > md->end_subject - min) RRETURN(MATCH_NOMATCH); |
if (eptr > md->end_subject - min) MRRETURN(MATCH_NOMATCH); |
| 3559 |
eptr += min; |
eptr += min; |
| 3560 |
break; |
break; |
| 3561 |
|
|
| 3565 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3566 |
{ |
{ |
| 3567 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3568 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3569 |
} |
} |
| 3570 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3571 |
switch(c) |
switch(c) |
| 3572 |
{ |
{ |
| 3573 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3574 |
case 0x000d: |
case 0x000d: |
| 3575 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 3576 |
break; |
break; |
| 3583 |
case 0x0085: |
case 0x0085: |
| 3584 |
case 0x2028: |
case 0x2028: |
| 3585 |
case 0x2029: |
case 0x2029: |
| 3586 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 3587 |
break; |
break; |
| 3588 |
} |
} |
| 3589 |
} |
} |
| 3595 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3596 |
{ |
{ |
| 3597 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3598 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3599 |
} |
} |
| 3600 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3601 |
switch(c) |
switch(c) |
| 3620 |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 3621 |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 3622 |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 3623 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3624 |
} |
} |
| 3625 |
} |
} |
| 3626 |
break; |
break; |
| 3631 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3632 |
{ |
{ |
| 3633 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3634 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3635 |
} |
} |
| 3636 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3637 |
switch(c) |
switch(c) |
| 3638 |
{ |
{ |
| 3639 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3640 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 3641 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 3642 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 3667 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3668 |
{ |
{ |
| 3669 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3670 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3671 |
} |
} |
| 3672 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3673 |
switch(c) |
switch(c) |
| 3680 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 3681 |
case 0x2028: /* LINE SEPARATOR */ |
case 0x2028: /* LINE SEPARATOR */ |
| 3682 |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 3683 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3684 |
} |
} |
| 3685 |
} |
} |
| 3686 |
break; |
break; |
| 3691 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3692 |
{ |
{ |
| 3693 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3694 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3695 |
} |
} |
| 3696 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3697 |
switch(c) |
switch(c) |
| 3698 |
{ |
{ |
| 3699 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3700 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 3701 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 3702 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 3715 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3716 |
{ |
{ |
| 3717 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3718 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3719 |
} |
} |
| 3720 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3721 |
if (c < 128 && (md->ctypes[c] & ctype_digit) != 0) |
if (c < 128 && (md->ctypes[c] & ctype_digit) != 0) |
| 3722 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3723 |
} |
} |
| 3724 |
break; |
break; |
| 3725 |
|
|
| 3729 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3730 |
{ |
{ |
| 3731 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3732 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3733 |
} |
} |
| 3734 |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_digit) == 0) |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_digit) == 0) |
| 3735 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3736 |
/* No need to skip more bytes - we know it's a 1-byte character */ |
/* No need to skip more bytes - we know it's a 1-byte character */ |
| 3737 |
} |
} |
| 3738 |
break; |
break; |
| 3743 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3744 |
{ |
{ |
| 3745 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3746 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3747 |
} |
} |
| 3748 |
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0) |
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0) |
| 3749 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3750 |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
| 3751 |
} |
} |
| 3752 |
break; |
break; |
| 3757 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3758 |
{ |
{ |
| 3759 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3760 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3761 |
} |
} |
| 3762 |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_space) == 0) |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_space) == 0) |
| 3763 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3764 |
/* No need to skip more bytes - we know it's a 1-byte character */ |
/* No need to skip more bytes - we know it's a 1-byte character */ |
| 3765 |
} |
} |
| 3766 |
break; |
break; |
| 3768 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 3769 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
| 3770 |
{ |
{ |
| 3771 |
if (eptr >= md->end_subject || |
if (eptr >= md->end_subject) |
| 3772 |
(*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0)) |
{ |
| 3773 |
RRETURN(MATCH_NOMATCH); |
SCHECK_PARTIAL(); |
| 3774 |
|
MRRETURN(MATCH_NOMATCH); |
| 3775 |
|
} |
| 3776 |
|
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0) |
| 3777 |
|
MRRETURN(MATCH_NOMATCH); |
| 3778 |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
| 3779 |
} |
} |
| 3780 |
break; |
break; |
| 3785 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3786 |
{ |
{ |
| 3787 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3788 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3789 |
} |
} |
| 3790 |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_word) == 0) |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_word) == 0) |
| 3791 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3792 |
/* No need to skip more bytes - we know it's a 1-byte character */ |
/* No need to skip more bytes - we know it's a 1-byte character */ |
| 3793 |
} |
} |
| 3794 |
break; |
break; |
| 3811 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3812 |
{ |
{ |
| 3813 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3814 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3815 |
} |
} |
| 3816 |
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); |
if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); |
| 3817 |
eptr++; |
eptr++; |
| 3818 |
} |
} |
| 3819 |
break; |
break; |
| 3820 |
|
|
| 3821 |
case OP_ALLANY: |
case OP_ALLANY: |
| 3822 |
if (eptr > md->end_subject - min) |
if (eptr > md->end_subject - min) |
| 3823 |
{ |
{ |
| 3824 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3825 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3826 |
} |
} |
| 3827 |
eptr += min; |
eptr += min; |
| 3828 |
break; |
break; |
| 3829 |
|
|
| 3830 |
case OP_ANYBYTE: |
case OP_ANYBYTE: |
| 3831 |
if (eptr > md->end_subject - min) |
if (eptr > md->end_subject - min) |
| 3832 |
{ |
{ |
| 3833 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3834 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3835 |
} |
} |
| 3836 |
eptr += min; |
eptr += min; |
| 3837 |
break; |
break; |
| 3838 |
|
|
| 3842 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3843 |
{ |
{ |
| 3844 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3845 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3846 |
} |
} |
| 3847 |
switch(*eptr++) |
switch(*eptr++) |
| 3848 |
{ |
{ |
| 3849 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3850 |
case 0x000d: |
case 0x000d: |
| 3851 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 3852 |
break; |
break; |
| 3856 |
case 0x000b: |
case 0x000b: |
| 3857 |
case 0x000c: |
case 0x000c: |
| 3858 |
case 0x0085: |
case 0x0085: |
| 3859 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 3860 |
break; |
break; |
| 3861 |
} |
} |
| 3862 |
} |
} |
| 3868 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3869 |
{ |
{ |
| 3870 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3871 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3872 |
} |
} |
| 3873 |
switch(*eptr++) |
switch(*eptr++) |
| 3874 |
{ |
{ |
| 3876 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 3877 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 3878 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 3879 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3880 |
} |
} |
| 3881 |
} |
} |
| 3882 |
break; |
break; |
| 3887 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3888 |
{ |
{ |
| 3889 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3890 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3891 |
} |
} |
| 3892 |
switch(*eptr++) |
switch(*eptr++) |
| 3893 |
{ |
{ |
| 3894 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3895 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 3896 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 3897 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 3906 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3907 |
{ |
{ |
| 3908 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3909 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3910 |
} |
} |
| 3911 |
switch(*eptr++) |
switch(*eptr++) |
| 3912 |
{ |
{ |
| 3916 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 3917 |
case 0x0d: /* CR */ |
case 0x0d: /* CR */ |
| 3918 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 3919 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3920 |
} |
} |
| 3921 |
} |
} |
| 3922 |
break; |
break; |
| 3927 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3928 |
{ |
{ |
| 3929 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3930 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3931 |
} |
} |
| 3932 |
switch(*eptr++) |
switch(*eptr++) |
| 3933 |
{ |
{ |
| 3934 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3935 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 3936 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 3937 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 3948 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3949 |
{ |
{ |
| 3950 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3951 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3952 |
} |
} |
| 3953 |
if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_digit) != 0) MRRETURN(MATCH_NOMATCH); |
| 3954 |
} |
} |
| 3955 |
break; |
break; |
| 3956 |
|
|
| 3960 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3961 |
{ |
{ |
| 3962 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3963 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3964 |
} |
} |
| 3965 |
if ((md->ctypes[*eptr++] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_digit) == 0) MRRETURN(MATCH_NOMATCH); |
| 3966 |
} |
} |
| 3967 |
break; |
break; |
| 3968 |
|
|
| 3972 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3973 |
{ |
{ |
| 3974 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3975 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3976 |
} |
} |
| 3977 |
if ((md->ctypes[*eptr++] & ctype_space) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_space) != 0) MRRETURN(MATCH_NOMATCH); |
| 3978 |
} |
} |
| 3979 |
break; |
break; |
| 3980 |
|
|
| 3984 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3985 |
{ |
{ |
| 3986 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3987 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3988 |
} |
} |
| 3989 |
if ((md->ctypes[*eptr++] & ctype_space) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_space) == 0) MRRETURN(MATCH_NOMATCH); |
| 3990 |
} |
} |
| 3991 |
break; |
break; |
| 3992 |
|
|
| 3996 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3997 |
{ |
{ |
| 3998 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3999 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4000 |
} |
} |
| 4001 |
if ((md->ctypes[*eptr++] & ctype_word) != 0) |
if ((md->ctypes[*eptr++] & ctype_word) != 0) |
| 4002 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4003 |
} |
} |
| 4004 |
break; |
break; |
| 4005 |
|
|
| 4009 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4010 |
{ |
{ |
| 4011 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4012 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4013 |
} |
} |
| 4014 |
if ((md->ctypes[*eptr++] & ctype_word) == 0) |
if ((md->ctypes[*eptr++] & ctype_word) == 0) |
| 4015 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4016 |
} |
} |
| 4017 |
break; |
break; |
| 4018 |
|
|
| 4041 |
{ |
{ |
| 4042 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36); |
| 4043 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4044 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4045 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4046 |
{ |
{ |
| 4047 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4048 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4049 |
} |
} |
| 4050 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 4051 |
if (prop_fail_result) RRETURN(MATCH_NOMATCH); |
if (prop_fail_result) MRRETURN(MATCH_NOMATCH); |
| 4052 |
} |
} |
| 4053 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4054 |
|
|
| 4057 |
{ |
{ |
| 4058 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37); |
| 4059 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4060 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4061 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4062 |
{ |
{ |
| 4063 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4064 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4065 |
} |
} |
| 4066 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 4067 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4068 |
if ((prop_chartype == ucp_Lu || |
if ((prop_chartype == ucp_Lu || |
| 4069 |
prop_chartype == ucp_Ll || |
prop_chartype == ucp_Ll || |
| 4070 |
prop_chartype == ucp_Lt) == prop_fail_result) |
prop_chartype == ucp_Lt) == prop_fail_result) |
| 4071 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4072 |
} |
} |
| 4073 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4074 |
|
|
| 4077 |
{ |
{ |
| 4078 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38); |
| 4079 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4080 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4081 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4082 |
{ |
{ |
| 4083 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4084 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4085 |
} |
} |
| 4086 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 4087 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4088 |
if ((prop_category == prop_value) == prop_fail_result) |
if ((prop_category == prop_value) == prop_fail_result) |
| 4089 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4090 |
} |
} |
| 4091 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4092 |
|
|
| 4095 |
{ |
{ |
| 4096 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39); |
| 4097 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4098 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4099 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4100 |
{ |
{ |
| 4101 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4102 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4103 |
} |
} |
| 4104 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 4105 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4106 |
if ((prop_chartype == prop_value) == prop_fail_result) |
if ((prop_chartype == prop_value) == prop_fail_result) |
| 4107 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4108 |
} |
} |
| 4109 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4110 |
|
|
| 4113 |
{ |
{ |
| 4114 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40); |
| 4115 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4116 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4117 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4118 |
{ |
{ |
| 4119 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4120 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4121 |
} |
} |
| 4122 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 4123 |
prop_script = UCD_SCRIPT(c); |
prop_script = UCD_SCRIPT(c); |
| 4124 |
if ((prop_script == prop_value) == prop_fail_result) |
if ((prop_script == prop_value) == prop_fail_result) |
| 4125 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4126 |
} |
} |
| 4127 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4128 |
|
|
| 4140 |
{ |
{ |
| 4141 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41); |
| 4142 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4143 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4144 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4145 |
{ |
{ |
| 4146 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4147 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4148 |
} |
} |
| 4149 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4150 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4151 |
if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH); |
if (prop_category == ucp_M) MRRETURN(MATCH_NOMATCH); |
| 4152 |
while (eptr < md->end_subject) |
while (eptr < md->end_subject) |
| 4153 |
{ |
{ |
| 4154 |
int len = 1; |
int len = 1; |
| 4172 |
{ |
{ |
| 4173 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42); |
| 4174 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4175 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4176 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4177 |
{ |
{ |
| 4178 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4179 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4180 |
} |
} |
| 4181 |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
| 4182 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4183 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 4184 |
switch(ctype) |
switch(ctype) |
| 4185 |
{ |
{ |
| 4191 |
case OP_ANYNL: |
case OP_ANYNL: |
| 4192 |
switch(c) |
switch(c) |
| 4193 |
{ |
{ |
| 4194 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4195 |
case 0x000d: |
case 0x000d: |
| 4196 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 4197 |
break; |
break; |
| 4203 |
case 0x0085: |
case 0x0085: |
| 4204 |
case 0x2028: |
case 0x2028: |
| 4205 |
case 0x2029: |
case 0x2029: |
| 4206 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 4207 |
break; |
break; |
| 4208 |
} |
} |
| 4209 |
break; |
break; |
| 4231 |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 4232 |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 4233 |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 4234 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4235 |
} |
} |
| 4236 |
break; |
break; |
| 4237 |
|
|
| 4238 |
case OP_HSPACE: |
case OP_HSPACE: |
| 4239 |
switch(c) |
switch(c) |
| 4240 |
{ |
{ |
| 4241 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4242 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4243 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4244 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4273 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 4274 |
case 0x2028: /* LINE SEPARATOR */ |
case 0x2028: /* LINE SEPARATOR */ |
| 4275 |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 4276 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4277 |
} |
} |
| 4278 |
break; |
break; |
| 4279 |
|
|
| 4280 |
case OP_VSPACE: |
case OP_VSPACE: |
| 4281 |
switch(c) |
switch(c) |
| 4282 |
{ |
{ |
| 4283 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4284 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 4285 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 4286 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4294 |
|
|
| 4295 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 4296 |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) |
| 4297 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4298 |
break; |
break; |
| 4299 |
|
|
| 4300 |
case OP_DIGIT: |
case OP_DIGIT: |
| 4301 |
if (c >= 256 || (md->ctypes[c] & ctype_digit) == 0) |
if (c >= 256 || (md->ctypes[c] & ctype_digit) == 0) |
| 4302 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4303 |
break; |
break; |
| 4304 |
|
|
| 4305 |
case OP_NOT_WHITESPACE: |
case OP_NOT_WHITESPACE: |
| 4306 |
if (c < 256 && (md->ctypes[c] & ctype_space) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_space) != 0) |
| 4307 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4308 |
break; |
break; |
| 4309 |
|
|
| 4310 |
case OP_WHITESPACE: |
case OP_WHITESPACE: |
| 4311 |
if (c >= 256 || (md->ctypes[c] & ctype_space) == 0) |
if (c >= 256 || (md->ctypes[c] & ctype_space) == 0) |
| 4312 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4313 |
break; |
break; |
| 4314 |
|
|
| 4315 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 4316 |
if (c < 256 && (md->ctypes[c] & ctype_word) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_word) != 0) |
| 4317 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4318 |
break; |
break; |
| 4319 |
|
|
| 4320 |
case OP_WORDCHAR: |
case OP_WORDCHAR: |
| 4321 |
if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) |
if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) |
| 4322 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4323 |
break; |
break; |
| 4324 |
|
|
| 4325 |
default: |
default: |
| 4335 |
{ |
{ |
| 4336 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43); |
| 4337 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4338 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4339 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4340 |
{ |
{ |
| 4341 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4342 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4343 |
} |
} |
| 4344 |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
| 4345 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4346 |
c = *eptr++; |
c = *eptr++; |
| 4347 |
switch(ctype) |
switch(ctype) |
| 4348 |
{ |
{ |
| 4354 |
case OP_ANYNL: |
case OP_ANYNL: |
| 4355 |
switch(c) |
switch(c) |
| 4356 |
{ |
{ |
| 4357 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4358 |
case 0x000d: |
case 0x000d: |
| 4359 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 4360 |
break; |
break; |
| 4365 |
case 0x000b: |
case 0x000b: |
| 4366 |
case 0x000c: |
case 0x000c: |
| 4367 |
case 0x0085: |
case 0x0085: |
| 4368 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 4369 |
break; |
break; |
| 4370 |
} |
} |
| 4371 |
break; |
break; |
| 4377 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4378 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4379 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4380 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4381 |
} |
} |
| 4382 |
break; |
break; |
| 4383 |
|
|
| 4384 |
case OP_HSPACE: |
case OP_HSPACE: |
| 4385 |
switch(c) |
switch(c) |
| 4386 |
{ |
{ |
| 4387 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4388 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4389 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4390 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4401 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4402 |
case 0x0d: /* CR */ |
case 0x0d: /* CR */ |
| 4403 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 4404 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4405 |
} |
} |
| 4406 |
break; |
break; |
| 4407 |
|
|
| 4408 |
case OP_VSPACE: |
case OP_VSPACE: |
| 4409 |
switch(c) |
switch(c) |
| 4410 |
{ |
{ |
| 4411 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4412 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 4413 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 4414 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4419 |
break; |
break; |
| 4420 |
|
|
| 4421 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 4422 |
if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_digit) != 0) MRRETURN(MATCH_NOMATCH); |
| 4423 |
break; |
break; |
| 4424 |
|
|
| 4425 |
case OP_DIGIT: |
case OP_DIGIT: |
| 4426 |
if ((md->ctypes[c] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_digit) == 0) MRRETURN(MATCH_NOMATCH); |
| 4427 |
break; |
break; |
| 4428 |
|
|
| 4429 |
case OP_NOT_WHITESPACE: |
case OP_NOT_WHITESPACE: |
| 4430 |
if ((md->ctypes[c] & ctype_space) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_space) != 0) MRRETURN(MATCH_NOMATCH); |
| 4431 |
break; |
break; |
| 4432 |
|
|
| 4433 |
case OP_WHITESPACE: |
case OP_WHITESPACE: |
| 4434 |
if ((md->ctypes[c] & ctype_space) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_space) == 0) MRRETURN(MATCH_NOMATCH); |
| 4435 |
break; |
break; |
| 4436 |
|
|
| 4437 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 4438 |
if ((md->ctypes[c] & ctype_word) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_word) != 0) MRRETURN(MATCH_NOMATCH); |
| 4439 |
break; |
break; |
| 4440 |
|
|
| 4441 |
case OP_WORDCHAR: |
case OP_WORDCHAR: |
| 4442 |
if ((md->ctypes[c] & ctype_word) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_word) == 0) MRRETURN(MATCH_NOMATCH); |
| 4443 |
break; |
break; |
| 4444 |
|
|
| 4445 |
default: |
default: |
| 4467 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4468 |
{ |
{ |
| 4469 |
int len = 1; |
int len = 1; |
| 4470 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4471 |
|
{ |
| 4472 |
|
SCHECK_PARTIAL(); |
| 4473 |
|
break; |
| 4474 |
|
} |
| 4475 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4476 |
if (prop_fail_result) break; |
if (prop_fail_result) break; |
| 4477 |
eptr+= len; |
eptr+= len; |
| 4482 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4483 |
{ |
{ |
| 4484 |
int len = 1; |
int len = 1; |
| 4485 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4486 |
|
{ |
| 4487 |
|
SCHECK_PARTIAL(); |
| 4488 |
|
break; |
| 4489 |
|
} |
| 4490 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4491 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4492 |
if ((prop_chartype == ucp_Lu || |
if ((prop_chartype == ucp_Lu || |
| 4501 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4502 |
{ |
{ |
| 4503 |
int len = 1; |
int len = 1; |
| 4504 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4505 |
|
{ |
| 4506 |
|
SCHECK_PARTIAL(); |
| 4507 |
|
break; |
| 4508 |
|
} |
| 4509 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4510 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4511 |
if ((prop_category == prop_value) == prop_fail_result) |
if ((prop_category == prop_value) == prop_fail_result) |
| 4518 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4519 |
{ |
{ |
| 4520 |
int len = 1; |
int len = 1; |
| 4521 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4522 |
|
{ |
| 4523 |
|
SCHECK_PARTIAL(); |
| 4524 |
|
break; |
| 4525 |
|
} |
| 4526 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4527 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4528 |
if ((prop_chartype == prop_value) == prop_fail_result) |
if ((prop_chartype == prop_value) == prop_fail_result) |
| 4535 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4536 |
{ |
{ |
| 4537 |
int len = 1; |
int len = 1; |
| 4538 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4539 |
|
{ |
| 4540 |
|
SCHECK_PARTIAL(); |
| 4541 |
|
break; |
| 4542 |
|
} |
| 4543 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4544 |
prop_script = UCD_SCRIPT(c); |
prop_script = UCD_SCRIPT(c); |
| 4545 |
if ((prop_script == prop_value) == prop_fail_result) |
if ((prop_script == prop_value) == prop_fail_result) |
| 4568 |
{ |
{ |
| 4569 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4570 |
{ |
{ |
| 4571 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4572 |
|
{ |
| 4573 |
|
SCHECK_PARTIAL(); |
| 4574 |
|
break; |
| 4575 |
|
} |
| 4576 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4577 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4578 |
if (prop_category == ucp_M) break; |
if (prop_category == ucp_M) break; |
| 4592 |
/* eptr is now past the end of the maximum run */ |
/* eptr is now past the end of the maximum run */ |
| 4593 |
|
|
| 4594 |
if (possessive) continue; |
if (possessive) continue; |
| 4595 |
|
|
| 4596 |
for(;;) |
for(;;) |
| 4597 |
{ |
{ |
| 4598 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM45); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM45); |
| 4628 |
{ |
{ |
| 4629 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4630 |
{ |
{ |
| 4631 |
if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break; |
if (eptr >= md->end_subject) |
| 4632 |
|
{ |
| 4633 |
|
SCHECK_PARTIAL(); |
| 4634 |
|
break; |
| 4635 |
|
} |
| 4636 |
|
if (IS_NEWLINE(eptr)) break; |
| 4637 |
eptr++; |
eptr++; |
| 4638 |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 4639 |
} |
} |
| 4645 |
{ |
{ |
| 4646 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4647 |
{ |
{ |
| 4648 |
if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break; |
if (eptr >= md->end_subject) |
| 4649 |
|
{ |
| 4650 |
|
SCHECK_PARTIAL(); |
| 4651 |
|
break; |
| 4652 |
|
} |
| 4653 |
|
if (IS_NEWLINE(eptr)) break; |
| 4654 |
eptr++; |
eptr++; |
| 4655 |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 4656 |
} |
} |
| 4662 |
{ |
{ |
| 4663 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4664 |
{ |
{ |
| 4665 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4666 |
|
{ |
| 4667 |
|
SCHECK_PARTIAL(); |
| 4668 |
|
break; |
| 4669 |
|
} |
| 4670 |
eptr++; |
eptr++; |
| 4671 |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 4672 |
} |
} |
| 4679 |
case OP_ANYBYTE: |
case OP_ANYBYTE: |
| 4680 |
c = max - min; |
c = max - min; |
| 4681 |
if (c > (unsigned int)(md->end_subject - eptr)) |
if (c > (unsigned int)(md->end_subject - eptr)) |
| 4682 |
c = md->end_subject - eptr; |
{ |
| 4683 |
eptr += c; |
eptr = md->end_subject; |
| 4684 |
|
SCHECK_PARTIAL(); |
| 4685 |
|
} |
| 4686 |
|
else eptr += c; |
| 4687 |
break; |
break; |
| 4688 |
|
|
| 4689 |
case OP_ANYNL: |
case OP_ANYNL: |
| 4690 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4691 |
{ |
{ |
| 4692 |
int len = 1; |
int len = 1; |
| 4693 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4694 |
|
{ |
| 4695 |
|
SCHECK_PARTIAL(); |
| 4696 |
|
break; |
| 4697 |
|
} |
| 4698 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4699 |
if (c == 0x000d) |
if (c == 0x000d) |
| 4700 |
{ |
{ |
| 4719 |
{ |
{ |
| 4720 |
BOOL gotspace; |
BOOL gotspace; |
| 4721 |
int len = 1; |
int len = 1; |
| 4722 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4723 |
|
{ |
| 4724 |
|
SCHECK_PARTIAL(); |
| 4725 |
|
break; |
| 4726 |
|
} |
| 4727 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4728 |
switch(c) |
switch(c) |
| 4729 |
{ |
{ |
| 4761 |
{ |
{ |
| 4762 |
BOOL gotspace; |
BOOL gotspace; |
| 4763 |
int len = 1; |
int len = 1; |
| 4764 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4765 |
|
{ |
| 4766 |
|
SCHECK_PARTIAL(); |
| 4767 |
|
break; |
| 4768 |
|
} |
| 4769 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4770 |
switch(c) |
switch(c) |
| 4771 |
{ |
{ |
| 4789 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4790 |
{ |
{ |
| 4791 |
int len = 1; |
int len = 1; |
| 4792 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4793 |
|
{ |
| 4794 |
|
SCHECK_PARTIAL(); |
| 4795 |
|
break; |
| 4796 |
|
} |
| 4797 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4798 |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) break; |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) break; |
| 4799 |
eptr+= len; |
eptr+= len; |
| 4804 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4805 |
{ |
{ |
| 4806 |
int len = 1; |
int len = 1; |
| 4807 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4808 |
|
{ |
| 4809 |
|
SCHECK_PARTIAL(); |
| 4810 |
|
break; |
| 4811 |
|
} |
| 4812 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4813 |
if (c >= 256 ||(md->ctypes[c] & ctype_digit) == 0) break; |
if (c >= 256 ||(md->ctypes[c] & ctype_digit) == 0) break; |
| 4814 |
eptr+= len; |
eptr+= len; |
| 4819 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4820 |
{ |
{ |
| 4821 |
int len = 1; |
int len = 1; |
| 4822 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4823 |
|
{ |
| 4824 |
|
SCHECK_PARTIAL(); |
| 4825 |
|
break; |
| 4826 |
|
} |
| 4827 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4828 |
if (c < 256 && (md->ctypes[c] & ctype_space) != 0) break; |
if (c < 256 && (md->ctypes[c] & ctype_space) != 0) break; |
| 4829 |
eptr+= len; |
eptr+= len; |
| 4834 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4835 |
{ |
{ |
| 4836 |
int len = 1; |
int len = 1; |
| 4837 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4838 |
|
{ |
| 4839 |
|
SCHECK_PARTIAL(); |
| 4840 |
|
break; |
| 4841 |
|
} |
| 4842 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4843 |
if (c >= 256 ||(md->ctypes[c] & ctype_space) == 0) break; |
if (c >= 256 ||(md->ctypes[c] & ctype_space) == 0) break; |
| 4844 |
eptr+= len; |
eptr+= len; |
| 4849 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4850 |
{ |
{ |
| 4851 |
int len = 1; |
int len = 1; |
| 4852 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4853 |
|
{ |
| 4854 |
|
SCHECK_PARTIAL(); |
| 4855 |
|
break; |
| 4856 |
|
} |
| 4857 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4858 |
if (c < 256 && (md->ctypes[c] & ctype_word) != 0) break; |
if (c < 256 && (md->ctypes[c] & ctype_word) != 0) break; |
| 4859 |
eptr+= len; |
eptr+= len; |
| 4864 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4865 |
{ |
{ |
| 4866 |
int len = 1; |
int len = 1; |
| 4867 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4868 |
|
{ |
| 4869 |
|
SCHECK_PARTIAL(); |
| 4870 |
|
break; |
| 4871 |
|
} |
| 4872 |
GETCHARLEN(c, eptr, len); |
GETCHARLEN(c, eptr, len); |
| 4873 |
if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) break; |
if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) break; |
| 4874 |
eptr+= len; |
eptr+= len; |
| 4900 |
case OP_ANY: |
case OP_ANY: |
| 4901 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4902 |
{ |
{ |
| 4903 |
if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break; |
if (eptr >= md->end_subject) |
| 4904 |
|
{ |
| 4905 |
|
SCHECK_PARTIAL(); |
| 4906 |
|
break; |
| 4907 |
|
} |
| 4908 |
|
if (IS_NEWLINE(eptr)) break; |
| 4909 |
eptr++; |
eptr++; |
| 4910 |
} |
} |
| 4911 |
break; |
break; |
| 4914 |
case OP_ANYBYTE: |
case OP_ANYBYTE: |
| 4915 |
c = max - min; |
c = max - min; |
| 4916 |
if (c > (unsigned int)(md->end_subject - eptr)) |
if (c > (unsigned int)(md->end_subject - eptr)) |
| 4917 |
c = md->end_subject - eptr; |
{ |
| 4918 |
eptr += c; |
eptr = md->end_subject; |
| 4919 |
|
SCHECK_PARTIAL(); |
| 4920 |
|
} |
| 4921 |
|
else eptr += c; |
| 4922 |
break; |
break; |
| 4923 |
|
|
| 4924 |
case OP_ANYNL: |
case OP_ANYNL: |
| 4925 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4926 |
{ |
{ |
| 4927 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4928 |
|
{ |
| 4929 |
|
SCHECK_PARTIAL(); |
| 4930 |
|
break; |
| 4931 |
|
} |
| 4932 |
c = *eptr; |
c = *eptr; |
| 4933 |
if (c == 0x000d) |
if (c == 0x000d) |
| 4934 |
{ |
{ |
| 4949 |
case OP_NOT_HSPACE: |
case OP_NOT_HSPACE: |
| 4950 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4951 |
{ |
{ |
| 4952 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4953 |
|
{ |
| 4954 |
|
SCHECK_PARTIAL(); |
| 4955 |
|
break; |
| 4956 |
|
} |
| 4957 |
c = *eptr; |
c = *eptr; |
| 4958 |
if (c == 0x09 || c == 0x20 || c == 0xa0) break; |
if (c == 0x09 || c == 0x20 || c == 0xa0) break; |
| 4959 |
eptr++; |
eptr++; |
| 4963 |
case OP_HSPACE: |
case OP_HSPACE: |
| 4964 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4965 |
{ |
{ |
| 4966 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4967 |
|
{ |
| 4968 |
|
SCHECK_PARTIAL(); |
| 4969 |
|
break; |
| 4970 |
|
} |
| 4971 |
c = *eptr; |
c = *eptr; |
| 4972 |
if (c != 0x09 && c != 0x20 && c != 0xa0) break; |
if (c != 0x09 && c != 0x20 && c != 0xa0) break; |
| 4973 |
eptr++; |
eptr++; |
| 4977 |
case OP_NOT_VSPACE: |
case OP_NOT_VSPACE: |
| 4978 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4979 |
{ |
{ |
| 4980 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4981 |
|
{ |
| 4982 |
|
SCHECK_PARTIAL(); |
| 4983 |
|
break; |
| 4984 |
|
} |
| 4985 |
c = *eptr; |
c = *eptr; |
| 4986 |
if (c == 0x0a || c == 0x0b || c == 0x0c || c == 0x0d || c == 0x85) |
if (c == 0x0a || c == 0x0b || c == 0x0c || c == 0x0d || c == 0x85) |
| 4987 |
break; |
break; |
| 4992 |
case OP_VSPACE: |
case OP_VSPACE: |
| 4993 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4994 |
{ |
{ |
| 4995 |
if (eptr >= md->end_subject) break; |
if (eptr >= md->end_subject) |
| 4996 |
|
{ |
| 4997 |
|
SCHECK_PARTIAL(); |
| 4998 |
|
break; |
| 4999 |
|
} |
| 5000 |
c = *eptr; |
c = *eptr; |
| 5001 |
if (c != 0x0a && c != 0x0b && c != 0x0c && c != 0x0d && c != 0x85) |
if (c != 0x0a && c != 0x0b && c != 0x0c && c != 0x0d && c != 0x85) |
| 5002 |
break; |
break; |
| 5007 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 5008 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 5009 |
{ |
{ |
| 5010 |
if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) != 0) |
if (eptr >= md->end_subject) |
| 5011 |
|
{ |
| 5012 |
|
SCHECK_PARTIAL(); |
| 5013 |
break; |
break; |
| 5014 |
|
} |
| 5015 |
|
if ((md->ctypes[*eptr] & ctype_digit) != 0) break; |
| 5016 |
eptr++; |
eptr++; |
| 5017 |
} |
} |
| 5018 |
break; |
break; |
| 5020 |
case OP_DIGIT: |
case OP_DIGIT: |
| 5021 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 5022 |
{ |
{ |
| 5023 |
if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) == 0) |
if (eptr >= md->end_subject) |
| 5024 |
|
{ |
| 5025 |
|
SCHECK_PARTIAL(); |
| 5026 |
break; |
break; |
| 5027 |
|
} |
| 5028 |
|
if ((md->ctypes[*eptr] & ctype_digit) == 0) break; |
| 5029 |
eptr++; |
eptr++; |
| 5030 |
} |
} |
| 5031 |
break; |
break; |
| 5033 |
case OP_NOT_WHITESPACE: |
case OP_NOT_WHITESPACE: |
| 5034 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 5035 |
{ |
{ |
| 5036 |
if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) != 0) |
if (eptr >= md->end_subject) |
| 5037 |
|
{ |
| 5038 |
|
SCHECK_PARTIAL(); |
| 5039 |
break; |
break; |
| 5040 |
|
} |
| 5041 |
|
if ((md->ctypes[*eptr] & ctype_space) != 0) break; |
| 5042 |
eptr++; |
eptr++; |
| 5043 |
} |
} |
| 5044 |
break; |
break; |
| 5046 |
case OP_WHITESPACE: |
case OP_WHITESPACE: |
| 5047 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 5048 |
{ |
{ |
| 5049 |
if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) == 0) |
if (eptr >= md->end_subject) |
| 5050 |
|
{ |
| 5051 |
|
SCHECK_PARTIAL(); |
| 5052 |
break; |
break; |
| 5053 |
|
} |
| 5054 |
|
if ((md->ctypes[*eptr] & ctype_space) == 0) break; |
| 5055 |
eptr++; |
eptr++; |
| 5056 |
} |
} |
| 5057 |
break; |
break; |
| 5059 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 5060 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 5061 |
{ |
{ |
| 5062 |
if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) != 0) |
if (eptr >= md->end_subject) |
| 5063 |
|
{ |
| 5064 |
|
SCHECK_PARTIAL(); |
| 5065 |
break; |
break; |
| 5066 |
|
} |
| 5067 |
|
if ((md->ctypes[*eptr] & ctype_word) != 0) break; |
| 5068 |
eptr++; |
eptr++; |
| 5069 |
} |
} |
| 5070 |
break; |
break; |
| 5072 |
case OP_WORDCHAR: |
case OP_WORDCHAR: |
| 5073 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 5074 |
{ |
{ |
| 5075 |
if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) == 0) |
if (eptr >= md->end_subject) |
| 5076 |
|
{ |
| 5077 |
|
SCHECK_PARTIAL(); |
| 5078 |
break; |
break; |
| 5079 |
|
} |
| 5080 |
|
if ((md->ctypes[*eptr] & ctype_word) == 0) break; |
| 5081 |
eptr++; |
eptr++; |
| 5082 |
} |
} |
| 5083 |
break; |
break; |
| 5099 |
|
|
| 5100 |
/* Get here if we can't make it match with any permitted repetitions */ |
/* Get here if we can't make it match with any permitted repetitions */ |
| 5101 |
|
|
| 5102 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 5103 |
} |
} |
| 5104 |
/* Control never gets here */ |
/* Control never gets here */ |
| 5105 |
|
|
| 5272 |
(offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL; |
(offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL; |
| 5273 |
if (offsetcount < 0) return PCRE_ERROR_BADCOUNT; |
if (offsetcount < 0) return PCRE_ERROR_BADCOUNT; |
| 5274 |
|
|
| 5275 |
|
/* This information is for finding all the numbers associated with a given |
| 5276 |
|
name, for condition testing. */ |
| 5277 |
|
|
| 5278 |
|
md->name_table = (uschar *)re + re->name_table_offset; |
| 5279 |
|
md->name_count = re->name_count; |
| 5280 |
|
md->name_entry_size = re->name_entry_size; |
| 5281 |
|
|
| 5282 |
/* Fish out the optional data from the extra_data structure, first setting |
/* Fish out the optional data from the extra_data structure, first setting |
| 5283 |
the default values. */ |
the default values. */ |
| 5284 |
|
|
| 5346 |
md->notbol = (options & PCRE_NOTBOL) != 0; |
md->notbol = (options & PCRE_NOTBOL) != 0; |
| 5347 |
md->noteol = (options & PCRE_NOTEOL) != 0; |
md->noteol = (options & PCRE_NOTEOL) != 0; |
| 5348 |
md->notempty = (options & PCRE_NOTEMPTY) != 0; |
md->notempty = (options & PCRE_NOTEMPTY) != 0; |
| 5349 |
|
md->notempty_atstart = (options & PCRE_NOTEMPTY_ATSTART) != 0; |
| 5350 |
md->partial = ((options & PCRE_PARTIAL_HARD) != 0)? 2 : |
md->partial = ((options & PCRE_PARTIAL_HARD) != 0)? 2 : |
| 5351 |
((options & PCRE_PARTIAL_SOFT) != 0)? 1 : 0; |
((options & PCRE_PARTIAL_SOFT) != 0)? 1 : 0; |
| 5352 |
md->hitend = FALSE; |
md->hitend = FALSE; |
| 5353 |
|
md->mark = NULL; /* In case never set */ |
| 5354 |
|
|
| 5355 |
md->recursive = NULL; /* No recursion at top level */ |
md->recursive = NULL; /* No recursion at top level */ |
| 5356 |
|
|
| 5512 |
} |
} |
| 5513 |
else |
else |
| 5514 |
if (!startline && study != NULL && |
if (!startline && study != NULL && |
| 5515 |
(study->options & PCRE_STUDY_MAPPED) != 0) |
(study->flags & PCRE_STUDY_MAPPED) != 0) |
| 5516 |
start_bits = study->start_bits; |
start_bits = study->start_bits; |
| 5517 |
} |
} |
| 5518 |
|
|
| 5639 |
|
|
| 5640 |
end_subject = save_end_subject; |
end_subject = save_end_subject; |
| 5641 |
|
|
| 5642 |
#ifdef DEBUG /* Sigh. Some compilers never learn. */ |
/* The following two optimizations are disabled for partial matching or if |
|
printf(">>>> Match against: "); |
|
|
pchars(start_match, end_subject - start_match, TRUE, md); |
|
|
printf("\n"); |
|
|
#endif |
|
|
|
|
|
/* If req_byte is set, we know that that character must appear in the |
|
|
subject for the match to succeed. If the first character is set, req_byte |
|
|
must be later in the subject; otherwise the test starts at the match point. |
|
|
This optimization can save a huge amount of backtracking in patterns with |
|
|
nested unlimited repeats that aren't going to match. Writing separate code |
|
|
for cased/caseless versions makes it go faster, as does using an |
|
|
autoincrement and backing off on a match. |
|
|
|
|
|
HOWEVER: when the subject string is very, very long, searching to its end |
|
|
can take a long time, and give bad performance on quite ordinary patterns. |
|
|
This showed up when somebody was matching something like /^\d+C/ on a |
|
|
32-megabyte string... so we don't do this when the string is sufficiently |
|
|
long. |
|
|
|
|
|
ALSO: this processing is disabled when partial matching is requested, or if |
|
| 5643 |
disabling is explicitly requested. */ |
disabling is explicitly requested. */ |
| 5644 |
|
|
| 5645 |
if ((options & PCRE_NO_START_OPTIMIZE) == 0 && |
if ((options & PCRE_NO_START_OPTIMIZE) == 0 && !md->partial) |
|
req_byte >= 0 && |
|
|
end_subject - start_match < REQ_BYTE_MAX && |
|
|
!md->partial) |
|
| 5646 |
{ |
{ |
| 5647 |
register USPTR p = start_match + ((first_byte >= 0)? 1 : 0); |
/* If the pattern was studied, a minimum subject length may be set. This is |
| 5648 |
|
a lower bound; no actual string of that length may actually match the |
| 5649 |
|
pattern. Although the value is, strictly, in characters, we treat it as |
| 5650 |
|
bytes to avoid spending too much time in this optimization. */ |
| 5651 |
|
|
| 5652 |
|
if (study != NULL && (study->flags & PCRE_STUDY_MINLEN) != 0 && |
| 5653 |
|
(pcre_uint32)(end_subject - start_match) < study->minlength) |
| 5654 |
|
{ |
| 5655 |
|
rc = MATCH_NOMATCH; |
| 5656 |
|
break; |
| 5657 |
|
} |
| 5658 |
|
|
| 5659 |
|
/* If req_byte is set, we know that that character must appear in the |
| 5660 |
|
subject for the match to succeed. If the first character is set, req_byte |
| 5661 |
|
must be later in the subject; otherwise the test starts at the match point. |
| 5662 |
|
This optimization can save a huge amount of backtracking in patterns with |
| 5663 |
|
nested unlimited repeats that aren't going to match. Writing separate code |
| 5664 |
|
for cased/caseless versions makes it go faster, as does using an |
| 5665 |
|
autoincrement and backing off on a match. |
| 5666 |
|
|
| 5667 |
/* We don't need to repeat the search if we haven't yet reached the |
HOWEVER: when the subject string is very, very long, searching to its end |
| 5668 |
place we found it at last time. */ |
can take a long time, and give bad performance on quite ordinary patterns. |
| 5669 |
|
This showed up when somebody was matching something like /^\d+C/ on a |
| 5670 |
|
32-megabyte string... so we don't do this when the string is sufficiently |
| 5671 |
|
long. */ |
| 5672 |
|
|
| 5673 |
if (p > req_byte_ptr) |
if (req_byte >= 0 && end_subject - start_match < REQ_BYTE_MAX) |
| 5674 |
{ |
{ |
| 5675 |
if (req_byte_caseless) |
register USPTR p = start_match + ((first_byte >= 0)? 1 : 0); |
| 5676 |
|
|
| 5677 |
|
/* We don't need to repeat the search if we haven't yet reached the |
| 5678 |
|
place we found it at last time. */ |
| 5679 |
|
|
| 5680 |
|
if (p > req_byte_ptr) |
| 5681 |
{ |
{ |
| 5682 |
while (p < end_subject) |
if (req_byte_caseless) |
| 5683 |
{ |
{ |
| 5684 |
register int pp = *p++; |
while (p < end_subject) |
| 5685 |
if (pp == req_byte || pp == req_byte2) { p--; break; } |
{ |
| 5686 |
|
register int pp = *p++; |
| 5687 |
|
if (pp == req_byte || pp == req_byte2) { p--; break; } |
| 5688 |
|
} |
| 5689 |
} |
} |
| 5690 |
} |
else |
|
else |
|
|
{ |
|
|
while (p < end_subject) |
|
| 5691 |
{ |
{ |
| 5692 |
if (*p++ == req_byte) { p--; break; } |
while (p < end_subject) |
| 5693 |
|
{ |
| 5694 |
|
if (*p++ == req_byte) { p--; break; } |
| 5695 |
|
} |
| 5696 |
} |
} |
|
} |
|
| 5697 |
|
|
| 5698 |
/* If we can't find the required character, break the matching loop, |
/* If we can't find the required character, break the matching loop, |
| 5699 |
forcing a match failure. */ |
forcing a match failure. */ |
| 5700 |
|
|
| 5701 |
if (p >= end_subject) |
if (p >= end_subject) |
| 5702 |
{ |
{ |
| 5703 |
rc = MATCH_NOMATCH; |
rc = MATCH_NOMATCH; |
| 5704 |
break; |
break; |
| 5705 |
} |
} |
| 5706 |
|
|
| 5707 |
/* If we have found the required character, save the point where we |
/* If we have found the required character, save the point where we |
| 5708 |
found it, so that we don't search again next time round the loop if |
found it, so that we don't search again next time round the loop if |
| 5709 |
the start hasn't passed this character yet. */ |
the start hasn't passed this character yet. */ |
| 5710 |
|
|
| 5711 |
req_byte_ptr = p; |
req_byte_ptr = p; |
| 5712 |
|
} |
| 5713 |
} |
} |
| 5714 |
} |
} |
| 5715 |
|
|
| 5716 |
|
#ifdef PCRE_DEBUG /* Sigh. Some compilers never learn. */ |
| 5717 |
|
printf(">>>> Match against: "); |
| 5718 |
|
pchars(start_match, end_subject - start_match, TRUE, md); |
| 5719 |
|
printf("\n"); |
| 5720 |
|
#endif |
| 5721 |
|
|
| 5722 |
/* OK, we can now run the match. If "hitend" is set afterwards, remember the |
/* OK, we can now run the match. If "hitend" is set afterwards, remember the |
| 5723 |
first starting point for which a partial match was found. */ |
first starting point for which a partial match was found. */ |
| 5724 |
|
|
| 5725 |
md->start_match_ptr = start_match; |
md->start_match_ptr = start_match; |
| 5726 |
md->start_used_ptr = start_match; |
md->start_used_ptr = start_match; |
| 5727 |
md->match_call_count = 0; |
md->match_call_count = 0; |
| 5728 |
rc = match(start_match, md->start_code, start_match, 2, md, ims, NULL, 0, 0); |
rc = match(start_match, md->start_code, start_match, NULL, 2, md, ims, NULL, |
| 5729 |
|
0, 0); |
| 5730 |
if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr; |
if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr; |
| 5731 |
|
|
| 5732 |
switch(rc) |
switch(rc) |
| 5733 |
{ |
{ |
| 5734 |
/* NOMATCH and PRUNE advance by one character. THEN at this level acts |
/* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches |
| 5735 |
exactly like PRUNE. */ |
this level it means that a MARK that matched the SKIP's arg was not found. |
| 5736 |
|
We treat this as NOMATCH. THEN at this level acts exactly like PRUNE. */ |
| 5737 |
|
|
| 5738 |
case MATCH_NOMATCH: |
case MATCH_NOMATCH: |
| 5739 |
case MATCH_PRUNE: |
case MATCH_PRUNE: |
| 5740 |
|
case MATCH_SKIP_ARG: |
| 5741 |
case MATCH_THEN: |
case MATCH_THEN: |
| 5742 |
new_start_match = start_match + 1; |
new_start_match = start_match + 1; |
| 5743 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 5759 |
rc = MATCH_NOMATCH; |
rc = MATCH_NOMATCH; |
| 5760 |
goto ENDLOOP; |
goto ENDLOOP; |
| 5761 |
|
|
| 5762 |
/* Any other return is some kind of error. */ |
/* Any other return is either a match, or some kind of error. */ |
| 5763 |
|
|
| 5764 |
default: |
default: |
| 5765 |
goto ENDLOOP; |
goto ENDLOOP; |
| 5798 |
md->nllen == 2)) |
md->nllen == 2)) |
| 5799 |
start_match++; |
start_match++; |
| 5800 |
|
|
| 5801 |
} /* End of for(;;) "bumpalong" loop */ |
md->mark = NULL; /* Reset for start of next match attempt */ |
| 5802 |
|
} /* End of for(;;) "bumpalong" loop */ |
| 5803 |
|
|
| 5804 |
/* ==========================================================================*/ |
/* ==========================================================================*/ |
| 5805 |
|
|
| 5854 |
} |
} |
| 5855 |
|
|
| 5856 |
DPRINTF((">>>> returning %d\n", rc)); |
DPRINTF((">>>> returning %d\n", rc)); |
| 5857 |
return rc; |
goto RETURN_MARK; |
| 5858 |
} |
} |
| 5859 |
|
|
| 5860 |
/* Control gets here if there has been an error, or if the overall match |
/* Control gets here if there has been an error, or if the overall match |
| 5865 |
DPRINTF(("Freeing temporary memory\n")); |
DPRINTF(("Freeing temporary memory\n")); |
| 5866 |
(pcre_free)(md->offset_vector); |
(pcre_free)(md->offset_vector); |
| 5867 |
} |
} |
| 5868 |
|
|
| 5869 |
|
/* For anything other than nomatch or partial match, just return the code. */ |
| 5870 |
|
|
| 5871 |
if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL) |
if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL) |
| 5872 |
{ |
{ |
| 5873 |
DPRINTF((">>>> error: returning %d\n", rc)); |
DPRINTF((">>>> error: returning %d\n", rc)); |
| 5874 |
return rc; |
return rc; |
| 5875 |
} |
} |
| 5876 |
else if (start_partial != NULL) |
|
| 5877 |
|
/* Handle partial matches - disable any mark data */ |
| 5878 |
|
|
| 5879 |
|
if (start_partial != NULL) |
| 5880 |
{ |
{ |
| 5881 |
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n")); |
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n")); |
| 5882 |
|
md->mark = NULL; |
| 5883 |
if (offsetcount > 1) |
if (offsetcount > 1) |
| 5884 |
{ |
{ |
| 5885 |
offsets[0] = start_partial - (USPTR)subject; |
offsets[0] = start_partial - (USPTR)subject; |
| 5886 |
offsets[1] = end_subject - (USPTR)subject; |
offsets[1] = end_subject - (USPTR)subject; |
| 5887 |
} |
} |
| 5888 |
return PCRE_ERROR_PARTIAL; |
rc = PCRE_ERROR_PARTIAL; |
| 5889 |
} |
} |
| 5890 |
|
|
| 5891 |
|
/* This is the classic nomatch case */ |
| 5892 |
|
|
| 5893 |
else |
else |
| 5894 |
{ |
{ |
| 5895 |
DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n")); |
DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n")); |
| 5896 |
return PCRE_ERROR_NOMATCH; |
rc = PCRE_ERROR_NOMATCH; |
| 5897 |
} |
} |
| 5898 |
|
|
| 5899 |
|
/* Return the MARK data if it has been requested. */ |
| 5900 |
|
|
| 5901 |
|
RETURN_MARK: |
| 5902 |
|
|
| 5903 |
|
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0) |
| 5904 |
|
*(extra_data->mark) = (unsigned char *)(md->mark); |
| 5905 |
|
return rc; |
| 5906 |
} |
} |
| 5907 |
|
|
| 5908 |
/* End of pcre_exec.c */ |
/* End of pcre_exec.c */ |