54#ifdef DEBUG_FRAMES_DISPLAY
66#define PSSTART start_subject
67#define PSEND end_subject
69#define RECURSE_UNSET 0xffffffffu
73#define PUBLIC_MATCH_OPTIONS \
74 (PCRE2_ANCHORED|PCRE2_ENDANCHORED|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY| \
75 PCRE2_NOTEMPTY_ATSTART|PCRE2_NO_UTF_CHECK|PCRE2_PARTIAL_HARD| \
76 PCRE2_PARTIAL_SOFT|PCRE2_NO_JIT|PCRE2_COPY_MATCHED_SUBJECT| \
77 PCRE2_DISABLE_RECURSELOOP_CHECK)
79#define PUBLIC_JIT_MATCH_OPTIONS \
80 (PCRE2_NO_UTF_CHECK|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY|\
81 PCRE2_NOTEMPTY_ATSTART|PCRE2_PARTIAL_SOFT|PCRE2_PARTIAL_HARD|\
82 PCRE2_COPY_MATCHED_SUBJECT)
88#define MATCH_NOMATCH 0
93#define MATCH_ACCEPT (-999)
94#define MATCH_KETRPOS (-998)
97#define MATCH_COMMIT (-997)
98#define MATCH_PRUNE (-996)
99#define MATCH_SKIP (-995)
100#define MATCH_SKIP_ARG (-994)
101#define MATCH_THEN (-993)
102#define MATCH_BACKTRACK_MAX MATCH_THEN
103#define MATCH_BACKTRACK_MIN MATCH_COMMIT
111#define GF_CAPTURE 0x00010000u
112#define GF_NOCAPTURE 0x00020000u
113#define GF_CONDASSERT 0x00030000u
114#define GF_RECURSE 0x00040000u
118#define GF_IDMASK(a) ((a) & 0xffff0000u)
119#define GF_DATAMASK(a) ((a) & 0x0000ffffu)
128static const uint32_t rep_min[] = {
135static const uint32_t rep_max[] = {
144static const uint32_t rep_typ[] = {
155enum {
RM1=1,
RM2,
RM3,
RM4,
RM5,
RM6,
RM7,
RM8,
RM9,
RM10,
156 RM11,
RM12,
RM13,
RM14,
RM15,
RM16,
RM17,
RM18,
RM19,
RM20,
157 RM21,
RM22,
RM23,
RM24,
RM25,
RM26,
RM27,
RM28,
RM29,
RM30,
160#ifdef SUPPORT_WIDE_CHARS
161enum { RM100=100, RM101 };
164#ifdef SUPPORT_UNICODE
165enum { RM200=200, RM201, RM202, RM203, RM204, RM205, RM206, RM207,
166 RM208, RM209, RM210, RM211, RM212, RM213, RM214, RM215,
167 RM216, RM217, RM218, RM219, RM220, RM221, RM222, RM223,
178#define Fback_frame F->back_frame
179#define Fcapture_last F->capture_last
180#define Fcurrent_recurse F->current_recurse
181#define Fecode F->ecode
183#define Fgroup_frame_type F->group_frame_type
184#define Flast_group_offset F->last_group_offset
185#define Flength F->length
187#define Frdepth F->rdepth
188#define Fstart_match F->start_match
189#define Foffset_top F->offset_top
192#define Fovector F->ovector
193#define Freturn_id F->return_id
196#ifdef DEBUG_FRAMES_DISPLAY
232 ((
char *)
P - (
char *)(match_data->heapframes))/frame_size);
235for (i = 0, Q = match_data->heapframes;
237 i++, Q = (
heapframe *)((
char *)Q + frame_size))
239 fprintf(f,
"Frame %d type=%x subj=%lu code=%d back=%lu id=%d",
244 fprintf(f,
" lgoffset=unset\n");
304cb->offset_vector = callout_ovector;
313 cb->callout_string_offset = 0;
314 cb->callout_string =
NULL;
315 cb->callout_string_length = 0;
319 cb->callout_number = 0;
322 cb->callout_string_length =
326save0 = callout_ovector[0];
327save1 = callout_ovector[1];
328callout_ovector[0] = callout_ovector[1] =
PCRE2_UNSET;
330callout_ovector[0] = save0;
331callout_ovector[1] = save1;
332cb->callout_flags = 0;
384eptr = eptr_start =
Feptr;
390#if defined SUPPORT_UNICODE
424 if (c != d && c != (uint32_t)((
int)d + ur->
other_case))
426 const uint32_t *pp =
PRIV(ucd_caseless_sets) + ur->
caseset;
429 if (c < *pp)
return -1;
430 if (c == *pp++)
break;
440 for (; length > 0; length--)
462 for (; length > 0; length--)
474 if (memcmp(
p, eptr,
CU2BYTES(length)) != 0)
return -1;
479*lengthptr = eptr - eptr_start;
531#define CHECK_PARTIAL()\
532 if (Feptr >= mb->end_subject) \
537#define SCHECK_PARTIAL()\
538 if (mb->partial != 0 && \
539 (Feptr > mb->start_used_ptr || mb->allowemptypartial)) \
542 if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; \
550#define RMATCH(ra,rb)\
616#ifdef SUPPORT_UNICODE
624uint32_t group_frame_type;
632#ifdef SUPPORT_UNICODE
646F = match_data->heapframes;
647frames_top = (
heapframe *)((
char *)
F + match_data->heapframes_size);
668if ((
heapframe *)((
char *)
N + frame_size) >= frames_top)
672 PCRE2_SIZE usedsize = (
char *)
N - (
char *)(match_data->heapframes);
681 newsize = match_data->heapframes_size * 2;
685 PCRE2_SIZE old_size = match_data->heapframes_size / 1024;
691 int over_bytes = match_data->heapframes_size % 1024;
692 if (over_bytes) max_delta -= (1024 - over_bytes);
693 newsize = match_data->heapframes_size + max_delta;
701 new = match_data->memctl.malloc(newsize, match_data->memctl.memory_data);
703 memcpy(
new, match_data->heapframes, usedsize);
708 match_data->memctl.free(match_data->heapframes, match_data->memctl.memory_data);
709 match_data->heapframes =
new;
710 match_data->heapframes_size = newsize;
711 frames_top = (
heapframe *)((
char *)
new + newsize);
714#ifdef DEBUG_SHOW_RMATCH
716if (group_frame_type != 0)
718 fprintf(stderr,
" type=%x ", group_frame_type);
738 fprintf(stderr,
"*** unknown ***");
767if (group_frame_type != 0)
772 group_frame_type = 0;
786fprintf(stderr,
"\n++ New frame: type=0x%x subject offset %ld\n",
819 if (
N->group_frame_type == (
GF_CAPTURE | number))
break;
822 offset = (number << 1) - 2;
839 assert_accept_frame =
F;
850 fprintf(stderr,
"++ Accept within recursion\n");
892 fprintf(stderr,
"++ Backtrack because empty string\n");
908 fprintf(stderr,
"++ Backtrack because not at end (endanchored set)\n");
914 fprintf(stderr,
"++ Failed ACCEPT not at end (endanchnored set)\n");
936 i = 2 * ((top_bracket + 1 > match_data->oveccount)?
937 match_data->oveccount : top_bracket + 1);
969#ifdef SUPPORT_UNICODE
996#ifdef SUPPORT_UNICODE
1041#ifdef SUPPORT_UNICODE
1118#ifdef SUPPORT_UNICODE
1180#define Loclength F->temp_size
1181#define Lstart_eptr F->temp_sptr[0]
1182#define Lcharptr F->temp_sptr[1]
1183#define Lmin F->temp_32[0]
1184#define Lmax F->temp_32[1]
1185#define Lc F->temp_32[2]
1186#define Loc F->temp_32[3]
1257 reptype = rep_typ[fc];
1277#ifdef SUPPORT_UNICODE
1296 for (i = 1; i <=
Lmin; i++)
1387#if PCRE2_CODE_UNIT_WIDTH == 8
1388#ifdef SUPPORT_UNICODE
1395#ifdef SUPPORT_UNICODE
1402 for (i = 1; i <=
Lmin; i++)
1448 if (
Lc != cc &&
Loc != cc)
break;
1465 for (i = 1; i <=
Lmin; i++)
1536#define Lstart_eptr F->temp_sptr[0]
1537#define Lmin F->temp_32[0]
1538#define Lmax F->temp_32[1]
1539#define Lc F->temp_32[2]
1540#define Loc F->temp_32[3]
1611 reptype = rep_typ[fc];
1628#ifdef SUPPORT_UNICODE
1629 if ((utf || ucp) &&
Lc > 127)
1636#ifdef SUPPORT_UNICODE
1640 for (i = 1; i <=
Lmin; i++)
1656 for (i = 1; i <=
Lmin; i++)
1672#ifdef SUPPORT_UNICODE
1718#ifdef SUPPORT_UNICODE
1731 if (
Lc == d ||
Loc == d)
break;
1778#ifdef SUPPORT_UNICODE
1782 for (i = 1; i <=
Lmin; i++)
1797 for (i = 1; i <=
Lmin; i++)
1812#ifdef SUPPORT_UNICODE
1856#ifdef SUPPORT_UNICODE
1927#define Lmin F->temp_32[0]
1928#define Lmax F->temp_32[1]
1929#define Lstart_eptr F->temp_sptr[0]
1930#define Lbyte_map_address F->temp_sptr[1]
1931#define Lbyte_map ((unsigned char *)Lbyte_map_address)
1956 reptype = rep_typ[fc];
1976#ifdef SUPPORT_UNICODE
1979 for (i = 1; i <=
Lmin; i++)
1999 for (i = 1; i <=
Lmin; i++)
2007#if PCRE2_CODE_UNIT_WIDTH != 8
2027#ifdef SUPPORT_UNICODE
2064#if PCRE2_CODE_UNIT_WIDTH != 8
2083#ifdef SUPPORT_UNICODE
2100 if ((
Lbyte_map[fc/8] & (1u << (fc&7))) == 0)
break;
2130#if PCRE2_CODE_UNIT_WIDTH != 8
2137 if ((
Lbyte_map[fc/8] & (1u << (fc&7))) == 0)
break;
2156#undef Lbyte_map_address
2169#define Lstart_eptr F->temp_sptr[0]
2170#define Lxclass_data F->temp_sptr[1]
2171#define Lmin F->temp_32[0]
2172#define Lmax F->temp_32[1]
2174#ifdef SUPPORT_WIDE_CHARS
2194 reptype = rep_typ[fc];
2214 for (i = 1; i <=
Lmin; i++)
2263#ifdef SUPPORT_UNICODE
2283#ifdef SUPPORT_UNICODE
2284 if (utf) BACKCHAR(
Feptr);
2473#ifdef SUPPORT_UNICODE
2501 if ((chartype ==
ucp_Lu ||
2503 chartype ==
ucp_Lt) == notmatch)
2534 if ((
PRIV(ucp_gentype)[chartype] ==
ucp_L ||
2535 PRIV(ucp_gentype)[chartype] ==
ucp_N) == notmatch)
2561 if ((
PRIV(ucp_gentype)[chartype] ==
ucp_L ||
2564 chartype ==
ucp_Pc) == notmatch)
2569#if PCRE2_CODE_UNIT_WIDTH == 32
2572 if (notmatch)
break;;
2589 fc >= 0xe000) == notmatch)
2645#define Lstart_eptr F->temp_sptr[0]
2646#define Lmin F->temp_32[0]
2647#define Lmax F->temp_32[1]
2648#define Lctype F->temp_32[2]
2649#define Lpropvalue F->temp_32[3]
2701 reptype = rep_typ[fc];
2708#ifdef SUPPORT_UNICODE
2725#ifdef SUPPORT_UNICODE
2733 for (i = 1; i <=
Lmin; i++)
2745 for (i = 1; i <=
Lmin; i++)
2755 if ((chartype ==
ucp_Lu ||
2757 chartype ==
ucp_Lt) == notmatch)
2763 for (i = 1; i <=
Lmin; i++)
2777 for (i = 1; i <=
Lmin; i++)
2791 for (i = 1; i <=
Lmin; i++)
2805 for (i = 1; i <=
Lmin; i++)
2824 for (i = 1; i <=
Lmin; i++)
2834 if ((category ==
ucp_L || category ==
ucp_N) == notmatch)
2845 for (i = 1; i <=
Lmin; i++)
2869 for (i = 1; i <=
Lmin; i++)
2871 int chartype, category;
2879 category =
PRIV(ucp_gentype)[chartype];
2880 if ((category ==
ucp_L || category ==
ucp_N ||
2887 for (i = 1; i <=
Lmin; i++)
2896#if PCRE2_CODE_UNIT_WIDTH == 32
2899 if (notmatch)
continue;
2908 if (notmatch)
break;
2921 for (i = 1; i <=
Lmin; i++)
2931 fc >= 0xe000) == notmatch)
2937 for (i = 1; i <=
Lmin; i++)
2951 for (i = 1; i <=
Lmin; i++)
2981 for (i = 1; i <=
Lmin; i++)
3002#ifdef SUPPORT_UNICODE
3006 for (i = 1; i <=
Lmin; i++)
3029 for (i = 1; i <=
Lmin; i++)
3047 for (i = 1; i <=
Lmin; i++)
3080 for (i = 1; i <=
Lmin; i++)
3097 for (i = 1; i <=
Lmin; i++)
3114 for (i = 1; i <=
Lmin; i++)
3131 for (i = 1; i <=
Lmin; i++)
3148 for (i = 1; i <=
Lmin; i++)
3162 for (i = 1; i <=
Lmin; i++)
3179 for (i = 1; i <=
Lmin; i++)
3196 for (i = 1; i <=
Lmin; i++)
3213 for (i = 1; i <=
Lmin; i++)
3230 for (i = 1; i <=
Lmin; i++)
3259 for (i = 1; i <=
Lmin; i++)
3303 for (i = 1; i <=
Lmin; i++)
3324#if PCRE2_CODE_UNIT_WIDTH != 8
3335 for (i = 1; i <=
Lmin; i++)
3346#if PCRE2_CODE_UNIT_WIDTH != 8
3355 for (i = 1; i <=
Lmin; i++)
3366#if PCRE2_CODE_UNIT_WIDTH != 8
3375 for (i = 1; i <=
Lmin; i++)
3385#if PCRE2_CODE_UNIT_WIDTH != 8
3395 for (i = 1; i <=
Lmin; i++)
3406#if PCRE2_CODE_UNIT_WIDTH != 8
3415 for (i = 1; i <=
Lmin; i++)
3429 for (i = 1; i <=
Lmin; i++)
3443 for (i = 1; i <=
Lmin; i++)
3457 for (i = 1; i <=
Lmin; i++)
3471 for (i = 1; i <=
Lmin; i++)
3485 for (i = 1; i <=
Lmin; i++)
3514#ifdef SUPPORT_UNICODE
3549 if ((chartype ==
ucp_Lu ||
3683 int chartype, category;
3694 category =
PRIV(ucp_gentype)[chartype];
3695 if ((category ==
ucp_L ||
3696 category ==
ucp_N ||
3716#if PCRE2_CODE_UNIT_WIDTH == 32
3833#ifdef SUPPORT_UNICODE
4009#if PCRE2_CODE_UNIT_WIDTH != 8
4024#if PCRE2_CODE_UNIT_WIDTH != 8
4036#if PCRE2_CODE_UNIT_WIDTH != 8
4048#if PCRE2_CODE_UNIT_WIDTH != 8
4060#if PCRE2_CODE_UNIT_WIDTH != 8
4114#ifdef SUPPORT_UNICODE
4130 if (notmatch)
break;
4147 if ((chartype ==
ucp_Lu ||
4149 chartype ==
ucp_Lt) == notmatch)
4215 if (ok == notmatch)
break;
4232 if ((category ==
ucp_L || category ==
ucp_N) == notmatch)
4257 if (notmatch)
goto ENDLOOP99;
4273 int chartype, category;
4282 category =
PRIV(ucp_gentype)[chartype];
4283 if ((category ==
ucp_L ||
4284 category ==
ucp_N ||
4286 chartype ==
ucp_Pc) == notmatch)
4303#if PCRE2_CODE_UNIT_WIDTH == 32
4306 if (!notmatch)
goto GOT_MAX;
4315 {
if (notmatch)
break;
else goto GOT_MAX; }
4317 {
if (notmatch)
goto GOT_MAX;
else break; }
4338 fc >= 0xe000) == notmatch)
4374 if (ok == notmatch)
break;
4397 if (utf) BACKCHAR(
Feptr);
4445 if (!utf) fc = *
Feptr;
else
4456 if (!utf) fc = *fptr;
else
4462 if ((
PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0)
break;
4472#ifdef SUPPORT_UNICODE
4554 && fc != 0x2028 && fc != 0x2029
4578 default: gotspace =
FALSE;
break;
4600 default: gotspace =
FALSE;
break;
4777#
if PCRE2_CODE_UNIT_WIDTH != 8
4778 && fc != 0x2028 && fc != 0x2029
4796 default:
Feptr++;
break;
4798#if PCRE2_CODE_UNIT_WIDTH != 8
4817 default:
goto ENDLOOP01;
4819#if PCRE2_CODE_UNIT_WIDTH != 8
4838 default:
Feptr++;
break;
4840#if PCRE2_CODE_UNIT_WIDTH != 8
4859 default:
goto ENDLOOP03;
4861#if PCRE2_CODE_UNIT_WIDTH != 8
4988#define Lmin F->temp_32[0]
4989#define Lmax F->temp_32[1]
4990#define Lcaseless F->temp_32[2]
4991#define Lstart F->temp_sptr[0]
4992#define Loffset F->temp_size
5033 reptype = rep_typ[fc];
5078 for (i = 1; i <=
Lmin; i++)
5135 if (rrc > 0 && mb->
partial != 0 &&
5222#define Lnext_ecode F->temp_sptr[0]
5254#define Lframe_type F->temp_32[0]
5255#define Lmatched_once F->temp_32[1]
5256#define Lzero_allowed F->temp_32[2]
5257#define Lstart_eptr F->temp_sptr[0]
5258#define Lstart_group F->temp_sptr[1]
5264 goto POSSESSIVE_CAPTURE;
5265 goto POSSESSIVE_NON_CAPTURE;
5271 POSSESSIVE_NON_CAPTURE:
5273 goto POSSESSIVE_GROUP;
5346#define Lframe_type F->temp_32[0]
5347#define Lnext_branch F->temp_sptr[0]
5424#define Lframe_type F->temp_32[0]
5425#define Lstart_branch F->temp_sptr[0]
5452 offset =
P->last_group_offset;
5509#define Lframe_type F->temp_32[0]
5545#define Lframe_type F->temp_32[0]
5571 goto ASSERT_NOT_FAILED;
5596 rrc = do_callout(
F, mb, &length);
5629 rrc = do_callout(
F, mb, &length);
5660 number =
GET2(slot, 0);
5662 if (condition)
break;
5681 if (condition)
break;
5698#define Lpositive F->temp_32[0]
5699#define Lstart_branch F->temp_sptr[0]
5795#ifdef SUPPORT_UNICODE
5798 while (number-- > 0)
5830#define Lmin F->temp_32[0]
5831#define Lmax F->temp_32[1]
5832#define Leptr F->temp_sptr[0]
5843#ifdef SUPPORT_UNICODE
5846 for (i = 0; i <
Lmax; i++)
5865 uint32_t available = (diff > 65535)? 65535 : ((diff > 0)? (int)diff : 0);
5867 if (
Lmax > available)
Lmax = available;
5880#ifdef SUPPORT_UNICODE
5914 branch_start = bracode;
5915 while (branch_start +
GET(branch_start, 1) != branch_end)
5916 branch_start +=
GET(branch_start, 1);
5928#ifdef DEBUG_SHOW_RMATCH
5929 fprintf(stderr,
"++ KET for frame=%d type=%x prev char offset=%lu\n",
5930 N->rdepth,
N->group_frame_type,
6027 uint32_t y =
GET(
P->ecode,1);
6028 if ((
P->ecode)[y] !=
OP_ALT)
break;
6079 offset = (number << 1) - 2;
6272#ifdef SUPPORT_UNICODE
6282#ifdef SUPPORT_UNICODE
6286 int category =
PRIV(ucp_gentype)[chartype];
6287 prev_is_word = (category ==
ucp_L || category ==
ucp_N ||
6300 cur_is_word =
FALSE;
6305#ifdef SUPPORT_UNICODE
6315#ifdef SUPPORT_UNICODE
6319 int category =
PRIV(ucp_gentype)[chartype];
6320 cur_is_word = (category ==
ucp_L || category ==
ucp_N ||
6331 cur_is_word == prev_is_word : cur_is_word != prev_is_word)
6467#define LBL(val) case val: goto L_RM##val;
6475#ifdef DEBUG_SHOW_RMATCH
6487#ifdef SUPPORT_WIDE_CHARS
6491#ifdef SUPPORT_UNICODE
6535int was_zero_terminated = 0;
6536const uint8_t *start_bits =
NULL;
6545#if PCRE2_CODE_UNIT_WIDTH == 8
6572#ifdef SUPPORT_UNICODE
6575uint32_t fragment_options = 0;
6598if (code ==
NULL || subject ==
NULL || match_data ==
NULL)
6601start_match = subject + start_offset;
6602req_cu_ptr = start_match - 1;
6606 was_zero_terminated = 1;
6608true_end_subject = end_subject = subject + length;
6633#define FF (PCRE2_NOTEMPTY_SET|PCRE2_NE_ATST_SET)
6634#define OO (PCRE2_NOTEMPTY|PCRE2_NOTEMPTY_ATSTART)
6650#ifdef SUPPORT_UNICODE
6680 match_data->memctl.free((
void *)match_data->subject,
6681 match_data->memctl.memory_data);
6684match_data->subject =
NULL;
6688match_data->startchar = 0;
6703#ifdef SUPPORT_UNICODE
6706#if PCRE2_CODE_UNIT_WIDTH != 32
6713#if PCRE2_CODE_UNIT_WIDTH != 32
6714 if (start_match < end_subject && NOT_FIRSTCU(*start_match))
6717#if PCRE2_CODE_UNIT_WIDTH == 8
6728#if PCRE2_CODE_UNIT_WIDTH != 32
6729 for (i = re->
max_lookbehind; i > 0 && start_match > subject; i--)
6732 while (start_match > subject &&
6733#
if PCRE2_CODE_UNIT_WIDTH == 8
6734 (*start_match & 0xc0) == 0x80)
6736 (*start_match & 0xfc00) == 0xdc00)
6749 start_match = subject;
6756 length - (start_match - subject), &(match_data->startchar));
6757 if (match_data->rc != 0)
6759 match_data->startchar += start_match - subject;
6760 return match_data->rc;
6762 jit_checked_utf =
TRUE;
6770 match_data, mcontext);
6773 match_data->subject_length = length;
6776 length =
CU2BYTES(length + was_zero_terminated);
6777 match_data->subject = match_data->memctl.malloc(length,
6778 match_data->memctl.memory_data);
6780 memcpy((
void *)match_data->subject, subject, length);
6813#ifdef SUPPORT_UNICODE
6820#if PCRE2_CODE_UNIT_WIDTH != 32
6828#if PCRE2_CODE_UNIT_WIDTH != 32
6831 while (start_match < end_subject && NOT_FIRSTCU(*start_match))
6834 skipped_bad_start =
TRUE;
6837 else if (start_match < end_subject && NOT_FIRSTCU(*start_match))
6840#if PCRE2_CODE_UNIT_WIDTH == 8
6857#if PCRE2_CODE_UNIT_WIDTH != 32
6858 if (!skipped_bad_start)
6865#
if PCRE2_CODE_UNIT_WIDTH == 8
6892 length - (mb->
check_subject - subject), &(match_data->startchar));
6894 if (match_data->rc == 0)
break;
6902 if (!allow_invalid || match_data->rc > 0)
return match_data->rc;
6903 end_subject = subject + match_data->startchar;
6910 if (end_subject < start_match)
6913#if PCRE2_CODE_UNIT_WIDTH != 32
6917 end_subject = true_end_subject;
6934if (mcontext ==
NULL)
6939else mb->
memctl = mcontext->memctl;
6944bumpalong_limit = (mcontext->offset_limit ==
PCRE2_UNSET)?
6945 true_end_subject : subject + mcontext->offset_limit;
6952cb.subject = subject;
6953cb.subject_length = (
PCRE2_SIZE)(end_subject - subject);
6954cb.callout_flags = 0;
6959mb->
callout = mcontext->callout;
7053heapframes_size = frame_size * 10;
7059 heapframes_size = max_size;
7065if (match_data->heapframes_size < heapframes_size)
7067 match_data->memctl.free(match_data->heapframes,
7068 match_data->memctl.memory_data);
7069 match_data->heapframes = match_data->memctl.malloc(heapframes_size,
7070 match_data->memctl.memory_data);
7071 if (match_data->heapframes ==
NULL)
7073 match_data->heapframes_size = 0;
7076 match_data->heapframes_size = heapframes_size;
7096 has_first_cu =
TRUE;
7101#ifdef SUPPORT_UNICODE
7102#if PCRE2_CODE_UNIT_WIDTH == 8
7103 if (first_cu > 127 && ucp && !utf) first_cu2 =
UCD_OTHERCASE(first_cu);
7105 if (first_cu > 127 && (utf || ucp)) first_cu2 =
UCD_OTHERCASE(first_cu);
7123#ifdef SUPPORT_UNICODE
7124#if PCRE2_CODE_UNIT_WIDTH == 8
7125 if (req_cu > 127 && ucp && !utf) req_cu2 =
UCD_OTHERCASE(req_cu);
7127 if (req_cu > 127 && (utf || ucp)) req_cu2 =
UCD_OTHERCASE(req_cu);
7139#ifdef SUPPORT_UNICODE
7143start_partial = match_partial =
NULL;
7146#if PCRE2_CODE_UNIT_WIDTH == 8
7147memchr_found_first_cu =
NULL;
7148memchr_found_first_cu2 =
NULL;
7173#ifdef SUPPORT_UNICODE
7179 ACROSSCHAR(t < end_subject, t, t++);
7184 while (t < end_subject && !
IS_NEWLINE(t)) t++;
7194 if (has_first_cu || start_bits !=
NULL)
7196 BOOL ok = start_match < end_subject;
7200 ok = has_first_cu && (c == first_cu || c == first_cu2);
7201 if (!ok && start_bits !=
NULL)
7203#if PCRE2_CODE_UNIT_WIDTH != 8
7204 if (c > 255) c = 255;
7206 ok = (start_bits[c/8] & (1u << (c&7))) != 0;
7223 if (first_cu != first_cu2)
7228#if PCRE2_CODE_UNIT_WIDTH != 8
7230 while (start_match < end_subject &&
7244 PCRE2_SIZE searchlength = end_subject - start_match;
7250 if (memchr_found_first_cu ==
NULL ||
7251 start_match > memchr_found_first_cu)
7253 pp1 = memchr(start_match, first_cu, searchlength);
7254 memchr_found_first_cu = (pp1 ==
NULL)? end_subject : pp1;
7260 else pp1 = (memchr_found_first_cu == end_subject)?
NULL :
7261 memchr_found_first_cu;
7265 if (memchr_found_first_cu2 ==
NULL ||
7266 start_match > memchr_found_first_cu2)
7268 pp2 = memchr(start_match, first_cu2, searchlength);
7269 memchr_found_first_cu2 = (pp2 ==
NULL)? end_subject : pp2;
7272 else pp2 = (memchr_found_first_cu2 == end_subject)?
NULL :
7273 memchr_found_first_cu2;
7279 start_match = (pp2 ==
NULL)? end_subject : pp2;
7281 start_match = (pp2 ==
NULL || pp1 < pp2)? pp1 : pp2;
7290#if PCRE2_CODE_UNIT_WIDTH != 8
7291 while (start_match < end_subject &&
UCHAR21TEST(start_match) !=
7295 start_match = memchr(start_match, first_cu, end_subject - start_match);
7296 if (start_match ==
NULL) start_match = end_subject;
7325#ifdef SUPPORT_UNICODE
7328 while (start_match < end_subject && !
WAS_NEWLINE(start_match))
7331 ACROSSCHAR(start_match < end_subject, start_match, start_match++);
7336 while (start_match < end_subject && !
WAS_NEWLINE(start_match))
7343 if (start_match[-1] ==
CHAR_CR &&
7345 start_match < end_subject &&
7356 else if (start_bits !=
NULL)
7358 while (start_match < end_subject)
7361#if PCRE2_CODE_UNIT_WIDTH != 8
7362 if (c > 255) c = 255;
7364 if ((start_bits[c/8] & (1u << (c&7))) != 0)
break;
7393 if (end_subject - start_match < re->minlength)
7421 p = start_match + (has_first_cu? 1:0);
7422 if (has_req_cu &&
p > req_cu_ptr)
7424 PCRE2_SIZE check_length = end_subject - start_match;
7427 (!anchored && check_length <
REQ_CU_MAX * 1000))
7429 if (req_cu != req_cu2)
7431#if PCRE2_CODE_UNIT_WIDTH != 8
7432 while (
p < end_subject)
7435 if (pp == req_cu || pp == req_cu2) {
p--;
break; }
7439 p = memchr(pp, req_cu, end_subject - pp);
7442 p = memchr(pp, req_cu2, end_subject - pp);
7443 if (
p ==
NULL)
p = end_subject;
7452#if PCRE2_CODE_UNIT_WIDTH != 8
7453 while (
p < end_subject)
7459 p = memchr(
p, req_cu, end_subject -
p);
7460 if (
p ==
NULL)
p = end_subject;
7467 if (
p >= end_subject)
7487 if (start_match > bumpalong_limit)
7501#ifdef SUPPORT_UNICODE
7510#ifdef DEBUG_SHOW_OPS
7511 fprintf(stderr,
"++ Calling match()\n");
7517#ifdef DEBUG_SHOW_OPS
7518 fprintf(stderr,
"++ match() returned %d\n\n", rc);
7524 match_partial = start_match;
7537 new_start_match = start_match;
7559 new_start_match = start_match + 1;
7560#ifdef SUPPORT_UNICODE
7562 ACROSSCHAR(new_start_match < end_subject, new_start_match,
7588 if (firstline &&
IS_NEWLINE(start_match))
break;
7592 start_match = new_start_match;
7597 if (anchored || start_match > end_subject)
break;
7606 if (start_match > subject + start_offset &&
7608 start_match < end_subject &&
7646#ifdef SUPPORT_UNICODE
7647if (utf && end_subject != true_end_subject &&
7655 start_match = end_subject + 1;
7657#if PCRE2_CODE_UNIT_WIDTH != 32
7658 while (start_match < true_end_subject && NOT_FIRSTCU(*start_match))
7665 if (start_match >= true_end_subject)
7668 match_partial =
NULL;
7675 rc =
PRIV(
valid_utf)(start_match, length - (start_match - subject),
7676 &(match_data->startchar));
7684 goto FRAGMENT_RESTART;
7692 mb->
end_subject = end_subject = start_match + match_data->startchar;
7693 if (end_subject > start_match)
7696 goto FRAGMENT_RESTART;
7705match_data->code = re;
7706match_data->mark = mb->
mark;
7716 match_data->rc = ((int)mb->
end_offset_top >= 2 * match_data->oveccount)?
7718 match_data->subject_length = length;
7719 match_data->startchar = start_match - subject;
7725 length =
CU2BYTES(length + was_zero_terminated);
7726 match_data->subject = match_data->memctl.malloc(length,
7727 match_data->memctl.memory_data);
7729 memcpy((
void *)match_data->subject, subject, length);
7732 else match_data->subject = subject;
7734 return match_data->rc;
7752else if (match_partial !=
NULL)
7754 match_data->subject = subject;
7755 match_data->subject_length = length;
7756 match_data->ovector[0] = match_partial - subject;
7757 match_data->ovector[1] = end_subject - subject;
7758 match_data->startchar = match_partial - subject;
7759 match_data->leftchar = start_partial - subject;
7760 match_data->rightchar = end_subject - subject;
7768return match_data->rc;
fprintf($stream, string $format, mixed ... $values)
vfprintf($stream, string $format, array $values)
count(Countable|array $value, int $mode=COUNT_NORMAL)
memset(ptr, 0, type->size)
#define PCRE2_DOLLAR_ENDONLY
#define PCRE2_ZERO_TERMINATED
#define PCRE2_NOTEMPTY_ATSTART
#define PCRE2_ENDANCHORED
#define PCRE2_ERROR_BADMODE
#define PCRE2_BSR_ANYCRLF
#define PCRE2_ERROR_HEAPLIMIT
#define PCRE2_ERROR_BADOPTION
#define PCRE2_ERROR_NOMATCH
#define PCRE2_ERROR_INTERNAL
#define PCRE2_ERROR_JIT_BADOPTION
#define PCRE2_MATCH_INVALID_UTF
#define PCRE2_NEWLINE_ANYCRLF
#define PCRE2_COPY_MATCHED_SUBJECT
#define PCRE2_ERROR_BADMAGIC
#define PCRE2_ERROR_BADOFFSET
#define PCRE2_ERROR_RECURSELOOP
#define PCRE2_ERROR_BADOFFSETLIMIT
#define PCRE2_MATCH_UNSET_BACKREF
#define PCRE2_PARTIAL_SOFT
#define PCRE2_ERROR_UTF16_ERR3
#define PCRE2_CALLOUT_STARTMATCH
#define PCRE2_PARTIAL_HARD
#define pcre2_match_context
#define PCRE2_ERROR_UTF8_ERR20
#define PCRE2_ERROR_DEPTHLIMIT
#define PCRE2_CALLOUT_BACKTRACK
#define PCRE2_USE_OFFSET_LIMIT
#define PCRE2_ERROR_MATCHLIMIT
#define PCRE2_CALL_CONVENTION
#define PCRE2_ALT_CIRCUMFLEX
#define PCRE2_NEWLINE_CRLF
#define PCRE2_NEWLINE_NUL
#define PCRE2_NO_UTF_CHECK
#define PCRE2_NO_START_OPTIMIZE
#define pcre2_callout_block
#define PCRE2_ERROR_PARTIAL
#define PCRE2_NEWLINE_ANY
#define PCRE2_DISABLE_RECURSELOOP_CHECK
#define PCRE2_ERROR_BADUTFOFFSET
#define PCRE2_ERROR_NOMEMORY
PCRE2_SPTR PRIV extuni(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject, PCRE2_SPTR end_subject, BOOL utf, int *xcount)
@ OP_NOT_UCP_WORD_BOUNDARY
#define PCRE2_FIRSTMAPSET
#define PCRE2_FIRSTCASELESS
#define VSPACE_MULTIBYTE_CASES
#define CHAR_GRAVE_ACCENT
#define PCRE2_LASTCASELESS
#define MAX_UTF_CODE_POINT
#define CHAR_COMMERCIAL_AT
#define UCD_BIDICLASS_PROP(prop)
#define PCRE2_MD_COPIED_SUBJECT
@ PCRE2_MATCHEDBY_INTERPRETER
#define HSPACE_MULTIBYTE_CASES
#define START_FRAMES_SIZE
#define UCD_BIDICLASS(ch)
#define VSPACE_BYTE_CASES
#define UCD_OTHERCASE(ch)
#define HSPACE_BYTE_CASES
#define PCRE2_MATCH_EMPTY
#define UCD_SCRIPTX_PROP(prop)
#define UCD_BPROPS_PROP(prop)
#define UCD_GRAPHBREAK(ch)
#define HEAPFRAME_ALIGNMENT
#define UCHAR21TEST(eptr)
#define TABLE_GET(c, table, default)
#define UCHAR21INCTEST(eptr)
#define GETCHARINCTEST(c, eptr)
#define GETCHARLEN(c, eptr, len)
#define GETCHARINC(c, eptr)
#define PUBLIC_JIT_MATCH_OPTIONS
#define Flast_group_offset
#define Fgroup_frame_type
#define Lbyte_map_address
#define MATCH_BACKTRACK_MAX
#define MATCH_BACKTRACK_MIN
#define PUBLIC_MATCH_OPTIONS
unsigned int PRIV ord2utf(uint32_t cvalue, PCRE2_UCHAR *buffer)
BOOL PRIV script_run(PCRE2_SPTR ptr, PCRE2_SPTR endptr, BOOL utf)
int PRIV valid_utf(PCRE2_SPTR string, PCRE2_SIZE length, PCRE2_SIZE *erroroffset)
BOOL PRIV xclass(uint32_t c, PCRE2_SPTR data, BOOL utf)
PHP_JSON_API size_t int options
#define offsetof(STRUCTURE, FIELD)
file_private int match(struct magic_set *, struct magic *, size_t, const struct buffer *, size_t, int, int, int, uint16_t *, uint16_t *, int *, int *, int *, int *, int *)
PCRE2_SIZE last_group_offset
uint32_t group_frame_type
PCRE2_SPTR verb_ecode_ptr
uint32_t verb_current_recurse
int(* callout)(pcre2_callout_block *, void *)
uint32_t match_call_count
uint32_t match_limit_depth
PCRE2_SPTR start_used_ptr
PCRE2_SPTR true_end_subject
PCRE2_SIZE end_offset_top
uint16_t newline_convention
strcmp(string $string1, string $string2)
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)