49 #define PSSTART start_subject
50 #define PSEND end_subject
69 #define CAPLMASK 0x0000ffff
70 #define OVFLMASK 0xffff0000
71 #define OVFLBIT 0x00010000
77 #define MATCH_CONDASSERT 1
78 #define MATCH_CBEGROUP 2
84 #define MATCH_NOMATCH 0
89 #define MATCH_ACCEPT (-999)
90 #define MATCH_KETRPOS (-998)
91 #define MATCH_ONCE (-997)
94 #define MATCH_COMMIT (-996)
95 #define MATCH_PRUNE (-995)
96 #define MATCH_SKIP (-994)
97 #define MATCH_SKIP_ARG (-993)
98 #define MATCH_THEN (-992)
99 #define MATCH_BACKTRACK_MAX MATCH_THEN
100 #define MATCH_BACKTRACK_MIN MATCH_COMMIT
106 #define REC_STACK_SAVE_MAX 30
110 static const char rep_min[] = { 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, };
111 static const char rep_max[] = { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, };
135 if (is_subject && length >
md->end_subject - p) length =
md->end_subject - p;
170 #if defined SUPPORT_UTF && defined SUPPORT_UCP
175 if (eptr >=
md->end_subject)
176 printf(
"matching subject <null>");
179 printf(
"matching subject ");
180 pchars(eptr, length,
TRUE,
md);
182 printf(
" against backref ");
190 if (length < 0)
return -1;
198 #if defined SUPPORT_UTF && defined SUPPORT_UCP
215 if (eptr >=
md->end_subject)
return -2;
221 const pcre_uint32 *pp =
PRIV(ucd_caseless_sets) + ur->
caseset;
224 if (c < *pp)
return -1;
225 if (c == *pp++)
break;
239 if (eptr >=
md->end_subject)
return -2;
256 if (eptr >=
md->end_subject)
return -2;
261 return (
int)(eptr - eptr_start);
307 enum {
RM1=1,
RM2,
RM3,
RM4,
RM5,
RM6,
RM7,
RM8,
RM9,
RM10,
308 RM11,
RM12,
RM13,
RM14,
RM15,
RM16,
RM17,
RM18,
RM19,
RM20,
309 RM21,
RM22,
RM23,
RM24,
RM25,
RM26,
RM27,
RM28,
RM29,
RM30,
310 RM31,
RM32,
RM33,
RM34,
RM35,
RM36,
RM37,
RM38,
RM39,
RM40,
311 RM41,
RM42,
RM43,
RM44,
RM45,
RM46,
RM47,
RM48,
RM49,
RM50,
312 RM51,
RM52,
RM53,
RM54,
RM55,
RM56,
RM57,
RM58,
RM59,
RM60,
320 #define REGISTER register
323 #define RMATCH(ra,rb,rc,rd,re,rw) \
325 printf("match() called in line %d\n", __LINE__); \
326 rrc = match(ra,rb,mstart,rc,rd,re,rdepth+1); \
327 printf("to line %d\n", __LINE__); \
329 #define RRETURN(ra) \
331 printf("match() returned %d from line %d\n", ra, __LINE__); \
335 #define RMATCH(ra,rb,rc,rd,re,rw) \
336 rrc = match(ra,rb,mstart,rc,rd,re,rdepth+1)
337 #define RRETURN(ra) return ra
349 #define RMATCH(ra,rb,rc,rd,re,rw)\
351 heapframe *newframe = frame->Xnextframe;\
352 if (newframe == NULL)\
354 newframe = (heapframe *)(PUBL(stack_malloc))(sizeof(heapframe));\
355 if (newframe == NULL) RRETURN(PCRE_ERROR_NOMEMORY);\
356 newframe->Xnextframe = NULL;\
357 frame->Xnextframe = newframe;\
360 newframe->Xeptr = ra;\
361 newframe->Xecode = rb;\
362 newframe->Xmstart = mstart;\
363 newframe->Xoffset_top = rc;\
364 newframe->Xeptrb = re;\
365 newframe->Xrdepth = frame->Xrdepth + 1;\
366 newframe->Xprevframe = frame;\
368 DPRINTF(("restarting from line %d\n", __LINE__));\
371 DPRINTF(("jumped back to line %d\n", __LINE__));\
376 heapframe *oldframe = frame;\
377 frame = oldframe->Xprevframe;\
389 typedef struct heapframe {
390 struct heapframe *Xprevframe;
391 struct heapframe *Xnextframe;
400 unsigned int Xrdepth;
422 unsigned int Xprop_value;
423 int Xprop_fail_result;
435 unsigned int Xnumber;
438 pcre_int32 Xsave_capture_last;
439 int Xsave_offset1, Xsave_offset2, Xsave_offset3;
473 #define CHECK_PARTIAL()\
474 if (md->partial != 0 && eptr >= md->end_subject && \
475 eptr > md->start_used_ptr) \
478 if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL); \
481 #define SCHECK_PARTIAL()\
482 if (md->partial != 0 && eptr > md->start_used_ptr) \
485 if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL); \
523 register pcre_uint32 c;
526 BOOL minimize, possessive;
538 heapframe *frame = (heapframe *)
md->match_frames_base;
543 frame->Xecode = ecode;
544 frame->Xmstart = mstart;
545 frame->Xoffset_top = offset_top;
546 frame->Xeptrb = eptrb;
547 frame->Xrdepth = rdepth;
555 #define eptr frame->Xeptr
556 #define ecode frame->Xecode
557 #define mstart frame->Xmstart
558 #define offset_top frame->Xoffset_top
559 #define eptrb frame->Xeptrb
560 #define rdepth frame->Xrdepth
565 #define charptr frame->Xcharptr
567 #define callpat frame->Xcallpat
568 #define codelink frame->Xcodelink
569 #define
data frame->Xdata
570 #define
next frame->Xnext
571 #define pp frame->Xpp
572 #define
prev frame->Xprev
573 #define saved_eptr frame->Xsaved_eptr
575 #define new_recursive frame->Xnew_recursive
577 #define cur_is_word frame->Xcur_is_word
578 #define condition frame->Xcondition
579 #define prev_is_word frame->Xprev_is_word
582 #define prop_type frame->Xprop_type
583 #define prop_value frame->Xprop_value
584 #define prop_fail_result frame->Xprop_fail_result
585 #define oclength frame->Xoclength
586 #define occhars frame->Xocchars
589 #define ctype frame->Xctype
590 #define
fc frame->Xfc
591 #define
fi frame->Xfi
592 #define length frame->Xlength
593 #define
max frame->Xmax
594 #define
min frame->Xmin
595 #define
number frame->Xnumber
596 #define
offset frame->Xoffset
597 #define op frame->Xop
598 #define save_capture_last frame->Xsave_capture_last
599 #define save_offset1 frame->Xsave_offset1
600 #define save_offset2 frame->Xsave_offset2
601 #define save_offset3 frame->Xsave_offset3
602 #define stacksave frame->Xstacksave
604 #define newptrb frame->Xnewptrb
640 unsigned int prop_value;
641 int prop_fail_result;
654 pcre_int32 save_capture_last;
655 int save_offset1, save_offset2, save_offset3;
672 int len = (
int)((
char *)&rdepth - (
char *)eptr);
683 #define allow_zero cur_is_word
684 #define cbegroup condition
685 #define code_offset codelink
686 #define condassert condition
687 #define matched_once prev_is_word
689 #define save_mark data
696 prop_fail_result = 0;
741 newptrb.epb_saved_eptr = eptr;
742 newptrb.epb_prev = eptrb;
744 md->match_function_type = 0;
751 minimize = possessive =
FALSE;
757 md->nomatch_mark = ecode + 2;
759 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode] + ecode[1], offset_top,
md,
762 md->mark ==
NULL)
md->mark = ecode + 2;
774 md->start_match_ptr = eptr;
783 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode], offset_top,
md,
789 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode], offset_top,
md,
795 md->nomatch_mark = ecode + 2;
797 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode] + ecode[1], offset_top,
md,
800 md->mark ==
NULL)
md->mark = ecode + 2;
805 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode], offset_top,
md,
808 md->start_match_ptr = eptr;
820 md->skip_arg_count++;
821 if (
md->skip_arg_count <=
md->ignore_skip_arg)
823 ecode +=
PRIV(OP_lengths)[*ecode] + ecode[1];
826 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode] + ecode[1], offset_top,
md,
835 md->start_match_ptr = ecode + 2;
843 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode], offset_top,
md,
846 md->start_match_ptr = ecode;
850 md->nomatch_mark = ecode + 2;
852 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode] + ecode[1], offset_top,
855 md->mark ==
NULL)
md->mark = ecode + 2;
857 md->start_match_ptr = ecode;
882 mstart =
md->start_match_ptr;
887 next = ecode + GET(ecode,1);
888 if (
md->start_match_ptr <
next &&
894 ecode += GET(ecode,1);
906 do ecode += GET(ecode, 1);
while (*ecode ==
OP_ALT);
908 offset_top =
md->end_offset_top;
909 eptr =
md->end_match_ptr;
916 if (*ecode ==
OP_KET || eptr == saved_eptr)
962 printf(
"start bracket %d\n",
number);
964 pchars(eptr, 16,
TRUE,
md);
968 if (offset < md->offset_max)
970 save_offset1 =
md->offset_vector[
offset];
971 save_offset2 =
md->offset_vector[
offset+1];
972 save_offset3 =
md->offset_vector[
md->offset_end -
number];
973 save_capture_last =
md->capture_last;
976 DPRINTF((
"saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
978 (
int)(eptr -
md->start_subject);
983 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode], offset_top,
md,
1000 next = ecode + GET(ecode,1);
1001 if (
md->start_match_ptr <
next &&
1009 md->capture_last = save_capture_last;
1010 ecode += GET(ecode, 1);
1012 if (*ecode !=
OP_ALT)
break;
1016 md->offset_vector[
offset] = save_offset1;
1017 md->offset_vector[
offset+1] = save_offset2;
1018 md->offset_vector[
md->offset_end -
number] = save_offset3;
1031 DPRINTF((
"insufficient capture room: treat as non-capturing\n"));
1059 DPRINTF((
"start non-capturing bracket\n"));
1070 else if (!
md->hasthen && ecode[GET(ecode, 1)] !=
OP_ALT)
1072 ecode +=
PRIV(OP_lengths)[*ecode];
1079 save_capture_last =
md->capture_last;
1080 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode], offset_top,
md, eptrb,
1088 next = ecode + GET(ecode,1);
1089 if (
md->start_match_ptr <
next &&
1101 while (*scode ==
OP_ALT) scode += GET(scode, 1);
1102 scode -= GET(scode, 1);
1108 ecode += GET(ecode, 1);
1110 if (*ecode !=
OP_ALT)
break;
1111 md->capture_last = save_capture_last;
1133 printf(
"start possessive bracket %d\n",
number);
1135 pchars(eptr, 16,
TRUE,
md);
1139 if (
offset >=
md->offset_max)
goto POSSESSIVE_NON_CAPTURE;
1144 save_offset1 =
md->offset_vector[
offset];
1145 save_offset2 =
md->offset_vector[
offset+1];
1146 save_offset3 =
md->offset_vector[
md->offset_end -
number];
1147 save_capture_last =
md->capture_last;
1149 DPRINTF((
"saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
1163 (
int)(eptr -
md->start_subject);
1165 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode], offset_top,
md,
1169 offset_top =
md->end_offset_top;
1171 save_capture_last =
md->capture_last;
1173 mstart =
md->start_match_ptr;
1174 if (eptr ==
md->end_match_ptr)
1176 do ecode += GET(ecode, 1);
while (*ecode ==
OP_ALT);
1179 eptr =
md->end_match_ptr;
1188 next = ecode + GET(ecode,1);
1189 if (
md->start_match_ptr <
next &&
1195 md->capture_last = save_capture_last;
1196 ecode += GET(ecode, 1);
1197 if (*ecode !=
OP_ALT)
break;
1202 md->offset_vector[
offset] = save_offset1;
1203 md->offset_vector[
offset+1] = save_offset2;
1204 md->offset_vector[
md->offset_end -
number] = save_offset3;
1224 POSSESSIVE_NON_CAPTURE:
1227 save_capture_last =
md->capture_last;
1232 RMATCH(eptr, ecode +
PRIV(OP_lengths)[*ecode], offset_top,
md,
1236 offset_top =
md->end_offset_top;
1239 mstart =
md->start_match_ptr;
1240 if (eptr ==
md->end_match_ptr)
1242 do ecode += GET(ecode, 1);
while (*ecode ==
OP_ALT);
1245 eptr =
md->end_match_ptr;
1254 next = ecode + GET(ecode,1);
1255 if (
md->start_match_ptr <
next &&
1261 ecode += GET(ecode, 1);
1262 if (*ecode !=
OP_ALT)
break;
1263 md->capture_last = save_capture_last;
1288 codelink = GET(ecode, 1);
1298 PUBL(callout_block) cb;
1300 cb.callout_number = ecode[1];
1301 cb.offset_vector =
md->offset_vector;
1302 #if defined COMPILE_PCRE8
1304 #elif defined COMPILE_PCRE16
1306 #elif defined COMPILE_PCRE32
1309 cb.subject_length = (
int)(
md->end_subject -
md->start_subject);
1310 cb.start_match = (
int)(mstart -
md->start_subject);
1311 cb.current_position = (
int)(eptr -
md->start_subject);
1312 cb.pattern_position = GET(ecode, 2);
1313 cb.next_item_length = GET(ecode, 2 +
LINK_SIZE);
1314 cb.capture_top = offset_top/2;
1315 cb.capture_last =
md->capture_last &
CAPLMASK;
1317 if (cb.capture_last == 0) cb.capture_last = -1;
1318 cb.callout_data =
md->callout_data;
1319 cb.mark =
md->nomatch_mark;
1334 switch(condcode = *ecode)
1337 if (
md->recursive !=
NULL)
1339 unsigned int recno =
GET2(ecode, 1);
1340 condition = (recno ==
RREF_ANY || recno ==
md->recursive->group_num);
1345 if (
md->recursive !=
NULL)
1351 unsigned int recno =
GET2(slot, 0);
1352 condition = recno ==
md->recursive->group_num;
1353 if (condition)
break;
1354 slot +=
md->name_entry_size;
1361 condition =
offset < offset_top &&
md->offset_vector[
offset] >= 0;
1371 condition =
offset < offset_top &&
md->offset_vector[
offset] >= 0;
1372 if (condition)
break;
1373 slot +=
md->name_entry_size;
1391 if (
md->end_offset_top > offset_top)
1392 offset_top =
md->end_offset_top;
1401 ecode += GET(ecode, 1);
1402 while (*ecode ==
OP_ALT) ecode += GET(ecode, 1);
1419 ecode += condition?
PRIV(OP_lengths)[condcode] : codelink;
1459 printf(
"end bracket %d at *ACCEPT",
number);
1468 md->offset_vector[
offset+1] = (
int)(eptr -
md->start_subject);
1474 if (
offset >= offset_top)
1476 register int *iptr =
md->offset_vector + offset_top;
1477 register int *iend =
md->offset_vector +
offset;
1478 while (iptr < iend) *iptr++ = -1;
1500 (
md->notempty_atstart &&
1501 mstart ==
md->start_subject +
md->start_offset)))
1506 md->end_match_ptr = eptr;
1507 md->end_offset_top = offset_top;
1508 md->start_match_ptr = mstart;
1533 md->match_function_type = 0;
1548 mstart =
md->start_match_ptr;
1561 next = ecode + GET(ecode,1);
1562 if (
md->start_match_ptr <
next &&
1574 ecode += GET(ecode, 1);
1576 while (*ecode ==
OP_ALT);
1590 do ecode += GET(ecode,1);
while (*ecode ==
OP_ALT);
1592 offset_top =
md->end_offset_top;
1604 md->match_function_type = 0;
1628 next = ecode + GET(ecode,1);
1629 if (
md->start_match_ptr <
next &&
1646 do ecode += GET(ecode,1);
while (*ecode ==
OP_ALT);
1647 goto NEG_ASSERT_TRUE;
1657 ecode += GET(ecode,1);
1659 while (*ecode ==
OP_ALT);
1691 eptr -= GET(ecode, 1);
1697 if (eptr < md->start_used_ptr)
md->start_used_ptr = eptr;
1708 PUBL(callout_block) cb;
1710 cb.callout_number = ecode[1];
1711 cb.offset_vector =
md->offset_vector;
1712 #if defined COMPILE_PCRE8
1714 #elif defined COMPILE_PCRE16
1716 #elif defined COMPILE_PCRE32
1719 cb.subject_length = (
int)(
md->end_subject -
md->start_subject);
1720 cb.start_match = (
int)(mstart -
md->start_subject);
1721 cb.current_position = (
int)(eptr -
md->start_subject);
1722 cb.pattern_position = GET(ecode, 2);
1723 cb.next_item_length = GET(ecode, 2 +
LINK_SIZE);
1724 cb.capture_top = offset_top/2;
1725 cb.capture_last =
md->capture_last &
CAPLMASK;
1727 if (cb.capture_last == 0) cb.capture_last = -1;
1728 cb.callout_data =
md->callout_data;
1729 cb.mark =
md->nomatch_mark;
1758 callpat =
md->start_code + GET(ecode, 1);
1759 recno = (callpat ==
md->start_code)? 0 :
1772 new_recursive.group_num = recno;
1773 new_recursive.saved_capture_last =
md->capture_last;
1774 new_recursive.subject_position = eptr;
1775 new_recursive.prevrec =
md->recursive;
1776 md->recursive = &new_recursive;
1784 new_recursive.saved_max =
md->offset_end;
1786 new_recursive.offset_save = stacksave;
1789 new_recursive.offset_save =
1790 (
int *)(
PUBL(
malloc))(new_recursive.saved_max *
sizeof(
int));
1793 memcpy(new_recursive.offset_save,
md->offset_vector,
1794 new_recursive.saved_max *
sizeof(
int));
1801 DPRINTF((
"Recursing into group %d\n", new_recursive.group_num));
1806 RMATCH(eptr, callpat +
PRIV(OP_lengths)[*callpat], offset_top,
1808 memcpy(
md->offset_vector, new_recursive.offset_save,
1809 new_recursive.saved_max *
sizeof(
int));
1810 md->capture_last = new_recursive.saved_capture_last;
1811 md->recursive = new_recursive.prevrec;
1814 DPRINTF((
"Recursion matched\n"));
1815 if (new_recursive.offset_save != stacksave)
1816 (
PUBL(
free))(new_recursive.offset_save);
1822 eptr =
md->end_match_ptr;
1823 mstart =
md->start_match_ptr;
1824 goto RECURSION_MATCHED;
1833 if (new_recursive.offset_save != stacksave)
1834 (
PUBL(
free))(new_recursive.offset_save);
1842 DPRINTF((
"Recursion gave error %d\n", rrc));
1843 if (new_recursive.offset_save != stacksave)
1844 (
PUBL(
free))(new_recursive.offset_save);
1848 md->recursive = &new_recursive;
1849 callpat += GET(callpat, 1);
1851 while (*callpat ==
OP_ALT);
1853 DPRINTF((
"Recursion didn't match\n"));
1854 md->recursive = new_recursive.prevrec;
1855 if (new_recursive.offset_save != stacksave)
1856 (
PUBL(
free))(new_recursive.offset_save);
1867 do ecode += GET(ecode,1);
while (*ecode ==
OP_ALT);
1905 goto POSSESSIVE_NON_CAPTURE;
1913 prev = ecode - GET(ecode, 1);
1924 else saved_eptr =
NULL;
1934 md->end_match_ptr = eptr;
1935 md->end_offset_top = offset_top;
1936 md->start_match_ptr = mstart;
1955 printf(
"end bracket %d",
number);
1963 md->end_match_ptr = eptr;
1964 md->start_match_ptr = mstart;
1985 register int *iptr =
md->offset_vector + offset_top;
1986 register int *iend =
md->offset_vector +
offset;
1987 while (iptr < iend) *iptr++ = -1;
1994 md->offset_vector[
offset+1] = (
int)(eptr -
md->start_subject);
2006 md->start_match_ptr = mstart;
2007 md->end_match_ptr = eptr;
2008 md->end_offset_top = offset_top;
2021 if (*ecode ==
OP_KET || eptr == saved_eptr)
2092 if (eptr !=
md->start_subject &&
2116 if (eptr < md->end_subject)
2120 if (
md->partial != 0 &&
2121 eptr + 1 >=
md->end_subject &&
2145 if (!
md->endonly)
goto ASSERT_NL_OR_EOS;
2161 if (eptr < md->end_subject &&
2164 if (
md->partial != 0 &&
2165 eptr + 1 >=
md->end_subject &&
2198 if (eptr ==
md->start_subject) prev_is_word =
FALSE;
else
2202 if (lastptr < md->start_used_ptr)
md->start_used_ptr = lastptr;
2207 if (c ==
'_') prev_is_word =
TRUE;
else
2209 int cat = UCD_CATEGORY(c);
2210 prev_is_word = (cat ==
ucp_L || cat ==
ucp_N);
2215 prev_is_word = c < 256 && (
md->ctypes[c] &
ctype_word) != 0;
2220 if (eptr >=
md->end_subject)
2223 cur_is_word =
FALSE;
2231 if (c ==
'_') cur_is_word =
TRUE;
else
2233 int cat = UCD_CATEGORY(c);
2234 cur_is_word = (cat ==
ucp_L || cat ==
ucp_N);
2239 cur_is_word = c < 256 && (
md->ctypes[c] &
ctype_word) != 0;
2251 if (eptr ==
md->start_subject) prev_is_word =
FALSE;
else
2253 if (eptr <= md->start_used_ptr)
md->start_used_ptr = eptr - 1;
2258 if (c ==
'_') prev_is_word =
TRUE;
else
2260 int cat = UCD_CATEGORY(c);
2261 prev_is_word = (cat ==
ucp_L || cat ==
ucp_N);
2266 prev_is_word =
MAX_255(eptr[-1])
2272 if (eptr >=
md->end_subject)
2275 cur_is_word =
FALSE;
2282 if (c ==
'_') cur_is_word =
TRUE;
else
2284 int cat = UCD_CATEGORY(c);
2285 cur_is_word = (cat ==
ucp_L || cat ==
ucp_N);
2297 cur_is_word == prev_is_word : cur_is_word != prev_is_word)
2307 if (
md->partial != 0 &&
2308 eptr ==
md->end_subject - 1 &&
2322 if (eptr >=
md->end_subject)
2329 if (utf) ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);
2338 if (eptr >=
md->end_subject)
2348 if (eptr >=
md->end_subject)
2365 if (eptr >=
md->end_subject)
2382 if (eptr >=
md->end_subject)
2399 if (eptr >=
md->end_subject)
2416 if (eptr >=
md->end_subject)
2433 if (eptr >=
md->end_subject)
2450 if (eptr >=
md->end_subject)
2461 if (eptr >=
md->end_subject)
2485 if (eptr >=
md->end_subject)
2500 if (eptr >=
md->end_subject)
2515 if (eptr >=
md->end_subject)
2530 if (eptr >=
md->end_subject)
2550 if (eptr >=
md->end_subject)
2557 const pcre_uint32 *cp;
2624 cp =
PRIV(ucd_caseless_sets) + ecode[2];
2655 if (eptr >=
md->end_subject)
2664 lgb = UCD_GRAPHBREAK(c);
2665 while (eptr < md->end_subject)
2669 rgb = UCD_GRAPHBREAK(c);
2670 if ((
PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0)
break;
2715 length = (
md->jscript_compat)? 0 : -1;
2721 if (offset < offset_top && md->offset_vector[
offset] >= 0)
2726 slot +=
md->name_entry_size;
2737 length = (
md->jscript_compat)? 0 : -1;
2753 minimize = (c & 1) != 0;
2756 if (
max == 0)
max = INT_MAX;
2764 if (
max == 0)
max = INT_MAX;
2771 if (length == -2) eptr =
md->end_subject;
2785 if (length == 0)
continue;
2786 if (length < 0 &&
min == 0)
continue;
2792 for (
i = 1;
i <=
min;
i++)
2797 if (slength == -2) eptr =
md->end_subject;
2807 if (
min ==
max)
continue;
2821 if (slength == -2) eptr =
md->end_subject;
2843 if (slength == -2 &&
md->partial != 0 &&
2844 md->end_subject >
md->start_used_ptr)
2880 #define BYTE_MAP ((pcre_uint8 *)data)
2897 else possessive =
TRUE;
2900 if (
max == 0)
max = INT_MAX;
2910 if (
max == 0)
max = INT_MAX;
2924 for (
i = 1;
i <=
min;
i++)
2926 if (eptr >=
md->end_subject)
2944 for (
i = 1;
i <=
min;
i++)
2946 if (eptr >=
md->end_subject)
2952 #ifndef COMPILE_PCRE8
2966 if (
min ==
max)
continue;
2981 if (eptr >=
md->end_subject)
3004 if (eptr >=
md->end_subject)
3010 #ifndef COMPILE_PCRE8
3035 if (eptr >=
md->end_subject)
3046 if ((
BYTE_MAP[c/8] & (1 << (c&7))) == 0)
break;
3050 if (possessive)
continue;
3056 if (eptr-- <= pp)
break;
3066 if (eptr >=
md->end_subject)
3072 #ifndef COMPILE_PCRE8
3079 if ((
BYTE_MAP[c/8] & (1 << (c&7))) == 0)
break;
3083 if (possessive)
continue;
3105 #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3109 ecode += GET(ecode, 1);
3124 else possessive =
TRUE;
3127 if (
max == 0)
max = INT_MAX;
3137 if (
max == 0)
max = INT_MAX;
3148 for (
i = 1;
i <=
min;
i++)
3150 if (eptr >=
md->end_subject)
3162 if (
min ==
max)
continue;
3174 if (eptr >=
md->end_subject)
3193 if (eptr >=
md->end_subject)
3199 GETCHARLENTEST(c, eptr,
len);
3203 if (!
PRIV(xclass)(c,
data, utf))
break;
3207 if (possessive)
continue;
3213 if (eptr-- <= pp)
break;
3215 if (utf) BACKCHAR(eptr);
3234 if (length >
md->end_subject - eptr)
3245 if (
md->end_subject - eptr < 1)
3259 if (eptr >=
md->end_subject)
3279 pcre_uint32 cc =
UCHAR21(eptr);
3301 if (dc != UCD_OTHERCASE(
fc))
3379 minimize = (c & 1) != 0;
3382 if (
max == 0)
max = INT_MAX;
3416 pcre_uint32 othercase;
3418 (othercase = UCD_OTHERCASE(
fc)) !=
fc)
3419 oclength =
PRIV(ord2utf)(othercase, occhars);
3423 for (
i = 1;
i <=
min;
i++)
3425 if (eptr <= md->end_subject - length &&
3426 memcmp(eptr, charptr,
IN_UCHARS(length)) == 0) eptr += length;
3428 else if (oclength > 0 &&
3429 eptr <= md->end_subject - oclength &&
3430 memcmp(eptr, occhars,
IN_UCHARS(oclength)) == 0) eptr += oclength;
3439 if (
min ==
max)
continue;
3448 if (eptr <= md->end_subject - length &&
3449 memcmp(eptr, charptr,
IN_UCHARS(length)) == 0) eptr += length;
3451 else if (oclength > 0 &&
3452 eptr <= md->end_subject - oclength &&
3453 memcmp(eptr, occhars,
IN_UCHARS(oclength)) == 0) eptr += oclength;
3469 if (eptr <= md->end_subject - length &&
3470 memcmp(eptr, charptr,
IN_UCHARS(length)) == 0) eptr += length;
3472 else if (oclength > 0 &&
3473 eptr <= md->end_subject - oclength &&
3474 memcmp(eptr, occhars,
IN_UCHARS(oclength)) == 0) eptr += oclength;
3483 if (possessive)
continue;
3486 if (eptr <= pp)
goto TAIL_RECURSE;
3519 max, (
char *)eptr));
3523 #ifdef COMPILE_PCRE8
3529 if (utf &&
fc > 127)
3530 foc = UCD_OTHERCASE(
fc);
3532 if (utf &&
fc > 127)
3540 for (
i = 1;
i <=
min;
i++)
3543 if (eptr >=
md->end_subject)
3552 if (
min ==
max)
continue;
3561 if (eptr >=
md->end_subject)
3578 if (eptr >=
md->end_subject)
3584 if (
fc != cc &&
foc != cc)
break;
3587 if (possessive)
continue;
3590 if (eptr == pp)
goto TAIL_RECURSE;
3603 for (
i = 1;
i <=
min;
i++)
3605 if (eptr >=
md->end_subject)
3613 if (
min ==
max)
continue;
3622 if (eptr >=
md->end_subject)
3636 if (eptr >=
md->end_subject)
3644 if (possessive)
continue;
3647 if (eptr == pp)
goto TAIL_RECURSE;
3662 if (eptr >=
md->end_subject)
3670 register pcre_uint32 ch, och;
3684 och = UCD_OTHERCASE(ch);
3697 register pcre_uint32 ch = ecode[1];
3773 minimize = (c & 1) != 0;
3776 if (
max == 0)
max = INT_MAX;
3791 DPRINTF((
"negative matching %c{%d,%d} against subject %.*s\n",
fc,
min,
max,
3792 max, (
char *)eptr));
3798 if (utf &&
fc > 127)
3799 foc = UCD_OTHERCASE(
fc);
3801 if (utf &&
fc > 127)
3811 register pcre_uint32 d;
3812 for (
i = 1;
i <=
min;
i++)
3814 if (eptr >=
md->end_subject)
3827 for (
i = 1;
i <=
min;
i++)
3829 if (eptr >=
md->end_subject)
3839 if (
min ==
max)
continue;
3846 register pcre_uint32 d;
3852 if (eptr >=
md->end_subject)
3870 if (eptr >=
md->end_subject)
3891 register pcre_uint32 d;
3895 if (eptr >=
md->end_subject)
3901 if (
fc == d || (
unsigned int)
foc == d)
break;
3904 if (possessive)
continue;
3907 if (eptr <= pp)
goto TAIL_RECURSE;
3920 if (eptr >=
md->end_subject)
3925 if (
fc == *eptr ||
foc == *eptr)
break;
3928 if (possessive)
continue;
3931 if (eptr == pp)
goto TAIL_RECURSE;
3948 register pcre_uint32 d;
3949 for (
i = 1;
i <=
min;
i++)
3951 if (eptr >=
md->end_subject)
3964 for (
i = 1;
i <=
min;
i++)
3966 if (eptr >=
md->end_subject)
3975 if (
min ==
max)
continue;
3982 register pcre_uint32 d;
3988 if (eptr >=
md->end_subject)
4006 if (eptr >=
md->end_subject)
4026 register pcre_uint32 d;
4030 if (eptr >=
md->end_subject)
4039 if (possessive)
continue;
4042 if (eptr <= pp)
goto TAIL_RECURSE;
4055 if (eptr >=
md->end_subject)
4060 if (
fc == *eptr)
break;
4063 if (possessive)
continue;
4066 if (eptr == pp)
goto TAIL_RECURSE;
4130 minimize = (c & 1) != 0;
4133 if (
max == 0)
max = INT_MAX;
4146 prop_type = *ecode++;
4147 prop_value = *ecode++;
4149 else prop_type = -1;
4167 for (
i = 1;
i <=
min;
i++)
4169 if (eptr >=
md->end_subject)
4179 for (
i = 1;
i <=
min;
i++)
4182 if (eptr >=
md->end_subject)
4188 chartype = UCD_CHARTYPE(c);
4189 if ((chartype ==
ucp_Lu ||
4191 chartype ==
ucp_Lt) == prop_fail_result)
4197 for (
i = 1;
i <=
min;
i++)
4199 if (eptr >=
md->end_subject)
4205 if ((UCD_CATEGORY(c) == prop_value) == prop_fail_result)
4211 for (
i = 1;
i <=
min;
i++)
4213 if (eptr >=
md->end_subject)
4219 if ((UCD_CHARTYPE(c) == prop_value) == prop_fail_result)
4225 for (
i = 1;
i <=
min;
i++)
4227 if (eptr >=
md->end_subject)
4233 if ((UCD_SCRIPT(c) == prop_value) == prop_fail_result)
4239 for (
i = 1;
i <=
min;
i++)
4242 if (eptr >=
md->end_subject)
4248 category = UCD_CATEGORY(c);
4249 if ((category ==
ucp_L || category ==
ucp_N) == prop_fail_result)
4260 for (
i = 1;
i <=
min;
i++)
4262 if (eptr >=
md->end_subject)
4276 if ((UCD_CATEGORY(c) ==
ucp_Z) == prop_fail_result)
4284 for (
i = 1;
i <=
min;
i++)
4287 if (eptr >=
md->end_subject)
4293 category = UCD_CATEGORY(c);
4295 == prop_fail_result)
4301 for (
i = 1;
i <=
min;
i++)
4303 const pcre_uint32 *cp;
4304 if (eptr >=
md->end_subject)
4310 cp =
PRIV(ucd_caseless_sets) + prop_value;
4322 for (
i = 1;
i <=
min;
i++)
4324 if (eptr >=
md->end_subject)
4332 c >= 0xe000) == prop_fail_result)
4349 for (
i = 1;
i <=
min;
i++)
4351 if (eptr >=
md->end_subject)
4360 lgb = UCD_GRAPHBREAK(c);
4361 while (eptr < md->end_subject)
4365 rgb = UCD_GRAPHBREAK(c);
4366 if ((
PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0)
break;
4381 if (utf)
switch(ctype)
4384 for (
i = 1;
i <=
min;
i++)
4386 if (eptr >=
md->end_subject)
4392 if (
md->partial != 0 &&
4393 eptr + 1 >=
md->end_subject &&
4402 ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);
4407 for (
i = 1;
i <=
min;
i++)
4409 if (eptr >=
md->end_subject)
4415 ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);
4425 for (
i = 1;
i <=
min;
i++)
4427 if (eptr >=
md->end_subject)
4458 for (
i = 1;
i <=
min;
i++)
4460 if (eptr >=
md->end_subject)
4475 for (
i = 1;
i <=
min;
i++)
4477 if (eptr >=
md->end_subject)
4492 for (
i = 1;
i <=
min;
i++)
4494 if (eptr >=
md->end_subject)
4509 for (
i = 1;
i <=
min;
i++)
4511 if (eptr >=
md->end_subject)
4526 for (
i = 1;
i <=
min;
i++)
4528 if (eptr >=
md->end_subject)
4540 for (
i = 1;
i <=
min;
i++)
4543 if (eptr >=
md->end_subject)
4557 for (
i = 1;
i <=
min;
i++)
4560 if (eptr >=
md->end_subject)
4569 ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);
4574 for (
i = 1;
i <=
min;
i++)
4577 if (eptr >=
md->end_subject)
4591 for (
i = 1;
i <=
min;
i++)
4594 if (eptr >=
md->end_subject)
4603 ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);
4608 for (
i = 1;
i <=
min;
i++)
4611 if (eptr >=
md->end_subject)
4637 for (
i = 1;
i <=
min;
i++)
4639 if (eptr >=
md->end_subject)
4645 if (
md->partial != 0 &&
4646 eptr + 1 >=
md->end_subject &&
4659 if (eptr >
md->end_subject -
min)
4668 if (eptr >
md->end_subject -
min)
4677 for (
i = 1;
i <=
min;
i++)
4679 if (eptr >=
md->end_subject)
4689 if (eptr < md->end_subject && *eptr ==
CHAR_LF) eptr++;
4698 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
4709 for (
i = 1;
i <=
min;
i++)
4711 if (eptr >=
md->end_subject)
4720 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
4729 for (
i = 1;
i <=
min;
i++)
4731 if (eptr >=
md->end_subject)
4740 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
4749 for (
i = 1;
i <=
min;
i++)
4751 if (eptr >=
md->end_subject)
4759 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
4769 for (
i = 1;
i <=
min;
i++)
4771 if (eptr >=
md->end_subject)
4780 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
4789 for (
i = 1;
i <=
min;
i++)
4791 if (eptr >=
md->end_subject)
4803 for (
i = 1;
i <=
min;
i++)
4805 if (eptr >=
md->end_subject)
4817 for (
i = 1;
i <=
min;
i++)
4819 if (eptr >=
md->end_subject)
4831 for (
i = 1;
i <=
min;
i++)
4833 if (eptr >=
md->end_subject)
4845 for (
i = 1;
i <=
min;
i++)
4847 if (eptr >=
md->end_subject)
4859 for (
i = 1;
i <=
min;
i++)
4861 if (eptr >=
md->end_subject)
4879 if (
min ==
max)
continue;
4898 if (eptr >=
md->end_subject)
4915 if (eptr >=
md->end_subject)
4921 chartype = UCD_CHARTYPE(c);
4922 if ((chartype ==
ucp_Lu ||
4924 chartype ==
ucp_Lt) == prop_fail_result)
4935 if (eptr >=
md->end_subject)
4941 if ((UCD_CATEGORY(c) == prop_value) == prop_fail_result)
4952 if (eptr >=
md->end_subject)
4958 if ((UCD_CHARTYPE(c) == prop_value) == prop_fail_result)
4969 if (eptr >=
md->end_subject)
4975 if ((UCD_SCRIPT(c) == prop_value) == prop_fail_result)
4987 if (eptr >=
md->end_subject)
4993 category = UCD_CATEGORY(c);
4994 if ((category ==
ucp_L || category ==
ucp_N) == prop_fail_result)
5010 if (eptr >=
md->end_subject)
5024 if ((UCD_CATEGORY(c) ==
ucp_Z) == prop_fail_result)
5038 if (eptr >=
md->end_subject)
5044 category = UCD_CATEGORY(c);
5045 if ((category ==
ucp_L ||
5046 category ==
ucp_N ||
5048 == prop_fail_result)
5056 const pcre_uint32 *cp;
5060 if (eptr >=
md->end_subject)
5066 cp =
PRIV(ucd_caseless_sets) + prop_value;
5083 if (eptr >=
md->end_subject)
5091 c >= 0xe000) == prop_fail_result)
5112 if (eptr >=
md->end_subject)
5121 lgb = UCD_GRAPHBREAK(c);
5122 while (eptr < md->end_subject)
5126 rgb = UCD_GRAPHBREAK(c);
5127 if ((
PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0)
break;
5146 if (eptr >=
md->end_subject)
5157 if (
md->partial != 0 &&
5158 eptr >=
md->end_subject &&
5271 if (eptr >=
md->end_subject)
5282 if (
md->partial != 0 &&
5283 eptr >=
md->end_subject &&
5302 if (eptr < md->end_subject && *eptr ==
CHAR_LF) eptr++;
5311 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
5325 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
5337 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
5349 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
5361 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
5417 if (eptr >=
md->end_subject)
5422 GETCHARLENTEST(c, eptr,
len);
5423 if (prop_fail_result)
break;
5433 if (eptr >=
md->end_subject)
5438 GETCHARLENTEST(c, eptr,
len);
5439 chartype = UCD_CHARTYPE(c);
5440 if ((chartype ==
ucp_Lu ||
5442 chartype ==
ucp_Lt) == prop_fail_result)
5452 if (eptr >=
md->end_subject)
5457 GETCHARLENTEST(c, eptr,
len);
5458 if ((UCD_CATEGORY(c) == prop_value) == prop_fail_result)
break;
5467 if (eptr >=
md->end_subject)
5472 GETCHARLENTEST(c, eptr,
len);
5473 if ((UCD_CHARTYPE(c) == prop_value) == prop_fail_result)
break;
5482 if (eptr >=
md->end_subject)
5487 GETCHARLENTEST(c, eptr,
len);
5488 if ((UCD_SCRIPT(c) == prop_value) == prop_fail_result)
break;
5498 if (eptr >=
md->end_subject)
5503 GETCHARLENTEST(c, eptr,
len);
5504 category = UCD_CATEGORY(c);
5505 if ((category ==
ucp_L || category ==
ucp_N) == prop_fail_result)
5520 if (eptr >=
md->end_subject)
5525 GETCHARLENTEST(c, eptr,
len);
5530 if (prop_fail_result)
goto ENDLOOP99;
5534 if ((UCD_CATEGORY(c) ==
ucp_Z) == prop_fail_result)
5548 if (eptr >=
md->end_subject)
5553 GETCHARLENTEST(c, eptr,
len);
5554 category = UCD_CATEGORY(c);
5555 if ((category ==
ucp_L || category ==
ucp_N ||
5565 const pcre_uint32 *cp;
5567 if (eptr >=
md->end_subject)
5572 GETCHARLENTEST(c, eptr,
len);
5573 cp =
PRIV(ucd_caseless_sets) + prop_value;
5577 {
if (prop_fail_result)
break;
else goto GOT_MAX; }
5579 {
if (prop_fail_result)
goto GOT_MAX;
else break; }
5590 if (eptr >=
md->end_subject)
5595 GETCHARLENTEST(c, eptr,
len);
5598 c >= 0xe000) == prop_fail_result)
5610 if (possessive)
continue;
5613 if (eptr <= pp)
goto TAIL_RECURSE;
5617 if (utf) BACKCHAR(eptr);
5628 if (eptr >=
md->end_subject)
5637 lgb = UCD_GRAPHBREAK(c);
5638 while (eptr < md->end_subject)
5642 rgb = UCD_GRAPHBREAK(c);
5643 if ((
PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0)
break;
5653 if (possessive)
continue;
5665 if (eptr <= pp)
goto TAIL_RECURSE;
5674 if (!utf) c = *eptr;
else
5679 rgb = UCD_GRAPHBREAK(c);
5683 if (eptr <= pp)
goto TAIL_RECURSE;
5685 if (!utf) c = *fptr;
else
5690 lgb = UCD_GRAPHBREAK(c);
5691 if ((
PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0)
break;
5709 if (eptr >=
md->end_subject)
5715 if (
md->partial != 0 &&
5716 eptr + 1 >=
md->end_subject &&
5725 ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);
5734 if (eptr >=
md->end_subject)
5740 ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);
5745 eptr =
md->end_subject;
5754 if (c > (
unsigned int)(
md->end_subject - eptr))
5756 eptr =
md->end_subject;
5766 if (eptr >=
md->end_subject)
5774 if (++eptr >=
md->end_subject)
break;
5783 && c != 0x2028 && c != 0x2029
5798 if (eptr >=
md->end_subject)
5807 default: gotspace =
FALSE;
break;
5820 if (eptr >=
md->end_subject)
5829 default: gotspace =
FALSE;
break;
5840 if (eptr >=
md->end_subject)
5855 if (eptr >=
md->end_subject)
5870 if (eptr >=
md->end_subject)
5885 if (eptr >=
md->end_subject)
5900 if (eptr >=
md->end_subject)
5906 if (c < 256 && (
md->ctypes[c] &
ctype_word) != 0)
break;
5915 if (eptr >=
md->end_subject)
5921 if (c >= 256 || (
md->ctypes[c] &
ctype_word) == 0)
break;
5930 if (possessive)
continue;
5933 if (eptr <= pp)
goto TAIL_RECURSE;
5951 if (eptr >=
md->end_subject)
5957 if (
md->partial != 0 &&
5958 eptr + 1 >=
md->end_subject &&
5973 if (c > (
unsigned int)(
md->end_subject - eptr))
5975 eptr =
md->end_subject;
5984 if (eptr >=
md->end_subject)
5992 if (++eptr >=
md->end_subject)
break;
5999 #
if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
6000 && c != 0x2028 && c != 0x2029
6011 if (eptr >=
md->end_subject)
6018 default: eptr++;
break;
6020 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
6032 if (eptr >=
md->end_subject)
6039 default:
goto ENDLOOP01;
6041 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
6053 if (eptr >=
md->end_subject)
6060 default: eptr++;
break;
6062 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
6074 if (eptr >=
md->end_subject)
6081 default:
goto ENDLOOP03;
6083 #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
6095 if (eptr >=
md->end_subject)
6108 if (eptr >=
md->end_subject)
6121 if (eptr >=
md->end_subject)
6134 if (eptr >=
md->end_subject)
6147 if (eptr >=
md->end_subject)
6160 if (eptr >=
md->end_subject)
6174 if (possessive)
continue;
6177 if (eptr == pp)
goto TAIL_RECURSE;
6193 DPRINTF((
"Unknown opcode %d\n", *ecode));
6210 #define LBL(val) case val: goto L_RM##val;
6212 switch (frame->Xwhere)
6214 LBL( 1) LBL( 2) LBL( 3) LBL( 4) LBL( 5) LBL( 6) LBL( 7) LBL( 8)
6215 LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17)
6216 LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33)
6217 LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52)
6218 LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) LBL(63) LBL(64)
6220 #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
6225 LBL(22) LBL(23) LBL(28) LBL(30)
6226 LBL(32) LBL(34) LBL(42) LBL(46)
6228 LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45)
6229 LBL(59) LBL(60) LBL(61) LBL(62) LBL(67)
6233 DPRINTF((
"jump error in pcre match: label %d non-existent\n", frame->Xwhere));
6263 #undef new_recursive
6276 #undef save_capture_last
6308 release_match_heapframes (heapframe *frame_base)
6310 heapframe *nextframe = frame_base->Xnextframe;
6311 while (nextframe !=
NULL)
6313 heapframe *oldframe = nextframe;
6314 nextframe = nextframe->Xnextframe;
6345 #if defined COMPILE_PCRE8
6348 PCRE_SPTR subject,
int length,
int start_offset,
int options,
int *offsets,
6350 #elif defined COMPILE_PCRE16
6355 #elif defined COMPILE_PCRE32
6362 int rc, ocount, arg_offset_max;
6389 heapframe frame_zero;
6390 frame_zero.Xprevframe =
NULL;
6391 frame_zero.Xnextframe =
NULL;
6392 md->match_frames_base = &frame_zero;
6401 start_offset == -999)
6403 return -((
int)
sizeof(heapframe));
6447 if (offsetcount >= 2)
6449 offsets[0] = erroroffset;
6450 offsets[1] = errorcode;
6452 #if defined COMPILE_PCRE8
6453 return (errorcode <= PCRE_UTF8_ERR5 && md->partial > 1)?
6455 #elif defined COMPILE_PCRE16
6456 return (errorcode <= PCRE_UTF16_ERR1 && md->partial > 1)?
6458 #elif defined COMPILE_PCRE32
6462 #if defined COMPILE_PCRE8 || defined COMPILE_PCRE16
6464 if (start_offset > 0 && start_offset < length &&
6477 if (extra_data !=
NULL
6484 start_offset, options, offsets, offsetcount);
6496 md->name_table = (
pcre_uchar *)re + re->name_table_offset;
6497 md->name_count = re->name_count;
6498 md->name_entry_size = re->name_entry_size;
6530 if ((re->flags &
PCRE_MLSET) != 0 && re->limit_match <
md->match_limit)
6531 md->match_limit = re->limit_match;
6534 re->limit_recursion <
md->match_limit_recursion)
6535 md->match_limit_recursion = re->limit_recursion;
6551 md->start_code = (
const pcre_uchar *)re + re->name_table_offset +
6552 re->name_count * re->name_entry_size;
6555 md->start_offset = start_offset;
6556 md->end_subject =
md->start_subject + length;
6557 end_subject =
md->end_subject;
6562 md->ignore_skip_arg = 0;
6573 md->mark =
md->nomatch_mark =
NULL;
6660 ocount = offsetcount - (offsetcount % 3);
6661 arg_offset_max = (2*ocount)/3;
6663 if (re->top_backref > 0 && re->top_backref >= ocount/3)
6665 ocount = re->top_backref * 3 + 3;
6666 md->offset_vector = (
int *)(
PUBL(
malloc))(ocount *
sizeof(
int));
6668 using_temporary_offsets =
TRUE;
6669 DPRINTF((
"Got memory to hold back references\n"));
6671 else md->offset_vector = offsets;
6672 md->offset_end = ocount;
6673 md->offset_max = (2*ocount)/3;
6674 md->capture_last = 0;
6682 if (
md->offset_vector !=
NULL)
6684 register int *iptr =
md->offset_vector + ocount;
6685 register int *iend = iptr - re->top_bracket;
6686 if (iend < md->offset_vector + 2) iend =
md->offset_vector + 2;
6687 while (--iptr >= iend) *iptr = -1;
6688 if (offsetcount > 0)
md->offset_vector[0] = -1;
6689 if (offsetcount > 1)
md->offset_vector[1] = -1;
6702 has_first_char =
TRUE;
6703 first_char = first_char2 = (
pcre_uchar)(re->first_char);
6706 first_char2 =
TABLE_GET(first_char,
md->fcc, first_char);
6707 #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)
6708 if (utf && first_char > 127)
6709 first_char2 = UCD_OTHERCASE(first_char);
6714 if (!startline && study !=
NULL &&
6724 has_req_char =
TRUE;
6725 req_char = req_char2 = (
pcre_uchar)(re->req_char);
6728 req_char2 =
TABLE_GET(req_char,
md->fcc, req_char);
6729 #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)
6730 if (utf && req_char > 127)
6731 req_char2 = UCD_OTHERCASE(req_char);
6762 ACROSSCHAR(
t < end_subject, *
t,
t++);
6785 if (first_char != first_char2)
6786 while (start_match < end_subject &&
6787 (smc =
UCHAR21TEST(start_match)) != first_char && smc != first_char2)
6790 while (start_match < end_subject &&
UCHAR21TEST(start_match) != first_char)
6798 if (start_match >
md->start_subject + start_offset)
6803 while (start_match < end_subject && !
WAS_NEWLINE(start_match))
6806 ACROSSCHAR(start_match < end_subject, *start_match,
6812 while (start_match < end_subject && !
WAS_NEWLINE(start_match))
6819 if (start_match[-1] ==
CHAR_CR &&
6821 start_match < end_subject &&
6829 else if (start_bits !=
NULL)
6831 while (start_match < end_subject)
6833 register pcre_uint32 c =
UCHAR21TEST(start_match);
6834 #ifndef COMPILE_PCRE8
6835 if (c > 255) c = 255;
6837 if ((start_bits[c/8] & (1 << (c&7))) != 0)
break;
6845 end_subject = save_end_subject;
6858 (pcre_uint32)(end_subject - start_match) < study->
minlength)
6878 if (has_req_char && end_subject - start_match <
REQ_BYTE_MAX)
6880 register PCRE_PUCHAR p = start_match + (has_first_char? 1:0);
6885 if (p > req_char_ptr)
6887 if (req_char != req_char2)
6889 while (p < end_subject)
6892 if (pp == req_char || pp == req_char2) { p--;
break; }
6897 while (p < end_subject)
6906 if (p >= end_subject)
6922 printf(
">>>> Match against: ");
6923 pchars(start_match, end_subject - start_match,
TRUE,
md);
6930 md->start_match_ptr = start_match;
6931 md->start_used_ptr = start_match;
6932 md->match_call_count = 0;
6933 md->match_function_type = 0;
6934 md->end_offset_top = 0;
6935 md->skip_arg_count = 0;
6936 rc =
match(start_match,
md->start_code, start_match, 2,
md,
NULL, 0);
6937 if (
md->hitend && start_partial ==
NULL)
6939 start_partial =
md->start_used_ptr;
6940 match_partial = start_match;
6953 new_start_match = start_match;
6954 md->ignore_skip_arg =
md->skip_arg_count;
6961 if (
md->start_match_ptr > start_match)
6963 new_start_match =
md->start_match_ptr;
6974 md->ignore_skip_arg = 0;
6975 new_start_match = start_match + 1;
6978 ACROSSCHAR(new_start_match < end_subject, *new_start_match,
7004 if (firstline &&
IS_NEWLINE(start_match))
break;
7008 start_match = new_start_match;
7013 if (anchored || start_match > end_subject)
break;
7024 start_match < end_subject &&
7059 if (using_temporary_offsets)
7061 if (arg_offset_max >= 4)
7063 memcpy(offsets + 2,
md->offset_vector + 2,
7064 (arg_offset_max - 2) *
sizeof(
int));
7065 DPRINTF((
"Copied offsets from temporary memory\n"));
7067 if (
md->end_offset_top > arg_offset_max)
md->capture_last |=
OVFLBIT;
7068 DPRINTF((
"Freeing temporary memory\n"));
7075 rc = ((
md->capture_last &
OVFLBIT) != 0 &&
7076 md->end_offset_top >= arg_offset_max)?
7077 0 :
md->end_offset_top/2;
7088 if (
md->end_offset_top/2 <= re->top_bracket && offsets !=
NULL)
7090 register int *iptr, *iend;
7091 int resetcount = 2 + re->top_bracket * 2;
7092 if (resetcount > offsetcount) resetcount = offsetcount;
7093 iptr = offsets +
md->end_offset_top;
7094 iend = offsets + resetcount;
7095 while (iptr < iend) *iptr++ = -1;
7102 if (offsetcount < 2) rc = 0;
else
7104 offsets[0] = (
int)(
md->start_match_ptr -
md->start_subject);
7105 offsets[1] = (
int)(
md->end_match_ptr -
md->start_subject);
7112 DPRINTF((
">>>> returning %d\n", rc));
7114 release_match_heapframes(&frame_zero);
7122 if (using_temporary_offsets)
7124 DPRINTF((
"Freeing temporary memory\n"));
7132 DPRINTF((
">>>> error: returning %d\n", rc));
7134 release_match_heapframes(&frame_zero);
7141 if (match_partial !=
NULL)
7143 DPRINTF((
">>>> returning PCRE_ERROR_PARTIAL\n"));
7145 if (offsetcount > 1)
7149 if (offsetcount > 2)
7159 DPRINTF((
">>>> returning PCRE_ERROR_NOMATCH\n"));
7168 release_match_heapframes(&frame_zero);
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
unsigned int
A callback function used to compare two keys in a database.
if(yy_accept[yy_current_state])
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
int pcre16_exec(const pcre16 *, const pcre16_extra *, const unsigned short *, int, int, int, int *, int)
#define PCRE_ERROR_UNKNOWN_OPCODE
#define PCRE_ERROR_BADUTF8_OFFSET
#define PCRE_NO_UTF8_CHECK
#define PCRE_ERROR_PARTIAL
#define PCRE_EXTRA_CALLOUT_DATA
#define PCRE_ERROR_BADMODE
#define PCRE_ERROR_BADNEWLINE
#define PCRE_EXTRA_STUDY_DATA
#define PCRE_ERROR_BADOPTION
#define PCRE_ERROR_SHORTUTF8
#define PCRE_EXTRA_MATCH_LIMIT
#define PCRE_EXTRA_TABLES
#define PCRE_ERROR_JIT_BADOPTION
#define PCRE_ERROR_BADMAGIC
#define PCRE_ERROR_BADENDIANNESS
#define PCRE_ERROR_INTERNAL
#define PCRE_ERROR_RECURSIONLIMIT
#define PCRE_PARTIAL_SOFT
int pcre32_exec(const pcre32 *, const pcre32_extra *, const unsigned int *, int, int, int, int *, int)
#define PCRE_ERROR_BADCOUNT
#define PCRE_ERROR_BADUTF32
#define PCRE_NO_START_OPTIMIZE
#define PCRE_ERROR_BADUTF16
#define PCRE_EXTRA_EXECUTABLE_JIT
#define PCRE_ERROR_MATCHLIMIT
#define PCRE_ERROR_RECURSELOOP
#define PCRE_ERROR_NOMEMORY
#define PCRE_ERROR_BADLENGTH
#define PCRE_ERROR_BADOFFSET
#define PCRE_EXTRA_MATCH_LIMIT_RECURSION
#define PCRE_JAVASCRIPT_COMPAT
#define PCRE_ERROR_NOMATCH
#define PCRE_DOLLAR_ENDONLY
#define PCRE_PARTIAL_HARD
#define PCRE_NEWLINE_ANYCRLF
#define PCRE_ERROR_BADPARTIAL
#define PCRE_ERROR_BADUTF8
#define PCRE_ERROR_SHORTUTF16
#define PCRE_NOTEMPTY_ATSTART
static int match_ref(int offset, register const pcre_uchar *eptr, int length, match_data *md, BOOL caseless)
static const char rep_min[]
#define MATCH_BACKTRACK_MAX
static int match(register const pcre_uchar *eptr, register const pcre_uchar *ecode, const pcre_uchar *mstart, int offset_top, match_data *md, eptrblock *eptrb, unsigned int rdepth)
#define REC_STACK_SAVE_MAX
int pcre_exec(const pcre *argument_re, const pcre_extra *extra_data, PCRE_SPTR subject, int length, int start_offset, int options, int *offsets, int offsetcount)
static const char rep_max[]
#define MATCH_BACKTRACK_MIN
#define RMATCH(ra, rb, rc, rd, re, rw)
#define PUBLIC_EXEC_OPTIONS
#define PCRE_NEWLINE_BITS
#define VSPACE_MULTIBYTE_CASES
#define CHAR_GRAVE_ACCENT
#define PCRE_STUDY_MAPPED
#define REVERSED_MAGIC_NUMBER
#define CHAR_COMMERCIAL_AT
#define PUBLIC_JIT_EXEC_OPTIONS
#define UCHAR21TEST(eptr)
#define STRCMP_UC_UC_TEST(str1, str2)
#define PCRE_CALL_CONVENTION
#define PCRE_FCH_CASELESS
#define HSPACE_MULTIBYTE_CASES
#define PCRE_STUDY_MINLEN
#define TABLE_GET(c, table, default)
#define PCRE_RCH_CASELESS
#define UCHAR21INCTEST(eptr)
#define VSPACE_BYTE_CASES
#define GETCHARINCTEST(c, eptr)
#define HSPACE_BYTE_CASES
#define GETCHARLEN(c, eptr, len)
#define GETCHARINC(c, eptr)
static const unsigned char * tables(int mode)
static void stack_free(void *block)
static int callout(pcre_callout_block *cb)
#define MATCH_LIMIT_RECURSION
struct eptrblock * epb_prev
const pcre_uchar * epb_saved_eptr
pcre_uint8 start_bits[32]
struct recursion_info * prevrec
const pcre_uchar * subject_position