| 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-2006 University of Cambridge |
Copyright (c) 1997-2007 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 |
| 48 |
|
|
| 49 |
#include "pcre_internal.h" |
#include "pcre_internal.h" |
| 50 |
|
|
| 51 |
|
/* Undefine some potentially clashing cpp symbols */ |
| 52 |
|
|
| 53 |
|
#undef min |
| 54 |
|
#undef max |
| 55 |
|
|
| 56 |
/* The chain of eptrblocks for tail recursions uses memory in stack workspace, |
/* The chain of eptrblocks for tail recursions uses memory in stack workspace, |
| 57 |
obtained at top level, the size of which is defined by EPTR_WORK_SIZE. */ |
obtained at top level, the size of which is defined by EPTR_WORK_SIZE. */ |
| 58 |
|
|
| 188 |
obtained from malloc() instead instead of on the stack. Macros are used to |
obtained from malloc() instead instead of on the stack. Macros are used to |
| 189 |
achieve this so that the actual code doesn't look very different to what it |
achieve this so that the actual code doesn't look very different to what it |
| 190 |
always used to. |
always used to. |
| 191 |
|
|
| 192 |
|
The original heap-recursive code used longjmp(). However, it seems that this |
| 193 |
|
can be very slow on some operating systems. Following a suggestion from Stan |
| 194 |
|
Switzer, the use of longjmp() has been abolished, at the cost of having to |
| 195 |
|
provide a unique number for each call to RMATCH. There is no way of generating |
| 196 |
|
a sequence of numbers at compile time in C. I have given them names, to make |
| 197 |
|
them stand out more clearly. |
| 198 |
|
|
| 199 |
|
Crude tests on x86 Linux show a small speedup of around 5-8%. However, on |
| 200 |
|
FreeBSD, avoiding longjmp() more than halves the time taken to run the standard |
| 201 |
|
tests. Furthermore, not using longjmp() means that local dynamic variables |
| 202 |
|
don't have indeterminate values; this has meant that the frame size can be |
| 203 |
|
reduced because the result can be "passed back" by straight setting of the |
| 204 |
|
variable instead of being passed in the frame. |
| 205 |
**************************************************************************** |
**************************************************************************** |
| 206 |
***************************************************************************/ |
***************************************************************************/ |
| 207 |
|
|
| 208 |
|
|
| 209 |
|
/* Numbers for RMATCH calls */ |
| 210 |
|
|
| 211 |
|
enum { RM1=1, RM2, RM3, RM4, RM5, RM6, RM7, RM8, RM9, RM10, |
| 212 |
|
RM11, RM12, RM13, RM14, RM15, RM16, RM17, RM18, RM19, RM20, |
| 213 |
|
RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30, |
| 214 |
|
RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40, |
| 215 |
|
RM41, RM42, RM43, RM44, RM45, RM46, RM47 }; |
| 216 |
|
|
| 217 |
|
|
| 218 |
/* 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 |
| 219 |
versions and production versions. */ |
versions and production versions. Note that the "rw" argument of RMATCH isn't |
| 220 |
|
actuall used in this definition. */ |
| 221 |
|
|
| 222 |
#ifndef NO_RECURSE |
#ifndef NO_RECURSE |
| 223 |
#define REGISTER register |
#define REGISTER register |
| 224 |
|
|
| 225 |
#ifdef DEBUG |
#ifdef DEBUG |
| 226 |
#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) \ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
| 227 |
{ \ |
{ \ |
| 228 |
printf("match() called in line %d\n", __LINE__); \ |
printf("match() called in line %d\n", __LINE__); \ |
| 229 |
rx = match(ra,rb,rc,rd,re,rf,rg,rdepth+1); \ |
rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1); \ |
| 230 |
printf("to line %d\n", __LINE__); \ |
printf("to line %d\n", __LINE__); \ |
| 231 |
} |
} |
| 232 |
#define RRETURN(ra) \ |
#define RRETURN(ra) \ |
| 235 |
return ra; \ |
return ra; \ |
| 236 |
} |
} |
| 237 |
#else |
#else |
| 238 |
#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) \ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
| 239 |
rx = match(ra,rb,rc,rd,re,rf,rg,rdepth+1) |
rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1) |
| 240 |
#define RRETURN(ra) return ra |
#define RRETURN(ra) return ra |
| 241 |
#endif |
#endif |
| 242 |
|
|
| 243 |
#else |
#else |
| 244 |
|
|
| 245 |
|
|
| 246 |
/* These versions of the macros manage a private stack on the heap. Note |
/* These versions of the macros manage a private stack on the heap. Note that |
| 247 |
that the rd argument of RMATCH isn't actually used. It's the md argument of |
the "rd" argument of RMATCH isn't actually used in this definition. It's the md |
| 248 |
match(), which never changes. */ |
argument of match(), which never changes. */ |
| 249 |
|
|
| 250 |
#define REGISTER |
#define REGISTER |
| 251 |
|
|
| 252 |
#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg)\ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\ |
| 253 |
{\ |
{\ |
| 254 |
heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\ |
heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\ |
| 255 |
if (setjmp(frame->Xwhere) == 0)\ |
frame->Xwhere = rw; \ |
| 256 |
{\ |
newframe->Xeptr = ra;\ |
| 257 |
newframe->Xeptr = ra;\ |
newframe->Xecode = rb;\ |
| 258 |
newframe->Xecode = rb;\ |
newframe->Xmstart = mstart;\ |
| 259 |
newframe->Xoffset_top = rc;\ |
newframe->Xoffset_top = rc;\ |
| 260 |
newframe->Xims = re;\ |
newframe->Xims = re;\ |
| 261 |
newframe->Xeptrb = rf;\ |
newframe->Xeptrb = rf;\ |
| 262 |
newframe->Xflags = rg;\ |
newframe->Xflags = rg;\ |
| 263 |
newframe->Xrdepth = frame->Xrdepth + 1;\ |
newframe->Xrdepth = frame->Xrdepth + 1;\ |
| 264 |
newframe->Xprevframe = frame;\ |
newframe->Xprevframe = frame;\ |
| 265 |
frame = newframe;\ |
frame = newframe;\ |
| 266 |
DPRINTF(("restarting from line %d\n", __LINE__));\ |
DPRINTF(("restarting from line %d\n", __LINE__));\ |
| 267 |
goto HEAP_RECURSE;\ |
goto HEAP_RECURSE;\ |
| 268 |
}\ |
L_##rw:\ |
| 269 |
else\ |
DPRINTF(("jumped back to line %d\n", __LINE__));\ |
|
{\ |
|
|
DPRINTF(("longjumped back to line %d\n", __LINE__));\ |
|
|
frame = md->thisframe;\ |
|
|
rx = frame->Xresult;\ |
|
|
}\ |
|
| 270 |
} |
} |
| 271 |
|
|
| 272 |
#define RRETURN(ra)\ |
#define RRETURN(ra)\ |
| 276 |
(pcre_stack_free)(newframe);\ |
(pcre_stack_free)(newframe);\ |
| 277 |
if (frame != NULL)\ |
if (frame != NULL)\ |
| 278 |
{\ |
{\ |
| 279 |
frame->Xresult = ra;\ |
rrc = ra;\ |
| 280 |
md->thisframe = frame;\ |
goto HEAP_RETURN;\ |
|
longjmp(frame->Xwhere, 1);\ |
|
| 281 |
}\ |
}\ |
| 282 |
return ra;\ |
return ra;\ |
| 283 |
} |
} |
| 292 |
|
|
| 293 |
const uschar *Xeptr; |
const uschar *Xeptr; |
| 294 |
const uschar *Xecode; |
const uschar *Xecode; |
| 295 |
|
const uschar *Xmstart; |
| 296 |
int Xoffset_top; |
int Xoffset_top; |
| 297 |
long int Xims; |
long int Xims; |
| 298 |
eptrblock *Xeptrb; |
eptrblock *Xeptrb; |
| 324 |
int Xprop_category; |
int Xprop_category; |
| 325 |
int Xprop_chartype; |
int Xprop_chartype; |
| 326 |
int Xprop_script; |
int Xprop_script; |
| 327 |
|
int Xoclength; |
| 328 |
|
uschar Xocchars[8]; |
| 329 |
#endif |
#endif |
| 330 |
|
|
| 331 |
int Xctype; |
int Xctype; |
| 343 |
|
|
| 344 |
eptrblock Xnewptrb; |
eptrblock Xnewptrb; |
| 345 |
|
|
| 346 |
/* Place to pass back result, and where to jump back to */ |
/* Where to jump back to */ |
| 347 |
|
|
| 348 |
int Xresult; |
int Xwhere; |
|
jmp_buf Xwhere; |
|
| 349 |
|
|
| 350 |
} heapframe; |
} heapframe; |
| 351 |
|
|
| 373 |
Arguments: |
Arguments: |
| 374 |
eptr pointer to current character in subject |
eptr pointer to current character in subject |
| 375 |
ecode pointer to current position in compiled code |
ecode pointer to current position in compiled code |
| 376 |
|
mstart pointer to the current match start position (can be modified |
| 377 |
|
by encountering \K) |
| 378 |
offset_top current top pointer |
offset_top current top pointer |
| 379 |
md pointer to "static" info for the match |
md pointer to "static" info for the match |
| 380 |
ims current /i, /m, and /s options |
ims current /i, /m, and /s options |
| 394 |
*/ |
*/ |
| 395 |
|
|
| 396 |
static int |
static int |
| 397 |
match(REGISTER USPTR eptr, REGISTER const uschar *ecode, |
match(REGISTER USPTR eptr, REGISTER const uschar *ecode, const uschar *mstart, |
| 398 |
int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb, |
int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb, |
| 399 |
int flags, unsigned int rdepth) |
int flags, unsigned int rdepth) |
| 400 |
{ |
{ |
| 422 |
|
|
| 423 |
frame->Xeptr = eptr; |
frame->Xeptr = eptr; |
| 424 |
frame->Xecode = ecode; |
frame->Xecode = ecode; |
| 425 |
|
frame->Xmstart = mstart; |
| 426 |
frame->Xoffset_top = offset_top; |
frame->Xoffset_top = offset_top; |
| 427 |
frame->Xims = ims; |
frame->Xims = ims; |
| 428 |
frame->Xeptrb = eptrb; |
frame->Xeptrb = eptrb; |
| 437 |
|
|
| 438 |
#define eptr frame->Xeptr |
#define eptr frame->Xeptr |
| 439 |
#define ecode frame->Xecode |
#define ecode frame->Xecode |
| 440 |
|
#define mstart frame->Xmstart |
| 441 |
#define offset_top frame->Xoffset_top |
#define offset_top frame->Xoffset_top |
| 442 |
#define ims frame->Xims |
#define ims frame->Xims |
| 443 |
#define eptrb frame->Xeptrb |
#define eptrb frame->Xeptrb |
| 471 |
#define prop_category frame->Xprop_category |
#define prop_category frame->Xprop_category |
| 472 |
#define prop_chartype frame->Xprop_chartype |
#define prop_chartype frame->Xprop_chartype |
| 473 |
#define prop_script frame->Xprop_script |
#define prop_script frame->Xprop_script |
| 474 |
|
#define oclength frame->Xoclength |
| 475 |
|
#define occhars frame->Xocchars |
| 476 |
#endif |
#endif |
| 477 |
|
|
| 478 |
#define ctype frame->Xctype |
#define ctype frame->Xctype |
| 526 |
int prop_category; |
int prop_category; |
| 527 |
int prop_chartype; |
int prop_chartype; |
| 528 |
int prop_script; |
int prop_script; |
| 529 |
|
int oclength; |
| 530 |
|
uschar occhars[8]; |
| 531 |
#endif |
#endif |
| 532 |
|
|
| 533 |
int ctype; |
int ctype; |
| 568 |
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, |
| 569 |
however, impact performance when true recursion is being used. */ |
however, impact performance when true recursion is being used. */ |
| 570 |
|
|
| 571 |
|
#ifdef SUPPORT_UTF8 |
| 572 |
|
utf8 = md->utf8; /* Local copy of the flag */ |
| 573 |
|
#else |
| 574 |
|
utf8 = FALSE; |
| 575 |
|
#endif |
| 576 |
|
|
| 577 |
/* First check that we haven't called match() too many times, or that we |
/* First check that we haven't called match() too many times, or that we |
| 578 |
haven't exceeded the recursive call limit. */ |
haven't exceeded the recursive call limit. */ |
| 579 |
|
|
| 582 |
|
|
| 583 |
original_ims = ims; /* Save for resetting on ')' */ |
original_ims = ims; /* Save for resetting on ')' */ |
| 584 |
|
|
|
#ifdef SUPPORT_UTF8 |
|
|
utf8 = md->utf8; /* Local copy of the flag */ |
|
|
#else |
|
|
utf8 = FALSE; |
|
|
#endif |
|
|
|
|
| 585 |
/* At the start of a group with an unlimited repeat that may match an empty |
/* At the start of a group with an unlimited repeat that may match an empty |
| 586 |
string, the match_cbegroup flag is set. When this is the case, add the current |
string, the match_cbegroup flag is set. When this is the case, add the current |
| 587 |
subject pointer to the chain of such remembered pointers, to be checked when we |
subject pointer to the chain of such remembered pointers, to be checked when we |
| 616 |
|
|
| 617 |
if (md->partial && |
if (md->partial && |
| 618 |
eptr >= md->end_subject && |
eptr >= md->end_subject && |
| 619 |
eptr > md->start_match) |
eptr > mstart) |
| 620 |
md->hitend = TRUE; |
md->hitend = TRUE; |
| 621 |
|
|
| 622 |
switch(op) |
switch(op) |
| 660 |
flags = (op == OP_SCBRA)? match_cbegroup : 0; |
flags = (op == OP_SCBRA)? match_cbegroup : 0; |
| 661 |
do |
do |
| 662 |
{ |
{ |
| 663 |
RMATCH(rrc, eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 664 |
ims, eptrb, flags); |
ims, eptrb, flags, RM1); |
| 665 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 666 |
md->capture_last = save_capture_last; |
md->capture_last = save_capture_last; |
| 667 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 704 |
/* For non-final alternatives, continue the loop for a NOMATCH result; |
/* For non-final alternatives, continue the loop for a NOMATCH result; |
| 705 |
otherwise return. */ |
otherwise return. */ |
| 706 |
|
|
| 707 |
RMATCH(rrc, eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
| 708 |
eptrb, flags); |
eptrb, flags, RM2); |
| 709 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 710 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 711 |
} |
} |
| 746 |
|
|
| 747 |
else |
else |
| 748 |
{ |
{ |
| 749 |
RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, |
| 750 |
match_condassert); |
match_condassert, RM3); |
| 751 |
if (rrc == MATCH_MATCH) |
if (rrc == MATCH_MATCH) |
| 752 |
{ |
{ |
| 753 |
condition = TRUE; |
condition = TRUE; |
| 793 |
md->recursive = rec->prevrec; |
md->recursive = rec->prevrec; |
| 794 |
memmove(md->offset_vector, rec->offset_save, |
memmove(md->offset_vector, rec->offset_save, |
| 795 |
rec->saved_max * sizeof(int)); |
rec->saved_max * sizeof(int)); |
| 796 |
md->start_match = rec->save_start; |
mstart = rec->save_start; |
| 797 |
ims = original_ims; |
ims = original_ims; |
| 798 |
ecode = rec->after_call; |
ecode = rec->after_call; |
| 799 |
break; |
break; |
| 802 |
/* Otherwise, if PCRE_NOTEMPTY is set, fail if we have matched an empty |
/* Otherwise, if PCRE_NOTEMPTY is set, fail if we have matched an empty |
| 803 |
string - backtracking will then try other alternatives, if any. */ |
string - backtracking will then try other alternatives, if any. */ |
| 804 |
|
|
| 805 |
if (md->notempty && eptr == md->start_match) RRETURN(MATCH_NOMATCH); |
if (md->notempty && eptr == mstart) RRETURN(MATCH_NOMATCH); |
| 806 |
md->end_match_ptr = eptr; /* Record where we ended */ |
md->end_match_ptr = eptr; /* Record where we ended */ |
| 807 |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
| 808 |
|
md->start_match_ptr = mstart; /* and the start (\K can modify) */ |
| 809 |
RRETURN(MATCH_MATCH); |
RRETURN(MATCH_MATCH); |
| 810 |
|
|
| 811 |
/* Change option settings */ |
/* Change option settings */ |
| 826 |
case OP_ASSERTBACK: |
case OP_ASSERTBACK: |
| 827 |
do |
do |
| 828 |
{ |
{ |
| 829 |
RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0); |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
| 830 |
|
RM4); |
| 831 |
if (rrc == MATCH_MATCH) break; |
if (rrc == MATCH_MATCH) break; |
| 832 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 833 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 853 |
case OP_ASSERTBACK_NOT: |
case OP_ASSERTBACK_NOT: |
| 854 |
do |
do |
| 855 |
{ |
{ |
| 856 |
RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0); |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
| 857 |
|
RM5); |
| 858 |
if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH); |
if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH); |
| 859 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 860 |
ecode += GET(ecode,1); |
ecode += GET(ecode,1); |
| 911 |
cb.offset_vector = md->offset_vector; |
cb.offset_vector = md->offset_vector; |
| 912 |
cb.subject = (PCRE_SPTR)md->start_subject; |
cb.subject = (PCRE_SPTR)md->start_subject; |
| 913 |
cb.subject_length = md->end_subject - md->start_subject; |
cb.subject_length = md->end_subject - md->start_subject; |
| 914 |
cb.start_match = md->start_match - md->start_subject; |
cb.start_match = mstart - md->start_subject; |
| 915 |
cb.current_position = eptr - md->start_subject; |
cb.current_position = eptr - md->start_subject; |
| 916 |
cb.pattern_position = GET(ecode, 2); |
cb.pattern_position = GET(ecode, 2); |
| 917 |
cb.next_item_length = GET(ecode, 2 + LINK_SIZE); |
cb.next_item_length = GET(ecode, 2 + LINK_SIZE); |
| 973 |
|
|
| 974 |
memcpy(new_recursive.offset_save, md->offset_vector, |
memcpy(new_recursive.offset_save, md->offset_vector, |
| 975 |
new_recursive.saved_max * sizeof(int)); |
new_recursive.saved_max * sizeof(int)); |
| 976 |
new_recursive.save_start = md->start_match; |
new_recursive.save_start = mstart; |
| 977 |
md->start_match = eptr; |
mstart = eptr; |
| 978 |
|
|
| 979 |
/* 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 |
| 980 |
restore the offset and recursion data. */ |
restore the offset and recursion data. */ |
| 983 |
flags = (*callpat >= OP_SBRA)? match_cbegroup : 0; |
flags = (*callpat >= OP_SBRA)? match_cbegroup : 0; |
| 984 |
do |
do |
| 985 |
{ |
{ |
| 986 |
RMATCH(rrc, eptr, callpat + _pcre_OP_lengths[*callpat], offset_top, |
RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top, |
| 987 |
md, ims, eptrb, flags); |
md, ims, eptrb, flags, RM6); |
| 988 |
if (rrc == MATCH_MATCH) |
if (rrc == MATCH_MATCH) |
| 989 |
{ |
{ |
| 990 |
DPRINTF(("Recursion matched\n")); |
DPRINTF(("Recursion matched\n")); |
| 1027 |
|
|
| 1028 |
do |
do |
| 1029 |
{ |
{ |
| 1030 |
RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, |
| 1031 |
eptrb, 0); |
eptrb, 0, RM7); |
| 1032 |
if (rrc == MATCH_MATCH) break; |
if (rrc == MATCH_MATCH) break; |
| 1033 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1034 |
ecode += GET(ecode,1); |
ecode += GET(ecode,1); |
| 1073 |
|
|
| 1074 |
if (*ecode == OP_KETRMIN) |
if (*ecode == OP_KETRMIN) |
| 1075 |
{ |
{ |
| 1076 |
RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, |
| 1077 |
|
RM8); |
| 1078 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1079 |
ecode = prev; |
ecode = prev; |
| 1080 |
flags = match_tail_recursed; |
flags = match_tail_recursed; |
| 1082 |
} |
} |
| 1083 |
else /* OP_KETRMAX */ |
else /* OP_KETRMAX */ |
| 1084 |
{ |
{ |
| 1085 |
RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_cbegroup); |
RMATCH(eptr, prev, offset_top, md, ims, eptrb, match_cbegroup, RM9); |
| 1086 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1087 |
ecode += 1 + LINK_SIZE; |
ecode += 1 + LINK_SIZE; |
| 1088 |
flags = match_tail_recursed; |
flags = match_tail_recursed; |
| 1106 |
case OP_BRAZERO: |
case OP_BRAZERO: |
| 1107 |
{ |
{ |
| 1108 |
next = ecode+1; |
next = ecode+1; |
| 1109 |
RMATCH(rrc, eptr, next, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, next, offset_top, md, ims, eptrb, 0, RM10); |
| 1110 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1111 |
do next += GET(next,1); while (*next == OP_ALT); |
do next += GET(next,1); while (*next == OP_ALT); |
| 1112 |
ecode = next + 1 + LINK_SIZE; |
ecode = next + 1 + LINK_SIZE; |
| 1117 |
{ |
{ |
| 1118 |
next = ecode+1; |
next = ecode+1; |
| 1119 |
do next += GET(next, 1); while (*next == OP_ALT); |
do next += GET(next, 1); while (*next == OP_ALT); |
| 1120 |
RMATCH(rrc, eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0, RM11); |
| 1121 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1122 |
ecode++; |
ecode++; |
| 1123 |
} |
} |
| 1187 |
recursion_info *rec = md->recursive; |
recursion_info *rec = md->recursive; |
| 1188 |
DPRINTF(("Recursion (%d) succeeded - continuing\n", number)); |
DPRINTF(("Recursion (%d) succeeded - continuing\n", number)); |
| 1189 |
md->recursive = rec->prevrec; |
md->recursive = rec->prevrec; |
| 1190 |
md->start_match = rec->save_start; |
mstart = rec->save_start; |
| 1191 |
memcpy(md->offset_vector, rec->offset_save, |
memcpy(md->offset_vector, rec->offset_save, |
| 1192 |
rec->saved_max * sizeof(int)); |
rec->saved_max * sizeof(int)); |
| 1193 |
ecode = rec->after_call; |
ecode = rec->after_call; |
| 1222 |
|
|
| 1223 |
if (*ecode == OP_KETRMIN) |
if (*ecode == OP_KETRMIN) |
| 1224 |
{ |
{ |
| 1225 |
RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0, |
| 1226 |
|
RM12); |
| 1227 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1228 |
ecode = prev; |
ecode = prev; |
| 1229 |
flags |= match_tail_recursed; |
flags |= match_tail_recursed; |
| 1231 |
} |
} |
| 1232 |
else /* OP_KETRMAX */ |
else /* OP_KETRMAX */ |
| 1233 |
{ |
{ |
| 1234 |
RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, flags); |
RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM13); |
| 1235 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1236 |
ecode += 1 + LINK_SIZE; |
ecode += 1 + LINK_SIZE; |
| 1237 |
flags = match_tail_recursed; |
flags = match_tail_recursed; |
| 1267 |
ecode++; |
ecode++; |
| 1268 |
break; |
break; |
| 1269 |
|
|
| 1270 |
|
/* Reset the start of match point */ |
| 1271 |
|
|
| 1272 |
|
case OP_SET_SOM: |
| 1273 |
|
mstart = eptr; |
| 1274 |
|
ecode++; |
| 1275 |
|
break; |
| 1276 |
|
|
| 1277 |
/* Assert before internal newline if multiline, or before a terminating |
/* Assert before internal newline if multiline, or before a terminating |
| 1278 |
newline unless endonly is set, else end of subject unless noteol is set. */ |
newline unless endonly is set, else end of subject unless noteol is set. */ |
| 1279 |
|
|
| 1482 |
ecode++; |
ecode++; |
| 1483 |
break; |
break; |
| 1484 |
|
|
| 1485 |
|
case OP_NOT_HSPACE: |
| 1486 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 1487 |
|
GETCHARINCTEST(c, eptr); |
| 1488 |
|
switch(c) |
| 1489 |
|
{ |
| 1490 |
|
default: break; |
| 1491 |
|
case 0x09: /* HT */ |
| 1492 |
|
case 0x20: /* SPACE */ |
| 1493 |
|
case 0xa0: /* NBSP */ |
| 1494 |
|
case 0x1680: /* OGHAM SPACE MARK */ |
| 1495 |
|
case 0x180e: /* MONGOLIAN VOWEL SEPARATOR */ |
| 1496 |
|
case 0x2000: /* EN QUAD */ |
| 1497 |
|
case 0x2001: /* EM QUAD */ |
| 1498 |
|
case 0x2002: /* EN SPACE */ |
| 1499 |
|
case 0x2003: /* EM SPACE */ |
| 1500 |
|
case 0x2004: /* THREE-PER-EM SPACE */ |
| 1501 |
|
case 0x2005: /* FOUR-PER-EM SPACE */ |
| 1502 |
|
case 0x2006: /* SIX-PER-EM SPACE */ |
| 1503 |
|
case 0x2007: /* FIGURE SPACE */ |
| 1504 |
|
case 0x2008: /* PUNCTUATION SPACE */ |
| 1505 |
|
case 0x2009: /* THIN SPACE */ |
| 1506 |
|
case 0x200A: /* HAIR SPACE */ |
| 1507 |
|
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 1508 |
|
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 1509 |
|
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 1510 |
|
RRETURN(MATCH_NOMATCH); |
| 1511 |
|
} |
| 1512 |
|
ecode++; |
| 1513 |
|
break; |
| 1514 |
|
|
| 1515 |
|
case OP_HSPACE: |
| 1516 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 1517 |
|
GETCHARINCTEST(c, eptr); |
| 1518 |
|
switch(c) |
| 1519 |
|
{ |
| 1520 |
|
default: RRETURN(MATCH_NOMATCH); |
| 1521 |
|
case 0x09: /* HT */ |
| 1522 |
|
case 0x20: /* SPACE */ |
| 1523 |
|
case 0xa0: /* NBSP */ |
| 1524 |
|
case 0x1680: /* OGHAM SPACE MARK */ |
| 1525 |
|
case 0x180e: /* MONGOLIAN VOWEL SEPARATOR */ |
| 1526 |
|
case 0x2000: /* EN QUAD */ |
| 1527 |
|
case 0x2001: /* EM QUAD */ |
| 1528 |
|
case 0x2002: /* EN SPACE */ |
| 1529 |
|
case 0x2003: /* EM SPACE */ |
| 1530 |
|
case 0x2004: /* THREE-PER-EM SPACE */ |
| 1531 |
|
case 0x2005: /* FOUR-PER-EM SPACE */ |
| 1532 |
|
case 0x2006: /* SIX-PER-EM SPACE */ |
| 1533 |
|
case 0x2007: /* FIGURE SPACE */ |
| 1534 |
|
case 0x2008: /* PUNCTUATION SPACE */ |
| 1535 |
|
case 0x2009: /* THIN SPACE */ |
| 1536 |
|
case 0x200A: /* HAIR SPACE */ |
| 1537 |
|
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 1538 |
|
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 1539 |
|
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 1540 |
|
break; |
| 1541 |
|
} |
| 1542 |
|
ecode++; |
| 1543 |
|
break; |
| 1544 |
|
|
| 1545 |
|
case OP_NOT_VSPACE: |
| 1546 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 1547 |
|
GETCHARINCTEST(c, eptr); |
| 1548 |
|
switch(c) |
| 1549 |
|
{ |
| 1550 |
|
default: break; |
| 1551 |
|
case 0x0a: /* LF */ |
| 1552 |
|
case 0x0b: /* VT */ |
| 1553 |
|
case 0x0c: /* FF */ |
| 1554 |
|
case 0x0d: /* CR */ |
| 1555 |
|
case 0x85: /* NEL */ |
| 1556 |
|
case 0x2028: /* LINE SEPARATOR */ |
| 1557 |
|
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 1558 |
|
RRETURN(MATCH_NOMATCH); |
| 1559 |
|
} |
| 1560 |
|
ecode++; |
| 1561 |
|
break; |
| 1562 |
|
|
| 1563 |
|
case OP_VSPACE: |
| 1564 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 1565 |
|
GETCHARINCTEST(c, eptr); |
| 1566 |
|
switch(c) |
| 1567 |
|
{ |
| 1568 |
|
default: RRETURN(MATCH_NOMATCH); |
| 1569 |
|
case 0x0a: /* LF */ |
| 1570 |
|
case 0x0b: /* VT */ |
| 1571 |
|
case 0x0c: /* FF */ |
| 1572 |
|
case 0x0d: /* CR */ |
| 1573 |
|
case 0x85: /* NEL */ |
| 1574 |
|
case 0x2028: /* LINE SEPARATOR */ |
| 1575 |
|
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 1576 |
|
break; |
| 1577 |
|
} |
| 1578 |
|
ecode++; |
| 1579 |
|
break; |
| 1580 |
|
|
| 1581 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 1582 |
/* Check the next character by Unicode property. We will get here only |
/* Check the next character by Unicode property. We will get here only |
| 1583 |
if the support is in the binary; otherwise a compile-time error occurs. */ |
if the support is in the binary; otherwise a compile-time error occurs. */ |
| 1733 |
{ |
{ |
| 1734 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 1735 |
{ |
{ |
| 1736 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14); |
| 1737 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1738 |
if (fi >= max || !match_ref(offset, eptr, length, md, ims)) |
if (fi >= max || !match_ref(offset, eptr, length, md, ims)) |
| 1739 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
| 1754 |
} |
} |
| 1755 |
while (eptr >= pp) |
while (eptr >= pp) |
| 1756 |
{ |
{ |
| 1757 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM15); |
| 1758 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1759 |
eptr -= length; |
eptr -= length; |
| 1760 |
} |
} |
| 1859 |
{ |
{ |
| 1860 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 1861 |
{ |
{ |
| 1862 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16); |
| 1863 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1864 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 1865 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 1879 |
{ |
{ |
| 1880 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 1881 |
{ |
{ |
| 1882 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17); |
| 1883 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1884 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 1885 |
c = *eptr++; |
c = *eptr++; |
| 1916 |
} |
} |
| 1917 |
for (;;) |
for (;;) |
| 1918 |
{ |
{ |
| 1919 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM18); |
| 1920 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1921 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 1922 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 1935 |
} |
} |
| 1936 |
while (eptr >= pp) |
while (eptr >= pp) |
| 1937 |
{ |
{ |
| 1938 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM19); |
| 1939 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1940 |
eptr--; |
eptr--; |
| 1941 |
} |
} |
| 2006 |
{ |
{ |
| 2007 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 2008 |
{ |
{ |
| 2009 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20); |
| 2010 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2011 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 2012 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 2030 |
} |
} |
| 2031 |
for(;;) |
for(;;) |
| 2032 |
{ |
{ |
| 2033 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM21); |
| 2034 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2035 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 2036 |
BACKCHAR(eptr) |
BACKCHAR(eptr) |
| 2187 |
|
|
| 2188 |
if (length > 1) |
if (length > 1) |
| 2189 |
{ |
{ |
|
int oclength = 0; |
|
|
uschar occhars[8]; |
|
|
|
|
| 2190 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2191 |
unsigned int othercase; |
unsigned int othercase; |
| 2192 |
if ((ims & PCRE_CASELESS) != 0 && |
if ((ims & PCRE_CASELESS) != 0 && |
| 2193 |
(othercase = _pcre_ucp_othercase(fc)) != NOTACHAR) |
(othercase = _pcre_ucp_othercase(fc)) != NOTACHAR) |
| 2194 |
oclength = _pcre_ord2utf8(othercase, occhars); |
oclength = _pcre_ord2utf8(othercase, occhars); |
| 2195 |
|
else oclength = 0; |
| 2196 |
#endif /* SUPPORT_UCP */ |
#endif /* SUPPORT_UCP */ |
| 2197 |
|
|
| 2198 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
| 2199 |
{ |
{ |
| 2200 |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
| 2201 |
|
#ifdef SUPPORT_UCP |
| 2202 |
/* Need braces because of following else */ |
/* Need braces because of following else */ |
| 2203 |
else if (oclength == 0) { RRETURN(MATCH_NOMATCH); } |
else if (oclength == 0) { RRETURN(MATCH_NOMATCH); } |
| 2204 |
else |
else |
| 2206 |
if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH); |
if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH); |
| 2207 |
eptr += oclength; |
eptr += oclength; |
| 2208 |
} |
} |
| 2209 |
|
#else /* without SUPPORT_UCP */ |
| 2210 |
|
else { RRETURN(MATCH_NOMATCH); } |
| 2211 |
|
#endif /* SUPPORT_UCP */ |
| 2212 |
} |
} |
| 2213 |
|
|
| 2214 |
if (min == max) continue; |
if (min == max) continue; |
| 2217 |
{ |
{ |
| 2218 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 2219 |
{ |
{ |
| 2220 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22); |
| 2221 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2222 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 2223 |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
| 2224 |
|
#ifdef SUPPORT_UCP |
| 2225 |
/* Need braces because of following else */ |
/* Need braces because of following else */ |
| 2226 |
else if (oclength == 0) { RRETURN(MATCH_NOMATCH); } |
else if (oclength == 0) { RRETURN(MATCH_NOMATCH); } |
| 2227 |
else |
else |
| 2229 |
if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH); |
if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH); |
| 2230 |
eptr += oclength; |
eptr += oclength; |
| 2231 |
} |
} |
| 2232 |
|
#else /* without SUPPORT_UCP */ |
| 2233 |
|
else { RRETURN (MATCH_NOMATCH); } |
| 2234 |
|
#endif /* SUPPORT_UCP */ |
| 2235 |
} |
} |
| 2236 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2237 |
} |
} |
| 2243 |
{ |
{ |
| 2244 |
if (eptr > md->end_subject - length) break; |
if (eptr > md->end_subject - length) break; |
| 2245 |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
if (memcmp(eptr, charptr, length) == 0) eptr += length; |
| 2246 |
|
#ifdef SUPPORT_UCP |
| 2247 |
else if (oclength == 0) break; |
else if (oclength == 0) break; |
| 2248 |
else |
else |
| 2249 |
{ |
{ |
| 2250 |
if (memcmp(eptr, occhars, oclength) != 0) break; |
if (memcmp(eptr, occhars, oclength) != 0) break; |
| 2251 |
eptr += oclength; |
eptr += oclength; |
| 2252 |
} |
} |
| 2253 |
|
#else /* without SUPPORT_UCP */ |
| 2254 |
|
else break; |
| 2255 |
|
#endif /* SUPPORT_UCP */ |
| 2256 |
} |
} |
| 2257 |
|
|
| 2258 |
if (possessive) continue; |
if (possessive) continue; |
| 2259 |
while (eptr >= pp) |
for(;;) |
| 2260 |
{ |
{ |
| 2261 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23); |
| 2262 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2263 |
|
if (eptr == pp) RRETURN(MATCH_NOMATCH); |
| 2264 |
|
#ifdef SUPPORT_UCP |
| 2265 |
|
eptr--; |
| 2266 |
|
BACKCHAR(eptr); |
| 2267 |
|
#else /* without SUPPORT_UCP */ |
| 2268 |
eptr -= length; |
eptr -= length; |
| 2269 |
|
#endif /* SUPPORT_UCP */ |
| 2270 |
} |
} |
|
RRETURN(MATCH_NOMATCH); |
|
| 2271 |
} |
} |
| 2272 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2273 |
} |
} |
| 2307 |
{ |
{ |
| 2308 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 2309 |
{ |
{ |
| 2310 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24); |
| 2311 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2312 |
if (fi >= max || eptr >= md->end_subject || |
if (fi >= max || eptr >= md->end_subject || |
| 2313 |
fc != md->lcc[*eptr++]) |
fc != md->lcc[*eptr++]) |
| 2326 |
if (possessive) continue; |
if (possessive) continue; |
| 2327 |
while (eptr >= pp) |
while (eptr >= pp) |
| 2328 |
{ |
{ |
| 2329 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM25); |
| 2330 |
eptr--; |
eptr--; |
| 2331 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2332 |
} |
} |
| 2345 |
{ |
{ |
| 2346 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 2347 |
{ |
{ |
| 2348 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26); |
| 2349 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2350 |
if (fi >= max || eptr >= md->end_subject || fc != *eptr++) |
if (fi >= max || eptr >= md->end_subject || fc != *eptr++) |
| 2351 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
| 2363 |
if (possessive) continue; |
if (possessive) continue; |
| 2364 |
while (eptr >= pp) |
while (eptr >= pp) |
| 2365 |
{ |
{ |
| 2366 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM27); |
| 2367 |
eptr--; |
eptr--; |
| 2368 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2369 |
} |
} |
| 2508 |
register unsigned int d; |
register unsigned int d; |
| 2509 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 2510 |
{ |
{ |
| 2511 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28); |
| 2512 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2513 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 2514 |
if (d < 256) d = md->lcc[d]; |
if (d < 256) d = md->lcc[d]; |
| 2522 |
{ |
{ |
| 2523 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 2524 |
{ |
{ |
| 2525 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29); |
| 2526 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2527 |
if (fi >= max || eptr >= md->end_subject || fc == md->lcc[*eptr++]) |
if (fi >= max || eptr >= md->end_subject || fc == md->lcc[*eptr++]) |
| 2528 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
| 2554 |
if (possessive) continue; |
if (possessive) continue; |
| 2555 |
for(;;) |
for(;;) |
| 2556 |
{ |
{ |
| 2557 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM30); |
| 2558 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2559 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 2560 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 2572 |
if (possessive) continue; |
if (possessive) continue; |
| 2573 |
while (eptr >= pp) |
while (eptr >= pp) |
| 2574 |
{ |
{ |
| 2575 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM31); |
| 2576 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2577 |
eptr--; |
eptr--; |
| 2578 |
} |
} |
| 2617 |
register unsigned int d; |
register unsigned int d; |
| 2618 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 2619 |
{ |
{ |
| 2620 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32); |
| 2621 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2622 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 2623 |
if (fi >= max || eptr >= md->end_subject || fc == d) |
if (fi >= max || eptr >= md->end_subject || fc == d) |
| 2630 |
{ |
{ |
| 2631 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 2632 |
{ |
{ |
| 2633 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33); |
| 2634 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2635 |
if (fi >= max || eptr >= md->end_subject || fc == *eptr++) |
if (fi >= max || eptr >= md->end_subject || fc == *eptr++) |
| 2636 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
| 2661 |
if (possessive) continue; |
if (possessive) continue; |
| 2662 |
for(;;) |
for(;;) |
| 2663 |
{ |
{ |
| 2664 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM34); |
| 2665 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2666 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 2667 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 2679 |
if (possessive) continue; |
if (possessive) continue; |
| 2680 |
while (eptr >= pp) |
while (eptr >= pp) |
| 2681 |
{ |
{ |
| 2682 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM35); |
| 2683 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2684 |
eptr--; |
eptr--; |
| 2685 |
} |
} |
| 2910 |
} |
} |
| 2911 |
break; |
break; |
| 2912 |
|
|
| 2913 |
|
case OP_NOT_HSPACE: |
| 2914 |
|
for (i = 1; i <= min; i++) |
| 2915 |
|
{ |
| 2916 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 2917 |
|
GETCHARINC(c, eptr); |
| 2918 |
|
switch(c) |
| 2919 |
|
{ |
| 2920 |
|
default: break; |
| 2921 |
|
case 0x09: /* HT */ |
| 2922 |
|
case 0x20: /* SPACE */ |
| 2923 |
|
case 0xa0: /* NBSP */ |
| 2924 |
|
case 0x1680: /* OGHAM SPACE MARK */ |
| 2925 |
|
case 0x180e: /* MONGOLIAN VOWEL SEPARATOR */ |
| 2926 |
|
case 0x2000: /* EN QUAD */ |
| 2927 |
|
case 0x2001: /* EM QUAD */ |
| 2928 |
|
case 0x2002: /* EN SPACE */ |
| 2929 |
|
case 0x2003: /* EM SPACE */ |
| 2930 |
|
case 0x2004: /* THREE-PER-EM SPACE */ |
| 2931 |
|
case 0x2005: /* FOUR-PER-EM SPACE */ |
| 2932 |
|
case 0x2006: /* SIX-PER-EM SPACE */ |
| 2933 |
|
case 0x2007: /* FIGURE SPACE */ |
| 2934 |
|
case 0x2008: /* PUNCTUATION SPACE */ |
| 2935 |
|
case 0x2009: /* THIN SPACE */ |
| 2936 |
|
case 0x200A: /* HAIR SPACE */ |
| 2937 |
|
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 2938 |
|
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 2939 |
|
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 2940 |
|
RRETURN(MATCH_NOMATCH); |
| 2941 |
|
} |
| 2942 |
|
} |
| 2943 |
|
break; |
| 2944 |
|
|
| 2945 |
|
case OP_HSPACE: |
| 2946 |
|
for (i = 1; i <= min; i++) |
| 2947 |
|
{ |
| 2948 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 2949 |
|
GETCHARINC(c, eptr); |
| 2950 |
|
switch(c) |
| 2951 |
|
{ |
| 2952 |
|
default: RRETURN(MATCH_NOMATCH); |
| 2953 |
|
case 0x09: /* HT */ |
| 2954 |
|
case 0x20: /* SPACE */ |
| 2955 |
|
case 0xa0: /* NBSP */ |
| 2956 |
|
case 0x1680: /* OGHAM SPACE MARK */ |
| 2957 |
|
case 0x180e: /* MONGOLIAN VOWEL SEPARATOR */ |
| 2958 |
|
case 0x2000: /* EN QUAD */ |
| 2959 |
|
case 0x2001: /* EM QUAD */ |
| 2960 |
|
case 0x2002: /* EN SPACE */ |
| 2961 |
|
case 0x2003: /* EM SPACE */ |
| 2962 |
|
case 0x2004: /* THREE-PER-EM SPACE */ |
| 2963 |
|
case 0x2005: /* FOUR-PER-EM SPACE */ |
| 2964 |
|
case 0x2006: /* SIX-PER-EM SPACE */ |
| 2965 |
|
case 0x2007: /* FIGURE SPACE */ |
| 2966 |
|
case 0x2008: /* PUNCTUATION SPACE */ |
| 2967 |
|
case 0x2009: /* THIN SPACE */ |
| 2968 |
|
case 0x200A: /* HAIR SPACE */ |
| 2969 |
|
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 2970 |
|
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 2971 |
|
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 2972 |
|
break; |
| 2973 |
|
} |
| 2974 |
|
} |
| 2975 |
|
break; |
| 2976 |
|
|
| 2977 |
|
case OP_NOT_VSPACE: |
| 2978 |
|
for (i = 1; i <= min; i++) |
| 2979 |
|
{ |
| 2980 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 2981 |
|
GETCHARINC(c, eptr); |
| 2982 |
|
switch(c) |
| 2983 |
|
{ |
| 2984 |
|
default: break; |
| 2985 |
|
case 0x0a: /* LF */ |
| 2986 |
|
case 0x0b: /* VT */ |
| 2987 |
|
case 0x0c: /* FF */ |
| 2988 |
|
case 0x0d: /* CR */ |
| 2989 |
|
case 0x85: /* NEL */ |
| 2990 |
|
case 0x2028: /* LINE SEPARATOR */ |
| 2991 |
|
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 2992 |
|
RRETURN(MATCH_NOMATCH); |
| 2993 |
|
} |
| 2994 |
|
} |
| 2995 |
|
break; |
| 2996 |
|
|
| 2997 |
|
case OP_VSPACE: |
| 2998 |
|
for (i = 1; i <= min; i++) |
| 2999 |
|
{ |
| 3000 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3001 |
|
GETCHARINC(c, eptr); |
| 3002 |
|
switch(c) |
| 3003 |
|
{ |
| 3004 |
|
default: RRETURN(MATCH_NOMATCH); |
| 3005 |
|
case 0x0a: /* LF */ |
| 3006 |
|
case 0x0b: /* VT */ |
| 3007 |
|
case 0x0c: /* FF */ |
| 3008 |
|
case 0x0d: /* CR */ |
| 3009 |
|
case 0x85: /* NEL */ |
| 3010 |
|
case 0x2028: /* LINE SEPARATOR */ |
| 3011 |
|
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 3012 |
|
break; |
| 3013 |
|
} |
| 3014 |
|
} |
| 3015 |
|
break; |
| 3016 |
|
|
| 3017 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 3018 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
| 3019 |
{ |
{ |
| 3125 |
} |
} |
| 3126 |
break; |
break; |
| 3127 |
|
|
| 3128 |
|
case OP_NOT_HSPACE: |
| 3129 |
|
for (i = 1; i <= min; i++) |
| 3130 |
|
{ |
| 3131 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3132 |
|
switch(*eptr++) |
| 3133 |
|
{ |
| 3134 |
|
default: break; |
| 3135 |
|
case 0x09: /* HT */ |
| 3136 |
|
case 0x20: /* SPACE */ |
| 3137 |
|
case 0xa0: /* NBSP */ |
| 3138 |
|
RRETURN(MATCH_NOMATCH); |
| 3139 |
|
} |
| 3140 |
|
} |
| 3141 |
|
break; |
| 3142 |
|
|
| 3143 |
|
case OP_HSPACE: |
| 3144 |
|
for (i = 1; i <= min; i++) |
| 3145 |
|
{ |
| 3146 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3147 |
|
switch(*eptr++) |
| 3148 |
|
{ |
| 3149 |
|
default: RRETURN(MATCH_NOMATCH); |
| 3150 |
|
case 0x09: /* HT */ |
| 3151 |
|
case 0x20: /* SPACE */ |
| 3152 |
|
case 0xa0: /* NBSP */ |
| 3153 |
|
break; |
| 3154 |
|
} |
| 3155 |
|
} |
| 3156 |
|
break; |
| 3157 |
|
|
| 3158 |
|
case OP_NOT_VSPACE: |
| 3159 |
|
for (i = 1; i <= min; i++) |
| 3160 |
|
{ |
| 3161 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3162 |
|
switch(*eptr++) |
| 3163 |
|
{ |
| 3164 |
|
default: break; |
| 3165 |
|
case 0x0a: /* LF */ |
| 3166 |
|
case 0x0b: /* VT */ |
| 3167 |
|
case 0x0c: /* FF */ |
| 3168 |
|
case 0x0d: /* CR */ |
| 3169 |
|
case 0x85: /* NEL */ |
| 3170 |
|
RRETURN(MATCH_NOMATCH); |
| 3171 |
|
} |
| 3172 |
|
} |
| 3173 |
|
break; |
| 3174 |
|
|
| 3175 |
|
case OP_VSPACE: |
| 3176 |
|
for (i = 1; i <= min; i++) |
| 3177 |
|
{ |
| 3178 |
|
if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3179 |
|
switch(*eptr++) |
| 3180 |
|
{ |
| 3181 |
|
default: RRETURN(MATCH_NOMATCH); |
| 3182 |
|
case 0x0a: /* LF */ |
| 3183 |
|
case 0x0b: /* VT */ |
| 3184 |
|
case 0x0c: /* FF */ |
| 3185 |
|
case 0x0d: /* CR */ |
| 3186 |
|
case 0x85: /* NEL */ |
| 3187 |
|
break; |
| 3188 |
|
} |
| 3189 |
|
} |
| 3190 |
|
break; |
| 3191 |
|
|
| 3192 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 3193 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
| 3194 |
if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
| 3244 |
case PT_ANY: |
case PT_ANY: |
| 3245 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 3246 |
{ |
{ |
| 3247 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36); |
| 3248 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3249 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3250 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3255 |
case PT_LAMP: |
case PT_LAMP: |
| 3256 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 3257 |
{ |
{ |
| 3258 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37); |
| 3259 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3260 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3261 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3270 |
case PT_GC: |
case PT_GC: |
| 3271 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 3272 |
{ |
{ |
| 3273 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38); |
| 3274 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3275 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3276 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3283 |
case PT_PC: |
case PT_PC: |
| 3284 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 3285 |
{ |
{ |
| 3286 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39); |
| 3287 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3288 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3289 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3296 |
case PT_SC: |
case PT_SC: |
| 3297 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 3298 |
{ |
{ |
| 3299 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40); |
| 3300 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3301 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3302 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3318 |
{ |
{ |
| 3319 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 3320 |
{ |
{ |
| 3321 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41); |
| 3322 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3323 |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH); |
| 3324 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3347 |
{ |
{ |
| 3348 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 3349 |
{ |
{ |
| 3350 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42); |
| 3351 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3352 |
if (fi >= max || eptr >= md->end_subject || |
if (fi >= max || eptr >= md->end_subject || |
| 3353 |
(ctype == OP_ANY && (ims & PCRE_DOTALL) == 0 && |
(ctype == OP_ANY && (ims & PCRE_DOTALL) == 0 && |
| 3380 |
} |
} |
| 3381 |
break; |
break; |
| 3382 |
|
|
| 3383 |
|
case OP_NOT_HSPACE: |
| 3384 |
|
switch(c) |
| 3385 |
|
{ |
| 3386 |
|
default: break; |
| 3387 |
|
case 0x09: /* HT */ |
| 3388 |
|
case 0x20: /* SPACE */ |
| 3389 |
|
case 0xa0: /* NBSP */ |
| 3390 |
|
case 0x1680: /* OGHAM SPACE MARK */ |
| 3391 |
|
case 0x180e: /* MONGOLIAN VOWEL SEPARATOR */ |
| 3392 |
|
case 0x2000: /* EN QUAD */ |
| 3393 |
|
case 0x2001: /* EM QUAD */ |
| 3394 |
|
case 0x2002: /* EN SPACE */ |
| 3395 |
|
case 0x2003: /* EM SPACE */ |
| 3396 |
|
case 0x2004: /* THREE-PER-EM SPACE */ |
| 3397 |
|
case 0x2005: /* FOUR-PER-EM SPACE */ |
| 3398 |
|
case 0x2006: /* SIX-PER-EM SPACE */ |
| 3399 |
|
case 0x2007: /* FIGURE SPACE */ |
| 3400 |
|
case 0x2008: /* PUNCTUATION SPACE */ |
| 3401 |
|
case 0x2009: /* THIN SPACE */ |
| 3402 |
|
case 0x200A: /* HAIR SPACE */ |
| 3403 |
|
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 3404 |
|
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 3405 |
|
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 3406 |
|
RRETURN(MATCH_NOMATCH); |
| 3407 |
|
} |
| 3408 |
|
break; |
| 3409 |
|
|
| 3410 |
|
case OP_HSPACE: |
| 3411 |
|
switch(c) |
| 3412 |
|
{ |
| 3413 |
|
default: RRETURN(MATCH_NOMATCH); |
| 3414 |
|
case 0x09: /* HT */ |
| 3415 |
|
case 0x20: /* SPACE */ |
| 3416 |
|
case 0xa0: /* NBSP */ |
| 3417 |
|
case 0x1680: /* OGHAM SPACE MARK */ |
| 3418 |
|
case 0x180e: /* MONGOLIAN VOWEL SEPARATOR */ |
| 3419 |
|
case 0x2000: /* EN QUAD */ |
| 3420 |
|
case 0x2001: /* EM QUAD */ |
| 3421 |
|
case 0x2002: /* EN SPACE */ |
| 3422 |
|
case 0x2003: /* EM SPACE */ |
| 3423 |
|
case 0x2004: /* THREE-PER-EM SPACE */ |
| 3424 |
|
case 0x2005: /* FOUR-PER-EM SPACE */ |
| 3425 |
|
case 0x2006: /* SIX-PER-EM SPACE */ |
| 3426 |
|
case 0x2007: /* FIGURE SPACE */ |
| 3427 |
|
case 0x2008: /* PUNCTUATION SPACE */ |
| 3428 |
|
case 0x2009: /* THIN SPACE */ |
| 3429 |
|
case 0x200A: /* HAIR SPACE */ |
| 3430 |
|
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 3431 |
|
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 3432 |
|
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 3433 |
|
break; |
| 3434 |
|
} |
| 3435 |
|
break; |
| 3436 |
|
|
| 3437 |
|
case OP_NOT_VSPACE: |
| 3438 |
|
switch(c) |
| 3439 |
|
{ |
| 3440 |
|
default: break; |
| 3441 |
|
case 0x0a: /* LF */ |
| 3442 |
|
case 0x0b: /* VT */ |
| 3443 |
|
case 0x0c: /* FF */ |
| 3444 |
|
case 0x0d: /* CR */ |
| 3445 |
|
case 0x85: /* NEL */ |
| 3446 |
|
case 0x2028: /* LINE SEPARATOR */ |
| 3447 |
|
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 3448 |
|
RRETURN(MATCH_NOMATCH); |
| 3449 |
|
} |
| 3450 |
|
break; |
| 3451 |
|
|
| 3452 |
|
case OP_VSPACE: |
| 3453 |
|
switch(c) |
| 3454 |
|
{ |
| 3455 |
|
default: RRETURN(MATCH_NOMATCH); |
| 3456 |
|
case 0x0a: /* LF */ |
| 3457 |
|
case 0x0b: /* VT */ |
| 3458 |
|
case 0x0c: /* FF */ |
| 3459 |
|
case 0x0d: /* CR */ |
| 3460 |
|
case 0x85: /* NEL */ |
| 3461 |
|
case 0x2028: /* LINE SEPARATOR */ |
| 3462 |
|
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 3463 |
|
break; |
| 3464 |
|
} |
| 3465 |
|
break; |
| 3466 |
|
|
| 3467 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 3468 |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) |
| 3469 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
| 3505 |
{ |
{ |
| 3506 |
for (fi = min;; fi++) |
for (fi = min;; fi++) |
| 3507 |
{ |
{ |
| 3508 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43); |
| 3509 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3510 |
if (fi >= max || eptr >= md->end_subject || |
if (fi >= max || eptr >= md->end_subject || |
| 3511 |
((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr))) |
((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr))) |
| 3535 |
} |
} |
| 3536 |
break; |
break; |
| 3537 |
|
|
| 3538 |
|
case OP_NOT_HSPACE: |
| 3539 |
|
switch(c) |
| 3540 |
|
{ |
| 3541 |
|
default: break; |
| 3542 |
|
case 0x09: /* HT */ |
| 3543 |
|
case 0x20: /* SPACE */ |
| 3544 |
|
case 0xa0: /* NBSP */ |
| 3545 |
|
RRETURN(MATCH_NOMATCH); |
| 3546 |
|
} |
| 3547 |
|
break; |
| 3548 |
|
|
| 3549 |
|
case OP_HSPACE: |
| 3550 |
|
switch(c) |
| 3551 |
|
{ |
| 3552 |
|
default: RRETURN(MATCH_NOMATCH); |
| 3553 |
|
case 0x09: /* HT */ |
| 3554 |
|
case 0x20: /* SPACE */ |
| 3555 |
|
case 0xa0: /* NBSP */ |
| 3556 |
|
break; |
| 3557 |
|
} |
| 3558 |
|
break; |
| 3559 |
|
|
| 3560 |
|
case OP_NOT_VSPACE: |
| 3561 |
|
switch(c) |
| 3562 |
|
{ |
| 3563 |
|
default: break; |
| 3564 |
|
case 0x0a: /* LF */ |
| 3565 |
|
case 0x0b: /* VT */ |
| 3566 |
|
case 0x0c: /* FF */ |
| 3567 |
|
case 0x0d: /* CR */ |
| 3568 |
|
case 0x85: /* NEL */ |
| 3569 |
|
RRETURN(MATCH_NOMATCH); |
| 3570 |
|
} |
| 3571 |
|
break; |
| 3572 |
|
|
| 3573 |
|
case OP_VSPACE: |
| 3574 |
|
switch(c) |
| 3575 |
|
{ |
| 3576 |
|
default: RRETURN(MATCH_NOMATCH); |
| 3577 |
|
case 0x0a: /* LF */ |
| 3578 |
|
case 0x0b: /* VT */ |
| 3579 |
|
case 0x0c: /* FF */ |
| 3580 |
|
case 0x0d: /* CR */ |
| 3581 |
|
case 0x85: /* NEL */ |
| 3582 |
|
break; |
| 3583 |
|
} |
| 3584 |
|
break; |
| 3585 |
|
|
| 3586 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 3587 |
if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
| 3588 |
break; |
break; |
| 3699 |
if (possessive) continue; |
if (possessive) continue; |
| 3700 |
for(;;) |
for(;;) |
| 3701 |
{ |
{ |
| 3702 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM44); |
| 3703 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3704 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 3705 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 3735 |
if (possessive) continue; |
if (possessive) continue; |
| 3736 |
for(;;) |
for(;;) |
| 3737 |
{ |
{ |
| 3738 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM45); |
| 3739 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3740 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 3741 |
for (;;) /* Move back over one extended */ |
for (;;) /* Move back over one extended */ |
| 3844 |
} |
} |
| 3845 |
break; |
break; |
| 3846 |
|
|
| 3847 |
|
case OP_NOT_HSPACE: |
| 3848 |
|
case OP_HSPACE: |
| 3849 |
|
for (i = min; i < max; i++) |
| 3850 |
|
{ |
| 3851 |
|
BOOL gotspace; |
| 3852 |
|
int len = 1; |
| 3853 |
|
if (eptr >= md->end_subject) break; |
| 3854 |
|
GETCHARLEN(c, eptr, len); |
| 3855 |
|
switch(c) |
| 3856 |
|
{ |
| 3857 |
|
default: gotspace = FALSE; break; |
| 3858 |
|
case 0x09: /* HT */ |
| 3859 |
|
case 0x20: /* SPACE */ |
| 3860 |
|
case 0xa0: /* NBSP */ |
| 3861 |
|
case 0x1680: /* OGHAM SPACE MARK */ |
| 3862 |
|
case 0x180e: /* MONGOLIAN VOWEL SEPARATOR */ |
| 3863 |
|
case 0x2000: /* EN QUAD */ |
| 3864 |
|
case 0x2001: /* EM QUAD */ |
| 3865 |
|
case 0x2002: /* EN SPACE */ |
| 3866 |
|
case 0x2003: /* EM SPACE */ |
| 3867 |
|
case 0x2004: /* THREE-PER-EM SPACE */ |
| 3868 |
|
case 0x2005: /* FOUR-PER-EM SPACE */ |
| 3869 |
|
case 0x2006: /* SIX-PER-EM SPACE */ |
| 3870 |
|
case 0x2007: /* FIGURE SPACE */ |
| 3871 |
|
case 0x2008: /* PUNCTUATION SPACE */ |
| 3872 |
|
case 0x2009: /* THIN SPACE */ |
| 3873 |
|
case 0x200A: /* HAIR SPACE */ |
| 3874 |
|
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 3875 |
|
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 3876 |
|
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 3877 |
|
gotspace = TRUE; |
| 3878 |
|
break; |
| 3879 |
|
} |
| 3880 |
|
if (gotspace == (ctype == OP_NOT_HSPACE)) break; |
| 3881 |
|
eptr += len; |
| 3882 |
|
} |
| 3883 |
|
break; |
| 3884 |
|
|
| 3885 |
|
case OP_NOT_VSPACE: |
| 3886 |
|
case OP_VSPACE: |
| 3887 |
|
for (i = min; i < max; i++) |
| 3888 |
|
{ |
| 3889 |
|
BOOL gotspace; |
| 3890 |
|
int len = 1; |
| 3891 |
|
if (eptr >= md->end_subject) break; |
| 3892 |
|
GETCHARLEN(c, eptr, len); |
| 3893 |
|
switch(c) |
| 3894 |
|
{ |
| 3895 |
|
default: gotspace = FALSE; break; |
| 3896 |
|
case 0x0a: /* LF */ |
| 3897 |
|
case 0x0b: /* VT */ |
| 3898 |
|
case 0x0c: /* FF */ |
| 3899 |
|
case 0x0d: /* CR */ |
| 3900 |
|
case 0x85: /* NEL */ |
| 3901 |
|
case 0x2028: /* LINE SEPARATOR */ |
| 3902 |
|
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 3903 |
|
gotspace = TRUE; |
| 3904 |
|
break; |
| 3905 |
|
} |
| 3906 |
|
if (gotspace == (ctype == OP_NOT_VSPACE)) break; |
| 3907 |
|
eptr += len; |
| 3908 |
|
} |
| 3909 |
|
break; |
| 3910 |
|
|
| 3911 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 3912 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 3913 |
{ |
{ |
| 3983 |
if (possessive) continue; |
if (possessive) continue; |
| 3984 |
for(;;) |
for(;;) |
| 3985 |
{ |
{ |
| 3986 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM46); |
| 3987 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3988 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 3989 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 4034 |
} |
} |
| 4035 |
break; |
break; |
| 4036 |
|
|
| 4037 |
|
case OP_NOT_HSPACE: |
| 4038 |
|
for (i = min; i < max; i++) |
| 4039 |
|
{ |
| 4040 |
|
if (eptr >= md->end_subject) break; |
| 4041 |
|
c = *eptr; |
| 4042 |
|
if (c == 0x09 || c == 0x20 || c == 0xa0) break; |
| 4043 |
|
eptr++; |
| 4044 |
|
} |
| 4045 |
|
break; |
| 4046 |
|
|
| 4047 |
|
case OP_HSPACE: |
| 4048 |
|
for (i = min; i < max; i++) |
| 4049 |
|
{ |
| 4050 |
|
if (eptr >= md->end_subject) break; |
| 4051 |
|
c = *eptr; |
| 4052 |
|
if (c != 0x09 && c != 0x20 && c != 0xa0) break; |
| 4053 |
|
eptr++; |
| 4054 |
|
} |
| 4055 |
|
break; |
| 4056 |
|
|
| 4057 |
|
case OP_NOT_VSPACE: |
| 4058 |
|
for (i = min; i < max; i++) |
| 4059 |
|
{ |
| 4060 |
|
if (eptr >= md->end_subject) break; |
| 4061 |
|
c = *eptr; |
| 4062 |
|
if (c == 0x0a || c == 0x0b || c == 0x0c || c == 0x0d || c == 0x85) |
| 4063 |
|
break; |
| 4064 |
|
eptr++; |
| 4065 |
|
} |
| 4066 |
|
break; |
| 4067 |
|
|
| 4068 |
|
case OP_VSPACE: |
| 4069 |
|
for (i = min; i < max; i++) |
| 4070 |
|
{ |
| 4071 |
|
if (eptr >= md->end_subject) break; |
| 4072 |
|
c = *eptr; |
| 4073 |
|
if (c != 0x0a && c != 0x0b && c != 0x0c && c != 0x0d && c != 0x85) |
| 4074 |
|
break; |
| 4075 |
|
eptr++; |
| 4076 |
|
} |
| 4077 |
|
break; |
| 4078 |
|
|
| 4079 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 4080 |
for (i = min; i < max; i++) |
for (i = min; i < max; i++) |
| 4081 |
{ |
{ |
| 4139 |
if (possessive) continue; |
if (possessive) continue; |
| 4140 |
while (eptr >= pp) |
while (eptr >= pp) |
| 4141 |
{ |
{ |
| 4142 |
RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM47); |
| 4143 |
eptr--; |
eptr--; |
| 4144 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4145 |
} |
} |
| 4165 |
|
|
| 4166 |
} /* End of main loop */ |
} /* End of main loop */ |
| 4167 |
/* Control never reaches here */ |
/* Control never reaches here */ |
| 4168 |
|
|
| 4169 |
|
|
| 4170 |
|
/* When compiling to use the heap rather than the stack for recursive calls to |
| 4171 |
|
match(), the RRETURN() macro jumps here. The number that is saved in |
| 4172 |
|
frame->Xwhere indicates which label we actually want to return to. */ |
| 4173 |
|
|
| 4174 |
|
#ifdef NO_RECURSE |
| 4175 |
|
#define LBL(val) case val: goto L_RM##val; |
| 4176 |
|
HEAP_RETURN: |
| 4177 |
|
switch (frame->Xwhere) |
| 4178 |
|
{ |
| 4179 |
|
LBL( 1) LBL( 2) LBL( 3) LBL( 4) LBL( 5) LBL( 6) LBL( 7) LBL( 8) |
| 4180 |
|
LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(16) |
| 4181 |
|
LBL(17) LBL(18) LBL(19) LBL(20) LBL(21) LBL(22) LBL(23) LBL(24) |
| 4182 |
|
LBL(25) LBL(26) LBL(27) LBL(28) LBL(29) LBL(30) LBL(31) LBL(32) |
| 4183 |
|
LBL(33) LBL(34) LBL(35) LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) |
| 4184 |
|
LBL(41) LBL(42) LBL(43) LBL(44) LBL(45) LBL(46) LBL(47) |
| 4185 |
|
default: |
| 4186 |
|
DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere)); |
| 4187 |
|
return PCRE_ERROR_INTERNAL; |
| 4188 |
|
} |
| 4189 |
|
#undef LBL |
| 4190 |
|
#endif /* NO_RECURSE */ |
| 4191 |
} |
} |
| 4192 |
|
|
| 4193 |
|
|
| 4200 |
#ifdef NO_RECURSE |
#ifdef NO_RECURSE |
| 4201 |
#undef eptr |
#undef eptr |
| 4202 |
#undef ecode |
#undef ecode |
| 4203 |
|
#undef mstart |
| 4204 |
#undef offset_top |
#undef offset_top |
| 4205 |
#undef ims |
#undef ims |
| 4206 |
#undef eptrb |
#undef eptrb |
| 4273 |
< -1 => some kind of unexpected problem |
< -1 => some kind of unexpected problem |
| 4274 |
*/ |
*/ |
| 4275 |
|
|
| 4276 |
PCRE_DATA_SCOPE int |
PCRE_EXP_DEFN int |
| 4277 |
pcre_exec(const pcre *argument_re, const pcre_extra *extra_data, |
pcre_exec(const pcre *argument_re, const pcre_extra *extra_data, |
| 4278 |
PCRE_SPTR subject, int length, int start_offset, int options, int *offsets, |
PCRE_SPTR subject, int length, int start_offset, int options, int *offsets, |
| 4279 |
int offsetcount) |
int offsetcount) |
| 4389 |
md->lcc = tables + lcc_offset; |
md->lcc = tables + lcc_offset; |
| 4390 |
md->ctypes = tables + ctypes_offset; |
md->ctypes = tables + ctypes_offset; |
| 4391 |
|
|
| 4392 |
/* Handle different types of newline. The two bits give four cases. If nothing |
/* Handle different types of newline. The three bits give eight cases. If |
| 4393 |
is set at run time, whatever was used at compile time applies. */ |
nothing is set at run time, whatever was used at compile time applies. */ |
| 4394 |
|
|
| 4395 |
switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : options) & |
switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : (pcre_uint32)options) & |
| 4396 |
PCRE_NEWLINE_BITS) |
PCRE_NEWLINE_BITS) |
| 4397 |
{ |
{ |
| 4398 |
case 0: newline = NEWLINE; break; /* Compile-time default */ |
case 0: newline = NEWLINE; break; /* Compile-time default */ |
| 4401 |
case PCRE_NEWLINE_CR+ |
case PCRE_NEWLINE_CR+ |
| 4402 |
PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break; |
PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break; |
| 4403 |
case PCRE_NEWLINE_ANY: newline = -1; break; |
case PCRE_NEWLINE_ANY: newline = -1; break; |
| 4404 |
|
case PCRE_NEWLINE_ANYCRLF: newline = -2; break; |
| 4405 |
default: return PCRE_ERROR_BADNEWLINE; |
default: return PCRE_ERROR_BADNEWLINE; |
| 4406 |
} |
} |
| 4407 |
|
|
| 4408 |
if (newline < 0) |
if (newline == -2) |
| 4409 |
|
{ |
| 4410 |
|
md->nltype = NLTYPE_ANYCRLF; |
| 4411 |
|
} |
| 4412 |
|
else if (newline < 0) |
| 4413 |
{ |
{ |
| 4414 |
md->nltype = NLTYPE_ANY; |
md->nltype = NLTYPE_ANY; |
| 4415 |
} |
} |
| 4584 |
{ |
{ |
| 4585 |
while (start_match <= end_subject && !WAS_NEWLINE(start_match)) |
while (start_match <= end_subject && !WAS_NEWLINE(start_match)) |
| 4586 |
start_match++; |
start_match++; |
| 4587 |
|
|
| 4588 |
|
/* If we have just passed a CR and the newline option is ANY or ANYCRLF, |
| 4589 |
|
and we are now at a LF, advance the match position by one more character. |
| 4590 |
|
*/ |
| 4591 |
|
|
| 4592 |
|
if (start_match[-1] == '\r' && |
| 4593 |
|
(md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) && |
| 4594 |
|
start_match < end_subject && |
| 4595 |
|
*start_match == '\n') |
| 4596 |
|
start_match++; |
| 4597 |
} |
} |
| 4598 |
} |
} |
| 4599 |
|
|
| 4680 |
|
|
| 4681 |
/* OK, we can now run the match. */ |
/* OK, we can now run the match. */ |
| 4682 |
|
|
| 4683 |
md->start_match = start_match; |
md->start_match_ptr = start_match; /* Insurance */ |
| 4684 |
md->match_call_count = 0; |
md->match_call_count = 0; |
| 4685 |
md->eptrn = 0; /* Next free eptrchain slot */ |
md->eptrn = 0; /* Next free eptrchain slot */ |
| 4686 |
rc = match(start_match, md->start_code, 2, md, ims, NULL, 0, 0); |
rc = match(start_match, md->start_code, start_match, 2, md, |
| 4687 |
|
ims, NULL, 0, 0); |
| 4688 |
|
|
| 4689 |
/* Any return other than MATCH_NOMATCH breaks the loop. */ |
/* Any return other than MATCH_NOMATCH breaks the loop. */ |
| 4690 |
|
|
| 4710 |
|
|
| 4711 |
if (anchored || start_match > end_subject) break; |
if (anchored || start_match > end_subject) break; |
| 4712 |
|
|
| 4713 |
/* If we have just passed a CR and the newline option is CRLF or ANY, and we |
/* If we have just passed a CR and the newline option is CRLF or ANY or |
| 4714 |
are now at a LF, advance the match position by one more character. */ |
ANYCRLF, and we are now at a LF, advance the match position by one more |
| 4715 |
|
character. */ |
| 4716 |
|
|
| 4717 |
if (start_match[-1] == '\r' && |
if (start_match[-1] == '\r' && |
| 4718 |
(md->nltype == NLTYPE_ANY || md->nllen == 2) && |
(md->nltype == NLTYPE_ANY || |
| 4719 |
|
md->nltype == NLTYPE_ANYCRLF || |
| 4720 |
|
md->nllen == 2) && |
| 4721 |
start_match < end_subject && |
start_match < end_subject && |
| 4722 |
*start_match == '\n') |
*start_match == '\n') |
| 4723 |
start_match++; |
start_match++; |
| 4764 |
|
|
| 4765 |
rc = md->offset_overflow? 0 : md->end_offset_top/2; |
rc = md->offset_overflow? 0 : md->end_offset_top/2; |
| 4766 |
|
|
| 4767 |
/* If there is space, set up the whole thing as substring 0. */ |
/* If there is space, set up the whole thing as substring 0. The value of |
| 4768 |
|
md->start_match_ptr might be modified if \K was encountered on the success |
| 4769 |
|
matching path. */ |
| 4770 |
|
|
| 4771 |
if (offsetcount < 2) rc = 0; else |
if (offsetcount < 2) rc = 0; else |
| 4772 |
{ |
{ |
| 4773 |
offsets[0] = start_match - md->start_subject; |
offsets[0] = md->start_match_ptr - md->start_subject; |
| 4774 |
offsets[1] = md->end_match_ptr - md->start_subject; |
offsets[1] = md->end_match_ptr - md->start_subject; |
| 4775 |
} |
} |
| 4776 |
|
|