| 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-2010 University of Cambridge |
Copyright (c) 1997-2011 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 |
| 71 |
/* Special internal returns from the match() function. Make them sufficiently |
/* Special internal returns from the match() function. Make them sufficiently |
| 72 |
negative to avoid the external error codes. */ |
negative to avoid the external error codes. */ |
| 73 |
|
|
| 74 |
#define MATCH_COMMIT (-999) |
#define MATCH_ACCEPT (-999) |
| 75 |
#define MATCH_PRUNE (-998) |
#define MATCH_COMMIT (-998) |
| 76 |
#define MATCH_SKIP (-997) |
#define MATCH_PRUNE (-997) |
| 77 |
#define MATCH_THEN (-996) |
#define MATCH_SKIP (-996) |
| 78 |
|
#define MATCH_SKIP_ARG (-995) |
| 79 |
|
#define MATCH_THEN (-994) |
| 80 |
|
|
| 81 |
|
/* This is a convenience macro for code that occurs many times. */ |
| 82 |
|
|
| 83 |
|
#define MRRETURN(ra) \ |
| 84 |
|
{ \ |
| 85 |
|
md->mark = markptr; \ |
| 86 |
|
RRETURN(ra); \ |
| 87 |
|
} |
| 88 |
|
|
| 89 |
/* Maximum number of ints of offset to save on the stack for recursive calls. |
/* Maximum number of ints of offset to save on the stack for recursive calls. |
| 90 |
If the offset vector is bigger, malloc is used. This should be a multiple of 3, |
If the offset vector is bigger, malloc is used. This should be a multiple of 3, |
| 132 |
* Match a back-reference * |
* Match a back-reference * |
| 133 |
*************************************************/ |
*************************************************/ |
| 134 |
|
|
| 135 |
/* If a back reference hasn't been set, the length that is passed is greater |
/* Normally, if a back reference hasn't been set, the length that is passed is |
| 136 |
than the number of characters left in the string, so the match fails. |
negative, so the match always fails. However, in JavaScript compatibility mode, |
| 137 |
|
the length passed is zero. Note that in caseless UTF-8 mode, the number of |
| 138 |
|
subject bytes matched may be different to the number of reference bytes. |
| 139 |
|
|
| 140 |
Arguments: |
Arguments: |
| 141 |
offset index into the offset vector |
offset index into the offset vector |
| 142 |
eptr points into the subject |
eptr pointer into the subject |
| 143 |
length length to be matched |
length length of reference to be matched (number of bytes) |
| 144 |
md points to match data block |
md points to match data block |
| 145 |
ims the ims flags |
ims the ims flags |
| 146 |
|
|
| 147 |
Returns: TRUE if matched |
Returns: < 0 if not matched, otherwise the number of subject bytes matched |
| 148 |
*/ |
*/ |
| 149 |
|
|
| 150 |
static BOOL |
static int |
| 151 |
match_ref(int offset, register USPTR eptr, int length, match_data *md, |
match_ref(int offset, register USPTR eptr, int length, match_data *md, |
| 152 |
unsigned long int ims) |
unsigned long int ims) |
| 153 |
{ |
{ |
| 154 |
USPTR p = md->start_subject + md->offset_vector[offset]; |
USPTR eptr_start = eptr; |
| 155 |
|
register USPTR p = md->start_subject + md->offset_vector[offset]; |
| 156 |
|
|
| 157 |
#ifdef PCRE_DEBUG |
#ifdef PCRE_DEBUG |
| 158 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 167 |
printf("\n"); |
printf("\n"); |
| 168 |
#endif |
#endif |
| 169 |
|
|
| 170 |
/* Always fail if not enough characters left */ |
/* Always fail if reference not set (and not JavaScript compatible). */ |
| 171 |
|
|
| 172 |
if (length > md->end_subject - eptr) return FALSE; |
if (length < 0) return -1; |
| 173 |
|
|
| 174 |
/* Separate the caseless case for speed. In UTF-8 mode we can only do this |
/* Separate the caseless case for speed. In UTF-8 mode we can only do this |
| 175 |
properly if Unicode properties are supported. Otherwise, we can check only |
properly if Unicode properties are supported. Otherwise, we can check only |
| 181 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 182 |
if (md->utf8) |
if (md->utf8) |
| 183 |
{ |
{ |
| 184 |
USPTR endptr = eptr + length; |
/* Match characters up to the end of the reference. NOTE: the number of |
| 185 |
while (eptr < endptr) |
bytes matched may differ, because there are some characters whose upper and |
| 186 |
|
lower case versions code as different numbers of bytes. For example, U+023A |
| 187 |
|
(2 bytes in UTF-8) is the upper case version of U+2C65 (3 bytes in UTF-8); |
| 188 |
|
a sequence of 3 of the former uses 6 bytes, as does a sequence of two of |
| 189 |
|
the latter. It is important, therefore, to check the length along the |
| 190 |
|
reference, not along the subject (earlier code did this wrong). */ |
| 191 |
|
|
| 192 |
|
USPTR endptr = p + length; |
| 193 |
|
while (p < endptr) |
| 194 |
{ |
{ |
| 195 |
int c, d; |
int c, d; |
| 196 |
|
if (eptr >= md->end_subject) return -1; |
| 197 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 198 |
GETCHARINC(d, p); |
GETCHARINC(d, p); |
| 199 |
if (c != d && c != UCD_OTHERCASE(d)) return FALSE; |
if (c != d && c != UCD_OTHERCASE(d)) return -1; |
| 200 |
} |
} |
| 201 |
} |
} |
| 202 |
else |
else |
| 205 |
|
|
| 206 |
/* The same code works when not in UTF-8 mode and in UTF-8 mode when there |
/* The same code works when not in UTF-8 mode and in UTF-8 mode when there |
| 207 |
is no UCP support. */ |
is no UCP support. */ |
| 208 |
|
{ |
| 209 |
while (length-- > 0) |
if (eptr + length > md->end_subject) return -1; |
| 210 |
{ if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE; } |
while (length-- > 0) |
| 211 |
|
{ if (md->lcc[*p++] != md->lcc[*eptr++]) return -1; } |
| 212 |
|
} |
| 213 |
} |
} |
| 214 |
|
|
| 215 |
/* In the caseful case, we can just compare the bytes, whether or not we |
/* In the caseful case, we can just compare the bytes, whether or not we |
| 216 |
are in UTF-8 mode. */ |
are in UTF-8 mode. */ |
| 217 |
|
|
| 218 |
else |
else |
| 219 |
{ while (length-- > 0) if (*p++ != *eptr++) return FALSE; } |
{ |
| 220 |
|
if (eptr + length > md->end_subject) return -1; |
| 221 |
|
while (length-- > 0) if (*p++ != *eptr++) return -1; |
| 222 |
|
} |
| 223 |
|
|
| 224 |
return TRUE; |
return eptr - eptr_start; |
| 225 |
} |
} |
| 226 |
|
|
| 227 |
|
|
| 272 |
RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30, |
RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30, |
| 273 |
RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40, |
RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40, |
| 274 |
RM41, RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50, |
RM41, RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50, |
| 275 |
RM51, RM52, RM53, RM54 }; |
RM51, RM52, RM53, RM54, RM55, RM56, RM57, RM58, RM59, RM60, |
| 276 |
|
RM61, RM62 }; |
| 277 |
|
|
| 278 |
/* 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 |
| 279 |
versions and production versions. Note that the "rw" argument of RMATCH isn't |
versions and production versions. Note that the "rw" argument of RMATCH isn't |
| 280 |
actuall used in this definition. */ |
actually used in this definition. */ |
| 281 |
|
|
| 282 |
#ifndef NO_RECURSE |
#ifndef NO_RECURSE |
| 283 |
#define REGISTER register |
#define REGISTER register |
| 286 |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
| 287 |
{ \ |
{ \ |
| 288 |
printf("match() called in line %d\n", __LINE__); \ |
printf("match() called in line %d\n", __LINE__); \ |
| 289 |
rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1); \ |
rrc = match(ra,rb,mstart,markptr,rc,rd,re,rf,rg,rdepth+1); \ |
| 290 |
printf("to line %d\n", __LINE__); \ |
printf("to line %d\n", __LINE__); \ |
| 291 |
} |
} |
| 292 |
#define RRETURN(ra) \ |
#define RRETURN(ra) \ |
| 296 |
} |
} |
| 297 |
#else |
#else |
| 298 |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
| 299 |
rrc = match(ra,rb,mstart,rc,rd,re,rf,rg,rdepth+1) |
rrc = match(ra,rb,mstart,markptr,rc,rd,re,rf,rg,rdepth+1) |
| 300 |
#define RRETURN(ra) return ra |
#define RRETURN(ra) return ra |
| 301 |
#endif |
#endif |
| 302 |
|
|
| 311 |
|
|
| 312 |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\ |
| 313 |
{\ |
{\ |
| 314 |
heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\ |
heapframe *newframe = (heapframe *)(pcre_stack_malloc)(sizeof(heapframe));\ |
| 315 |
|
if (newframe == NULL) RRETURN(PCRE_ERROR_NOMEMORY);\ |
| 316 |
frame->Xwhere = rw; \ |
frame->Xwhere = rw; \ |
| 317 |
newframe->Xeptr = ra;\ |
newframe->Xeptr = ra;\ |
| 318 |
newframe->Xecode = rb;\ |
newframe->Xecode = rb;\ |
| 319 |
newframe->Xmstart = mstart;\ |
newframe->Xmstart = mstart;\ |
| 320 |
|
newframe->Xmarkptr = markptr;\ |
| 321 |
newframe->Xoffset_top = rc;\ |
newframe->Xoffset_top = rc;\ |
| 322 |
newframe->Xims = re;\ |
newframe->Xims = re;\ |
| 323 |
newframe->Xeptrb = rf;\ |
newframe->Xeptrb = rf;\ |
| 333 |
|
|
| 334 |
#define RRETURN(ra)\ |
#define RRETURN(ra)\ |
| 335 |
{\ |
{\ |
| 336 |
heapframe *newframe = frame;\ |
heapframe *oldframe = frame;\ |
| 337 |
frame = newframe->Xprevframe;\ |
frame = oldframe->Xprevframe;\ |
| 338 |
(pcre_stack_free)(newframe);\ |
(pcre_stack_free)(oldframe);\ |
| 339 |
if (frame != NULL)\ |
if (frame != NULL)\ |
| 340 |
{\ |
{\ |
| 341 |
rrc = ra;\ |
rrc = ra;\ |
| 355 |
USPTR Xeptr; |
USPTR Xeptr; |
| 356 |
const uschar *Xecode; |
const uschar *Xecode; |
| 357 |
USPTR Xmstart; |
USPTR Xmstart; |
| 358 |
|
USPTR Xmarkptr; |
| 359 |
int Xoffset_top; |
int Xoffset_top; |
| 360 |
long int Xims; |
long int Xims; |
| 361 |
eptrblock *Xeptrb; |
eptrblock *Xeptrb; |
| 439 |
the subject. */ |
the subject. */ |
| 440 |
|
|
| 441 |
#define CHECK_PARTIAL()\ |
#define CHECK_PARTIAL()\ |
| 442 |
if (md->partial != 0 && eptr >= md->end_subject && eptr > mstart)\ |
if (md->partial != 0 && eptr >= md->end_subject && \ |
| 443 |
{\ |
eptr > md->start_used_ptr) \ |
| 444 |
md->hitend = TRUE;\ |
{ \ |
| 445 |
if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\ |
md->hitend = TRUE; \ |
| 446 |
|
if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL); \ |
| 447 |
} |
} |
| 448 |
|
|
| 449 |
#define SCHECK_PARTIAL()\ |
#define SCHECK_PARTIAL()\ |
| 450 |
if (md->partial != 0 && eptr > mstart)\ |
if (md->partial != 0 && eptr > md->start_used_ptr) \ |
| 451 |
{\ |
{ \ |
| 452 |
md->hitend = TRUE;\ |
md->hitend = TRUE; \ |
| 453 |
if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\ |
if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL); \ |
| 454 |
} |
} |
| 455 |
|
|
| 456 |
|
|
| 464 |
ecode pointer to current position in compiled code |
ecode pointer to current position in compiled code |
| 465 |
mstart pointer to the current match start position (can be modified |
mstart pointer to the current match start position (can be modified |
| 466 |
by encountering \K) |
by encountering \K) |
| 467 |
|
markptr pointer to the most recent MARK name, or NULL |
| 468 |
offset_top current top pointer |
offset_top current top pointer |
| 469 |
md pointer to "static" info for the match |
md pointer to "static" info for the match |
| 470 |
ims current /i, /m, and /s options |
ims current /i, /m, and /s options |
| 478 |
|
|
| 479 |
Returns: MATCH_MATCH if matched ) these values are >= 0 |
Returns: MATCH_MATCH if matched ) these values are >= 0 |
| 480 |
MATCH_NOMATCH if failed to match ) |
MATCH_NOMATCH if failed to match ) |
| 481 |
|
a negative MATCH_xxx value for PRUNE, SKIP, etc |
| 482 |
a negative PCRE_ERROR_xxx value if aborted by an error condition |
a negative PCRE_ERROR_xxx value if aborted by an error condition |
| 483 |
(e.g. stopped by repeated call or recursion limit) |
(e.g. stopped by repeated call or recursion limit) |
| 484 |
*/ |
*/ |
| 485 |
|
|
| 486 |
static int |
static int |
| 487 |
match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart, |
match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart, |
| 488 |
int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb, |
const uschar *markptr, int offset_top, match_data *md, unsigned long int ims, |
| 489 |
int flags, unsigned int rdepth) |
eptrblock *eptrb, int flags, unsigned int rdepth) |
| 490 |
{ |
{ |
| 491 |
/* These variables do not need to be preserved over recursion in this function, |
/* These variables do not need to be preserved over recursion in this function, |
| 492 |
so they can be ordinary variables in all cases. Mark some of them with |
so they can be ordinary variables in all cases. Mark some of them with |
| 506 |
heap whenever RMATCH() does a "recursion". See the macro definitions above. */ |
heap whenever RMATCH() does a "recursion". See the macro definitions above. */ |
| 507 |
|
|
| 508 |
#ifdef NO_RECURSE |
#ifdef NO_RECURSE |
| 509 |
heapframe *frame = (pcre_stack_malloc)(sizeof(heapframe)); |
heapframe *frame = (heapframe *)(pcre_stack_malloc)(sizeof(heapframe)); |
| 510 |
|
if (frame == NULL) RRETURN(PCRE_ERROR_NOMEMORY); |
| 511 |
frame->Xprevframe = NULL; /* Marks the top level */ |
frame->Xprevframe = NULL; /* Marks the top level */ |
| 512 |
|
|
| 513 |
/* Copy in the original argument variables */ |
/* Copy in the original argument variables */ |
| 515 |
frame->Xeptr = eptr; |
frame->Xeptr = eptr; |
| 516 |
frame->Xecode = ecode; |
frame->Xecode = ecode; |
| 517 |
frame->Xmstart = mstart; |
frame->Xmstart = mstart; |
| 518 |
|
frame->Xmarkptr = markptr; |
| 519 |
frame->Xoffset_top = offset_top; |
frame->Xoffset_top = offset_top; |
| 520 |
frame->Xims = ims; |
frame->Xims = ims; |
| 521 |
frame->Xeptrb = eptrb; |
frame->Xeptrb = eptrb; |
| 531 |
#define eptr frame->Xeptr |
#define eptr frame->Xeptr |
| 532 |
#define ecode frame->Xecode |
#define ecode frame->Xecode |
| 533 |
#define mstart frame->Xmstart |
#define mstart frame->Xmstart |
| 534 |
|
#define markptr frame->Xmarkptr |
| 535 |
#define offset_top frame->Xoffset_top |
#define offset_top frame->Xoffset_top |
| 536 |
#define ims frame->Xims |
#define ims frame->Xims |
| 537 |
#define eptrb frame->Xeptrb |
#define eptrb frame->Xeptrb |
| 703 |
|
|
| 704 |
switch(op) |
switch(op) |
| 705 |
{ |
{ |
| 706 |
|
case OP_MARK: |
| 707 |
|
markptr = ecode + 2; |
| 708 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 709 |
|
ims, eptrb, flags, RM55); |
| 710 |
|
|
| 711 |
|
/* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an |
| 712 |
|
argument, and we must check whether that argument matches this MARK's |
| 713 |
|
argument. It is passed back in md->start_match_ptr (an overloading of that |
| 714 |
|
variable). If it does match, we reset that variable to the current subject |
| 715 |
|
position and return MATCH_SKIP. Otherwise, pass back the return code |
| 716 |
|
unaltered. */ |
| 717 |
|
|
| 718 |
|
if (rrc == MATCH_SKIP_ARG && |
| 719 |
|
strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0) |
| 720 |
|
{ |
| 721 |
|
md->start_match_ptr = eptr; |
| 722 |
|
RRETURN(MATCH_SKIP); |
| 723 |
|
} |
| 724 |
|
|
| 725 |
|
if (md->mark == NULL) md->mark = markptr; |
| 726 |
|
RRETURN(rrc); |
| 727 |
|
|
| 728 |
case OP_FAIL: |
case OP_FAIL: |
| 729 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 730 |
|
|
| 731 |
|
/* COMMIT overrides PRUNE, SKIP, and THEN */ |
| 732 |
|
|
| 733 |
|
case OP_COMMIT: |
| 734 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 735 |
|
ims, eptrb, flags, RM52); |
| 736 |
|
if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && |
| 737 |
|
rrc != MATCH_SKIP && rrc != MATCH_SKIP_ARG && |
| 738 |
|
rrc != MATCH_THEN) |
| 739 |
|
RRETURN(rrc); |
| 740 |
|
MRRETURN(MATCH_COMMIT); |
| 741 |
|
|
| 742 |
|
/* PRUNE overrides THEN */ |
| 743 |
|
|
| 744 |
case OP_PRUNE: |
case OP_PRUNE: |
| 745 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 746 |
ims, eptrb, flags, RM51); |
ims, eptrb, flags, RM51); |
| 747 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
| 748 |
|
MRRETURN(MATCH_PRUNE); |
| 749 |
|
|
| 750 |
|
case OP_PRUNE_ARG: |
| 751 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 752 |
|
ims, eptrb, flags, RM56); |
| 753 |
|
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
| 754 |
|
md->mark = ecode + 2; |
| 755 |
RRETURN(MATCH_PRUNE); |
RRETURN(MATCH_PRUNE); |
| 756 |
|
|
| 757 |
case OP_COMMIT: |
/* SKIP overrides PRUNE and THEN */ |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
|
|
ims, eptrb, flags, RM52); |
|
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
|
|
RRETURN(MATCH_COMMIT); |
|
| 758 |
|
|
| 759 |
case OP_SKIP: |
case OP_SKIP: |
| 760 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 761 |
ims, eptrb, flags, RM53); |
ims, eptrb, flags, RM53); |
| 762 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN) |
| 763 |
|
RRETURN(rrc); |
| 764 |
md->start_match_ptr = eptr; /* Pass back current position */ |
md->start_match_ptr = eptr; /* Pass back current position */ |
| 765 |
RRETURN(MATCH_SKIP); |
MRRETURN(MATCH_SKIP); |
| 766 |
|
|
| 767 |
|
case OP_SKIP_ARG: |
| 768 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 769 |
|
ims, eptrb, flags, RM57); |
| 770 |
|
if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN) |
| 771 |
|
RRETURN(rrc); |
| 772 |
|
|
| 773 |
|
/* Pass back the current skip name by overloading md->start_match_ptr and |
| 774 |
|
returning the special MATCH_SKIP_ARG return code. This will either be |
| 775 |
|
caught by a matching MARK, or get to the top, where it is treated the same |
| 776 |
|
as PRUNE. */ |
| 777 |
|
|
| 778 |
|
md->start_match_ptr = ecode + 2; |
| 779 |
|
RRETURN(MATCH_SKIP_ARG); |
| 780 |
|
|
| 781 |
|
/* For THEN (and THEN_ARG) we pass back the address of the bracket or |
| 782 |
|
the alt that is at the start of the current branch. This makes it possible |
| 783 |
|
to skip back past alternatives that precede the THEN within the current |
| 784 |
|
branch. */ |
| 785 |
|
|
| 786 |
case OP_THEN: |
case OP_THEN: |
| 787 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 788 |
ims, eptrb, flags, RM54); |
ims, eptrb, flags, RM54); |
| 789 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 790 |
|
md->start_match_ptr = ecode - GET(ecode, 1); |
| 791 |
|
MRRETURN(MATCH_THEN); |
| 792 |
|
|
| 793 |
|
case OP_THEN_ARG: |
| 794 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1+LINK_SIZE], |
| 795 |
|
offset_top, md, ims, eptrb, flags, RM58); |
| 796 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 797 |
|
md->start_match_ptr = ecode - GET(ecode, 1); |
| 798 |
|
md->mark = ecode + LINK_SIZE + 2; |
| 799 |
RRETURN(MATCH_THEN); |
RRETURN(MATCH_THEN); |
| 800 |
|
|
| 801 |
/* Handle a capturing bracket. If there is space in the offset vector, save |
/* Handle a capturing bracket. If there is space in the offset vector, save |
| 832 |
save_capture_last = md->capture_last; |
save_capture_last = md->capture_last; |
| 833 |
|
|
| 834 |
DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3)); |
DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3)); |
| 835 |
md->offset_vector[md->offset_end - number] = eptr - md->start_subject; |
md->offset_vector[md->offset_end - number] = |
| 836 |
|
(int)(eptr - md->start_subject); |
| 837 |
|
|
| 838 |
flags = (op == OP_SCBRA)? match_cbegroup : 0; |
flags = (op == OP_SCBRA)? match_cbegroup : 0; |
| 839 |
do |
do |
| 840 |
{ |
{ |
| 841 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 842 |
ims, eptrb, flags, RM1); |
ims, eptrb, flags, RM1); |
| 843 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && |
| 844 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 845 |
|
RRETURN(rrc); |
| 846 |
md->capture_last = save_capture_last; |
md->capture_last = save_capture_last; |
| 847 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 848 |
} |
} |
| 854 |
md->offset_vector[offset+1] = save_offset2; |
md->offset_vector[offset+1] = save_offset2; |
| 855 |
md->offset_vector[md->offset_end - number] = save_offset3; |
md->offset_vector[md->offset_end - number] = save_offset3; |
| 856 |
|
|
| 857 |
|
if (rrc != MATCH_THEN) md->mark = markptr; |
| 858 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
| 859 |
} |
} |
| 860 |
|
|
| 894 |
|
|
| 895 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
| 896 |
eptrb, flags, RM48); |
eptrb, flags, RM48); |
| 897 |
|
if (rrc == MATCH_NOMATCH) md->mark = markptr; |
| 898 |
RRETURN(rrc); |
RRETURN(rrc); |
| 899 |
} |
} |
| 900 |
|
|
| 903 |
|
|
| 904 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
| 905 |
eptrb, flags, RM2); |
eptrb, flags, RM2); |
| 906 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && |
| 907 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 908 |
|
RRETURN(rrc); |
| 909 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 910 |
} |
} |
| 911 |
/* Control never reaches here. */ |
/* Control never reaches here. */ |
| 932 |
cb.callout_number = ecode[LINK_SIZE+2]; |
cb.callout_number = ecode[LINK_SIZE+2]; |
| 933 |
cb.offset_vector = md->offset_vector; |
cb.offset_vector = md->offset_vector; |
| 934 |
cb.subject = (PCRE_SPTR)md->start_subject; |
cb.subject = (PCRE_SPTR)md->start_subject; |
| 935 |
cb.subject_length = md->end_subject - md->start_subject; |
cb.subject_length = (int)(md->end_subject - md->start_subject); |
| 936 |
cb.start_match = mstart - md->start_subject; |
cb.start_match = (int)(mstart - md->start_subject); |
| 937 |
cb.current_position = eptr - md->start_subject; |
cb.current_position = (int)(eptr - md->start_subject); |
| 938 |
cb.pattern_position = GET(ecode, LINK_SIZE + 3); |
cb.pattern_position = GET(ecode, LINK_SIZE + 3); |
| 939 |
cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE); |
cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE); |
| 940 |
cb.capture_top = offset_top/2; |
cb.capture_top = offset_top/2; |
| 941 |
cb.capture_last = md->capture_last; |
cb.capture_last = md->capture_last; |
| 942 |
cb.callout_data = md->callout_data; |
cb.callout_data = md->callout_data; |
| 943 |
if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH); |
if ((rrc = (*pcre_callout)(&cb)) > 0) MRRETURN(MATCH_NOMATCH); |
| 944 |
if (rrc < 0) RRETURN(rrc); |
if (rrc < 0) RRETURN(rrc); |
| 945 |
} |
} |
| 946 |
ecode += _pcre_OP_lengths[OP_CALLOUT]; |
ecode += _pcre_OP_lengths[OP_CALLOUT]; |
| 1106 |
ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2); |
ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2); |
| 1107 |
while (*ecode == OP_ALT) ecode += GET(ecode, 1); |
while (*ecode == OP_ALT) ecode += GET(ecode, 1); |
| 1108 |
} |
} |
| 1109 |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
else if (rrc != MATCH_NOMATCH && |
| 1110 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1111 |
{ |
{ |
| 1112 |
RRETURN(rrc); /* Need braces because of following else */ |
RRETURN(rrc); /* Need braces because of following else */ |
| 1113 |
} |
} |
| 1161 |
{ |
{ |
| 1162 |
md->offset_vector[offset] = |
md->offset_vector[offset] = |
| 1163 |
md->offset_vector[md->offset_end - number]; |
md->offset_vector[md->offset_end - number]; |
| 1164 |
md->offset_vector[offset+1] = eptr - md->start_subject; |
md->offset_vector[offset+1] = (int)(eptr - md->start_subject); |
| 1165 |
if (offset_top <= offset) offset_top = offset + 2; |
if (offset_top <= offset) offset_top = offset + 2; |
| 1166 |
} |
} |
| 1167 |
ecode += 3; |
ecode += 3; |
| 1182 |
memmove(md->offset_vector, rec->offset_save, |
memmove(md->offset_vector, rec->offset_save, |
| 1183 |
rec->saved_max * sizeof(int)); |
rec->saved_max * sizeof(int)); |
| 1184 |
offset_top = rec->save_offset_top; |
offset_top = rec->save_offset_top; |
|
mstart = rec->save_start; |
|
| 1185 |
ims = original_ims; |
ims = original_ims; |
| 1186 |
ecode = rec->after_call; |
ecode = rec->after_call; |
| 1187 |
break; |
break; |
| 1196 |
(md->notempty || |
(md->notempty || |
| 1197 |
(md->notempty_atstart && |
(md->notempty_atstart && |
| 1198 |
mstart == md->start_subject + md->start_offset))) |
mstart == md->start_subject + md->start_offset))) |
| 1199 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1200 |
|
|
| 1201 |
/* Otherwise, we have a match. */ |
/* Otherwise, we have a match. */ |
| 1202 |
|
|
| 1203 |
md->end_match_ptr = eptr; /* Record where we ended */ |
md->end_match_ptr = eptr; /* Record where we ended */ |
| 1204 |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
| 1205 |
md->start_match_ptr = mstart; /* and the start (\K can modify) */ |
md->start_match_ptr = mstart; /* and the start (\K can modify) */ |
| 1206 |
RRETURN(MATCH_MATCH); |
|
| 1207 |
|
/* For some reason, the macros don't work properly if an expression is |
| 1208 |
|
given as the argument to MRRETURN when the heap is in use. */ |
| 1209 |
|
|
| 1210 |
|
rrc = (op == OP_END)? MATCH_MATCH : MATCH_ACCEPT; |
| 1211 |
|
MRRETURN(rrc); |
| 1212 |
|
|
| 1213 |
/* Change option settings */ |
/* Change option settings */ |
| 1214 |
|
|
| 1230 |
{ |
{ |
| 1231 |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
| 1232 |
RM4); |
RM4); |
| 1233 |
if (rrc == MATCH_MATCH) break; |
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) |
| 1234 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
{ |
| 1235 |
|
mstart = md->start_match_ptr; /* In case \K reset it */ |
| 1236 |
|
break; |
| 1237 |
|
} |
| 1238 |
|
if (rrc != MATCH_NOMATCH && |
| 1239 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1240 |
|
RRETURN(rrc); |
| 1241 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 1242 |
} |
} |
| 1243 |
while (*ecode == OP_ALT); |
while (*ecode == OP_ALT); |
| 1244 |
if (*ecode == OP_KET) RRETURN(MATCH_NOMATCH); |
if (*ecode == OP_KET) MRRETURN(MATCH_NOMATCH); |
| 1245 |
|
|
| 1246 |
/* If checking an assertion for a condition, return MATCH_MATCH. */ |
/* If checking an assertion for a condition, return MATCH_MATCH. */ |
| 1247 |
|
|
| 1265 |
{ |
{ |
| 1266 |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
| 1267 |
RM5); |
RM5); |
| 1268 |
if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH); |
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) MRRETURN(MATCH_NOMATCH); |
| 1269 |
if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT) |
if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT) |
| 1270 |
{ |
{ |
| 1271 |
do ecode += GET(ecode,1); while (*ecode == OP_ALT); |
do ecode += GET(ecode,1); while (*ecode == OP_ALT); |
| 1272 |
break; |
break; |
| 1273 |
} |
} |
| 1274 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && |
| 1275 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1276 |
|
RRETURN(rrc); |
| 1277 |
ecode += GET(ecode,1); |
ecode += GET(ecode,1); |
| 1278 |
} |
} |
| 1279 |
while (*ecode == OP_ALT); |
while (*ecode == OP_ALT); |
| 1296 |
while (i-- > 0) |
while (i-- > 0) |
| 1297 |
{ |
{ |
| 1298 |
eptr--; |
eptr--; |
| 1299 |
if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH); |
if (eptr < md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1300 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 1301 |
} |
} |
| 1302 |
} |
} |
| 1307 |
|
|
| 1308 |
{ |
{ |
| 1309 |
eptr -= GET(ecode, 1); |
eptr -= GET(ecode, 1); |
| 1310 |
if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH); |
if (eptr < md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1311 |
} |
} |
| 1312 |
|
|
| 1313 |
/* Save the earliest consulted character, then skip to next op code */ |
/* Save the earliest consulted character, then skip to next op code */ |
| 1328 |
cb.callout_number = ecode[1]; |
cb.callout_number = ecode[1]; |
| 1329 |
cb.offset_vector = md->offset_vector; |
cb.offset_vector = md->offset_vector; |
| 1330 |
cb.subject = (PCRE_SPTR)md->start_subject; |
cb.subject = (PCRE_SPTR)md->start_subject; |
| 1331 |
cb.subject_length = md->end_subject - md->start_subject; |
cb.subject_length = (int)(md->end_subject - md->start_subject); |
| 1332 |
cb.start_match = mstart - md->start_subject; |
cb.start_match = (int)(mstart - md->start_subject); |
| 1333 |
cb.current_position = eptr - md->start_subject; |
cb.current_position = (int)(eptr - md->start_subject); |
| 1334 |
cb.pattern_position = GET(ecode, 2); |
cb.pattern_position = GET(ecode, 2); |
| 1335 |
cb.next_item_length = GET(ecode, 2 + LINK_SIZE); |
cb.next_item_length = GET(ecode, 2 + LINK_SIZE); |
| 1336 |
cb.capture_top = offset_top/2; |
cb.capture_top = offset_top/2; |
| 1337 |
cb.capture_last = md->capture_last; |
cb.capture_last = md->capture_last; |
| 1338 |
cb.callout_data = md->callout_data; |
cb.callout_data = md->callout_data; |
| 1339 |
if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH); |
if ((rrc = (*pcre_callout)(&cb)) > 0) MRRETURN(MATCH_NOMATCH); |
| 1340 |
if (rrc < 0) RRETURN(rrc); |
if (rrc < 0) RRETURN(rrc); |
| 1341 |
} |
} |
| 1342 |
ecode += 2 + 2*LINK_SIZE; |
ecode += 2 + 2*LINK_SIZE; |
| 1391 |
|
|
| 1392 |
memcpy(new_recursive.offset_save, md->offset_vector, |
memcpy(new_recursive.offset_save, md->offset_vector, |
| 1393 |
new_recursive.saved_max * sizeof(int)); |
new_recursive.saved_max * sizeof(int)); |
|
new_recursive.save_start = mstart; |
|
| 1394 |
new_recursive.save_offset_top = offset_top; |
new_recursive.save_offset_top = offset_top; |
|
mstart = eptr; |
|
| 1395 |
|
|
| 1396 |
/* 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 |
| 1397 |
restore the offset and recursion data. */ |
restore the offset and recursion data. */ |
| 1402 |
{ |
{ |
| 1403 |
RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top, |
RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top, |
| 1404 |
md, ims, eptrb, flags, RM6); |
md, ims, eptrb, flags, RM6); |
| 1405 |
if (rrc == MATCH_MATCH) |
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) |
| 1406 |
{ |
{ |
| 1407 |
DPRINTF(("Recursion matched\n")); |
DPRINTF(("Recursion matched\n")); |
| 1408 |
md->recursive = new_recursive.prevrec; |
md->recursive = new_recursive.prevrec; |
| 1409 |
if (new_recursive.offset_save != stacksave) |
if (new_recursive.offset_save != stacksave) |
| 1410 |
(pcre_free)(new_recursive.offset_save); |
(pcre_free)(new_recursive.offset_save); |
| 1411 |
RRETURN(MATCH_MATCH); |
MRRETURN(MATCH_MATCH); |
| 1412 |
} |
} |
| 1413 |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
else if (rrc != MATCH_NOMATCH && |
| 1414 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1415 |
{ |
{ |
| 1416 |
DPRINTF(("Recursion gave error %d\n", rrc)); |
DPRINTF(("Recursion gave error %d\n", rrc)); |
| 1417 |
if (new_recursive.offset_save != stacksave) |
if (new_recursive.offset_save != stacksave) |
| 1430 |
md->recursive = new_recursive.prevrec; |
md->recursive = new_recursive.prevrec; |
| 1431 |
if (new_recursive.offset_save != stacksave) |
if (new_recursive.offset_save != stacksave) |
| 1432 |
(pcre_free)(new_recursive.offset_save); |
(pcre_free)(new_recursive.offset_save); |
| 1433 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1434 |
} |
} |
| 1435 |
/* Control never reaches here */ |
/* Control never reaches here */ |
| 1436 |
|
|
| 1439 |
a move back into the brackets. Friedl calls these "atomic" subpatterns. |
a move back into the brackets. Friedl calls these "atomic" subpatterns. |
| 1440 |
Check the alternative branches in turn - the matching won't pass the KET |
Check the alternative branches in turn - the matching won't pass the KET |
| 1441 |
for this kind of subpattern. If any one branch matches, we carry on as at |
for this kind of subpattern. If any one branch matches, we carry on as at |
| 1442 |
the end of a normal bracket, leaving the subject pointer. */ |
the end of a normal bracket, leaving the subject pointer, but resetting |
| 1443 |
|
the start-of-match value in case it was changed by \K. */ |
| 1444 |
|
|
| 1445 |
case OP_ONCE: |
case OP_ONCE: |
| 1446 |
prev = ecode; |
prev = ecode; |
| 1449 |
do |
do |
| 1450 |
{ |
{ |
| 1451 |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM7); |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM7); |
| 1452 |
if (rrc == MATCH_MATCH) break; |
if (rrc == MATCH_MATCH) /* Note: _not_ MATCH_ACCEPT */ |
| 1453 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
{ |
| 1454 |
|
mstart = md->start_match_ptr; |
| 1455 |
|
break; |
| 1456 |
|
} |
| 1457 |
|
if (rrc != MATCH_NOMATCH && |
| 1458 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1459 |
|
RRETURN(rrc); |
| 1460 |
ecode += GET(ecode,1); |
ecode += GET(ecode,1); |
| 1461 |
} |
} |
| 1462 |
while (*ecode == OP_ALT); |
while (*ecode == OP_ALT); |
| 1574 |
} |
} |
| 1575 |
else saved_eptr = NULL; |
else saved_eptr = NULL; |
| 1576 |
|
|
| 1577 |
/* If we are at the end of an assertion group, stop matching and return |
/* If we are at the end of an assertion group or an atomic group, stop |
| 1578 |
MATCH_MATCH, but record the current high water mark for use by positive |
matching and return MATCH_MATCH, but record the current high water mark for |
| 1579 |
assertions. Do this also for the "once" (atomic) groups. */ |
use by positive assertions. We also need to record the match start in case |
| 1580 |
|
it was changed by \K. */ |
| 1581 |
|
|
| 1582 |
if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT || |
if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT || |
| 1583 |
*prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT || |
*prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT || |
| 1585 |
{ |
{ |
| 1586 |
md->end_match_ptr = eptr; /* For ONCE */ |
md->end_match_ptr = eptr; /* For ONCE */ |
| 1587 |
md->end_offset_top = offset_top; |
md->end_offset_top = offset_top; |
| 1588 |
RRETURN(MATCH_MATCH); |
md->start_match_ptr = mstart; |
| 1589 |
|
MRRETURN(MATCH_MATCH); |
| 1590 |
} |
} |
| 1591 |
|
|
| 1592 |
/* For capturing groups we have to check the group number back at the start |
/* For capturing groups we have to check the group number back at the start |
| 1610 |
{ |
{ |
| 1611 |
md->offset_vector[offset] = |
md->offset_vector[offset] = |
| 1612 |
md->offset_vector[md->offset_end - number]; |
md->offset_vector[md->offset_end - number]; |
| 1613 |
md->offset_vector[offset+1] = eptr - md->start_subject; |
md->offset_vector[offset+1] = (int)(eptr - md->start_subject); |
| 1614 |
if (offset_top <= offset) offset_top = offset + 2; |
if (offset_top <= offset) offset_top = offset + 2; |
| 1615 |
} |
} |
| 1616 |
|
|
| 1622 |
recursion_info *rec = md->recursive; |
recursion_info *rec = md->recursive; |
| 1623 |
DPRINTF(("Recursion (%d) succeeded - continuing\n", number)); |
DPRINTF(("Recursion (%d) succeeded - continuing\n", number)); |
| 1624 |
md->recursive = rec->prevrec; |
md->recursive = rec->prevrec; |
|
mstart = rec->save_start; |
|
| 1625 |
memcpy(md->offset_vector, rec->offset_save, |
memcpy(md->offset_vector, rec->offset_save, |
| 1626 |
rec->saved_max * sizeof(int)); |
rec->saved_max * sizeof(int)); |
| 1627 |
offset_top = rec->save_offset_top; |
offset_top = rec->save_offset_top; |
| 1681 |
/* Start of subject unless notbol, or after internal newline if multiline */ |
/* Start of subject unless notbol, or after internal newline if multiline */ |
| 1682 |
|
|
| 1683 |
case OP_CIRC: |
case OP_CIRC: |
| 1684 |
if (md->notbol && eptr == md->start_subject) RRETURN(MATCH_NOMATCH); |
if (md->notbol && eptr == md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1685 |
if ((ims & PCRE_MULTILINE) != 0) |
if ((ims & PCRE_MULTILINE) != 0) |
| 1686 |
{ |
{ |
| 1687 |
if (eptr != md->start_subject && |
if (eptr != md->start_subject && |
| 1688 |
(eptr == md->end_subject || !WAS_NEWLINE(eptr))) |
(eptr == md->end_subject || !WAS_NEWLINE(eptr))) |
| 1689 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1690 |
ecode++; |
ecode++; |
| 1691 |
break; |
break; |
| 1692 |
} |
} |
| 1695 |
/* Start of subject assertion */ |
/* Start of subject assertion */ |
| 1696 |
|
|
| 1697 |
case OP_SOD: |
case OP_SOD: |
| 1698 |
if (eptr != md->start_subject) RRETURN(MATCH_NOMATCH); |
if (eptr != md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1699 |
ecode++; |
ecode++; |
| 1700 |
break; |
break; |
| 1701 |
|
|
| 1702 |
/* Start of match assertion */ |
/* Start of match assertion */ |
| 1703 |
|
|
| 1704 |
case OP_SOM: |
case OP_SOM: |
| 1705 |
if (eptr != md->start_subject + md->start_offset) RRETURN(MATCH_NOMATCH); |
if (eptr != md->start_subject + md->start_offset) MRRETURN(MATCH_NOMATCH); |
| 1706 |
ecode++; |
ecode++; |
| 1707 |
break; |
break; |
| 1708 |
|
|
| 1720 |
if ((ims & PCRE_MULTILINE) != 0) |
if ((ims & PCRE_MULTILINE) != 0) |
| 1721 |
{ |
{ |
| 1722 |
if (eptr < md->end_subject) |
if (eptr < md->end_subject) |
| 1723 |
{ if (!IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); } |
{ if (!IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); } |
| 1724 |
else |
else |
| 1725 |
{ if (md->noteol) RRETURN(MATCH_NOMATCH); } |
{ |
| 1726 |
|
if (md->noteol) MRRETURN(MATCH_NOMATCH); |
| 1727 |
|
SCHECK_PARTIAL(); |
| 1728 |
|
} |
| 1729 |
ecode++; |
ecode++; |
| 1730 |
break; |
break; |
| 1731 |
} |
} |
| 1732 |
else |
else /* Not multiline */ |
| 1733 |
{ |
{ |
| 1734 |
if (md->noteol) RRETURN(MATCH_NOMATCH); |
if (md->noteol) MRRETURN(MATCH_NOMATCH); |
| 1735 |
if (!md->endonly) |
if (!md->endonly) goto ASSERT_NL_OR_EOS; |
|
{ |
|
|
if (eptr != md->end_subject && |
|
|
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen)) |
|
|
RRETURN(MATCH_NOMATCH); |
|
|
ecode++; |
|
|
break; |
|
|
} |
|
| 1736 |
} |
} |
| 1737 |
|
|
| 1738 |
/* ... else fall through for endonly */ |
/* ... else fall through for endonly */ |
| 1739 |
|
|
| 1740 |
/* End of subject assertion (\z) */ |
/* End of subject assertion (\z) */ |
| 1741 |
|
|
| 1742 |
case OP_EOD: |
case OP_EOD: |
| 1743 |
if (eptr < md->end_subject) RRETURN(MATCH_NOMATCH); |
if (eptr < md->end_subject) MRRETURN(MATCH_NOMATCH); |
| 1744 |
|
SCHECK_PARTIAL(); |
| 1745 |
ecode++; |
ecode++; |
| 1746 |
break; |
break; |
| 1747 |
|
|
| 1748 |
/* End of subject or ending \n assertion (\Z) */ |
/* End of subject or ending \n assertion (\Z) */ |
| 1749 |
|
|
| 1750 |
case OP_EODN: |
case OP_EODN: |
| 1751 |
if (eptr != md->end_subject && |
ASSERT_NL_OR_EOS: |
| 1752 |
|
if (eptr < md->end_subject && |
| 1753 |
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen)) |
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen)) |
| 1754 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1755 |
|
|
| 1756 |
|
/* Either at end of string or \n before end. */ |
| 1757 |
|
|
| 1758 |
|
SCHECK_PARTIAL(); |
| 1759 |
ecode++; |
ecode++; |
| 1760 |
break; |
break; |
| 1761 |
|
|
| 1773 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1774 |
if (utf8) |
if (utf8) |
| 1775 |
{ |
{ |
| 1776 |
|
/* Get status of previous character */ |
| 1777 |
|
|
| 1778 |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
| 1779 |
{ |
{ |
| 1780 |
USPTR lastptr = eptr - 1; |
USPTR lastptr = eptr - 1; |
| 1781 |
while((*lastptr & 0xc0) == 0x80) lastptr--; |
while((*lastptr & 0xc0) == 0x80) lastptr--; |
| 1782 |
if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr; |
if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr; |
| 1783 |
GETCHAR(c, lastptr); |
GETCHAR(c, lastptr); |
| 1784 |
|
#ifdef SUPPORT_UCP |
| 1785 |
|
if (md->use_ucp) |
| 1786 |
|
{ |
| 1787 |
|
if (c == '_') prev_is_word = TRUE; else |
| 1788 |
|
{ |
| 1789 |
|
int cat = UCD_CATEGORY(c); |
| 1790 |
|
prev_is_word = (cat == ucp_L || cat == ucp_N); |
| 1791 |
|
} |
| 1792 |
|
} |
| 1793 |
|
else |
| 1794 |
|
#endif |
| 1795 |
prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
| 1796 |
} |
} |
| 1797 |
|
|
| 1798 |
|
/* Get status of next character */ |
| 1799 |
|
|
| 1800 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1801 |
{ |
{ |
| 1802 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1805 |
else |
else |
| 1806 |
{ |
{ |
| 1807 |
GETCHAR(c, eptr); |
GETCHAR(c, eptr); |
| 1808 |
|
#ifdef SUPPORT_UCP |
| 1809 |
|
if (md->use_ucp) |
| 1810 |
|
{ |
| 1811 |
|
if (c == '_') cur_is_word = TRUE; else |
| 1812 |
|
{ |
| 1813 |
|
int cat = UCD_CATEGORY(c); |
| 1814 |
|
cur_is_word = (cat == ucp_L || cat == ucp_N); |
| 1815 |
|
} |
| 1816 |
|
} |
| 1817 |
|
else |
| 1818 |
|
#endif |
| 1819 |
cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
| 1820 |
} |
} |
| 1821 |
} |
} |
| 1822 |
else |
else |
| 1823 |
#endif |
#endif |
| 1824 |
|
|
| 1825 |
/* Not in UTF-8 mode */ |
/* Not in UTF-8 mode, but we may still have PCRE_UCP set, and for |
| 1826 |
|
consistency with the behaviour of \w we do use it in this case. */ |
| 1827 |
|
|
| 1828 |
{ |
{ |
| 1829 |
|
/* Get status of previous character */ |
| 1830 |
|
|
| 1831 |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
| 1832 |
{ |
{ |
| 1833 |
if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1; |
if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1; |
| 1834 |
|
#ifdef SUPPORT_UCP |
| 1835 |
|
if (md->use_ucp) |
| 1836 |
|
{ |
| 1837 |
|
c = eptr[-1]; |
| 1838 |
|
if (c == '_') prev_is_word = TRUE; else |
| 1839 |
|
{ |
| 1840 |
|
int cat = UCD_CATEGORY(c); |
| 1841 |
|
prev_is_word = (cat == ucp_L || cat == ucp_N); |
| 1842 |
|
} |
| 1843 |
|
} |
| 1844 |
|
else |
| 1845 |
|
#endif |
| 1846 |
prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0); |
prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0); |
| 1847 |
} |
} |
| 1848 |
|
|
| 1849 |
|
/* Get status of next character */ |
| 1850 |
|
|
| 1851 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1852 |
{ |
{ |
| 1853 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1854 |
cur_is_word = FALSE; |
cur_is_word = FALSE; |
| 1855 |
} |
} |
| 1856 |
else cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0); |
else |
| 1857 |
|
#ifdef SUPPORT_UCP |
| 1858 |
|
if (md->use_ucp) |
| 1859 |
|
{ |
| 1860 |
|
c = *eptr; |
| 1861 |
|
if (c == '_') cur_is_word = TRUE; else |
| 1862 |
|
{ |
| 1863 |
|
int cat = UCD_CATEGORY(c); |
| 1864 |
|
cur_is_word = (cat == ucp_L || cat == ucp_N); |
| 1865 |
|
} |
| 1866 |
|
} |
| 1867 |
|
else |
| 1868 |
|
#endif |
| 1869 |
|
cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0); |
| 1870 |
} |
} |
| 1871 |
|
|
| 1872 |
/* Now see if the situation is what we want */ |
/* Now see if the situation is what we want */ |
| 1873 |
|
|
| 1874 |
if ((*ecode++ == OP_WORD_BOUNDARY)? |
if ((*ecode++ == OP_WORD_BOUNDARY)? |
| 1875 |
cur_is_word == prev_is_word : cur_is_word != prev_is_word) |
cur_is_word == prev_is_word : cur_is_word != prev_is_word) |
| 1876 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1877 |
} |
} |
| 1878 |
break; |
break; |
| 1879 |
|
|
| 1880 |
/* Match a single character type; inline for speed */ |
/* Match a single character type; inline for speed */ |
| 1881 |
|
|
| 1882 |
case OP_ANY: |
case OP_ANY: |
| 1883 |
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); |
if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); |
| 1884 |
/* Fall through */ |
/* Fall through */ |
| 1885 |
|
|
| 1886 |
case OP_ALLANY: |
case OP_ALLANY: |
| 1887 |
if (eptr++ >= md->end_subject) |
if (eptr++ >= md->end_subject) |
| 1888 |
{ |
{ |
| 1889 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1890 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1891 |
} |
} |
| 1892 |
if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 1893 |
ecode++; |
ecode++; |
| 1900 |
if (eptr++ >= md->end_subject) |
if (eptr++ >= md->end_subject) |
| 1901 |
{ |
{ |
| 1902 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1903 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1904 |
} |
} |
| 1905 |
ecode++; |
ecode++; |
| 1906 |
break; |
break; |
| 1909 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1910 |
{ |
{ |
| 1911 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1912 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1913 |
} |
} |
| 1914 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1915 |
if ( |
if ( |
| 1918 |
#endif |
#endif |
| 1919 |
(md->ctypes[c] & ctype_digit) != 0 |
(md->ctypes[c] & ctype_digit) != 0 |
| 1920 |
) |
) |
| 1921 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1922 |
ecode++; |
ecode++; |
| 1923 |
break; |
break; |
| 1924 |
|
|
| 1926 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1927 |
{ |
{ |
| 1928 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1929 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1930 |
} |
} |
| 1931 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1932 |
if ( |
if ( |
| 1935 |
#endif |
#endif |
| 1936 |
(md->ctypes[c] & ctype_digit) == 0 |
(md->ctypes[c] & ctype_digit) == 0 |
| 1937 |
) |
) |
| 1938 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1939 |
ecode++; |
ecode++; |
| 1940 |
break; |
break; |
| 1941 |
|
|
| 1943 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1944 |
{ |
{ |
| 1945 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1946 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1947 |
} |
} |
| 1948 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1949 |
if ( |
if ( |
| 1952 |
#endif |
#endif |
| 1953 |
(md->ctypes[c] & ctype_space) != 0 |
(md->ctypes[c] & ctype_space) != 0 |
| 1954 |
) |
) |
| 1955 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1956 |
ecode++; |
ecode++; |
| 1957 |
break; |
break; |
| 1958 |
|
|
| 1960 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1961 |
{ |
{ |
| 1962 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1963 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1964 |
} |
} |
| 1965 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1966 |
if ( |
if ( |
| 1969 |
#endif |
#endif |
| 1970 |
(md->ctypes[c] & ctype_space) == 0 |
(md->ctypes[c] & ctype_space) == 0 |
| 1971 |
) |
) |
| 1972 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1973 |
ecode++; |
ecode++; |
| 1974 |
break; |
break; |
| 1975 |
|
|
| 1977 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1978 |
{ |
{ |
| 1979 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1980 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1981 |
} |
} |
| 1982 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1983 |
if ( |
if ( |
| 1986 |
#endif |
#endif |
| 1987 |
(md->ctypes[c] & ctype_word) != 0 |
(md->ctypes[c] & ctype_word) != 0 |
| 1988 |
) |
) |
| 1989 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1990 |
ecode++; |
ecode++; |
| 1991 |
break; |
break; |
| 1992 |
|
|
| 1994 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1995 |
{ |
{ |
| 1996 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1997 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1998 |
} |
} |
| 1999 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2000 |
if ( |
if ( |
| 2003 |
#endif |
#endif |
| 2004 |
(md->ctypes[c] & ctype_word) == 0 |
(md->ctypes[c] & ctype_word) == 0 |
| 2005 |
) |
) |
| 2006 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2007 |
ecode++; |
ecode++; |
| 2008 |
break; |
break; |
| 2009 |
|
|
| 2011 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2012 |
{ |
{ |
| 2013 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2014 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2015 |
} |
} |
| 2016 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2017 |
switch(c) |
switch(c) |
| 2018 |
{ |
{ |
| 2019 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 2020 |
|
|
| 2021 |
case 0x000d: |
case 0x000d: |
| 2022 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 2023 |
break; |
break; |
| 2030 |
case 0x0085: |
case 0x0085: |
| 2031 |
case 0x2028: |
case 0x2028: |
| 2032 |
case 0x2029: |
case 0x2029: |
| 2033 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 2034 |
break; |
break; |
| 2035 |
} |
} |
| 2036 |
ecode++; |
ecode++; |
| 2040 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2041 |
{ |
{ |
| 2042 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2043 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2044 |
} |
} |
| 2045 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2046 |
switch(c) |
switch(c) |
| 2065 |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 2066 |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 2067 |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 2068 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2069 |
} |
} |
| 2070 |
ecode++; |
ecode++; |
| 2071 |
break; |
break; |
| 2074 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2075 |
{ |
{ |
| 2076 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2077 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2078 |
} |
} |
| 2079 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2080 |
switch(c) |
switch(c) |
| 2081 |
{ |
{ |
| 2082 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 2083 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 2084 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 2085 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 2108 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2109 |
{ |
{ |
| 2110 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2111 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2112 |
} |
} |
| 2113 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2114 |
switch(c) |
switch(c) |
| 2121 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 2122 |
case 0x2028: /* LINE SEPARATOR */ |
case 0x2028: /* LINE SEPARATOR */ |
| 2123 |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 2124 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2125 |
} |
} |
| 2126 |
ecode++; |
ecode++; |
| 2127 |
break; |
break; |
| 2130 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2131 |
{ |
{ |
| 2132 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2133 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2134 |
} |
} |
| 2135 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2136 |
switch(c) |
switch(c) |
| 2137 |
{ |
{ |
| 2138 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 2139 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 2140 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 2141 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 2157 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2158 |
{ |
{ |
| 2159 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2160 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2161 |
} |
} |
| 2162 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2163 |
{ |
{ |
| 2166 |
switch(ecode[1]) |
switch(ecode[1]) |
| 2167 |
{ |
{ |
| 2168 |
case PT_ANY: |
case PT_ANY: |
| 2169 |
if (op == OP_NOTPROP) RRETURN(MATCH_NOMATCH); |
if (op == OP_NOTPROP) MRRETURN(MATCH_NOMATCH); |
| 2170 |
break; |
break; |
| 2171 |
|
|
| 2172 |
case PT_LAMP: |
case PT_LAMP: |
| 2173 |
if ((prop->chartype == ucp_Lu || |
if ((prop->chartype == ucp_Lu || |
| 2174 |
prop->chartype == ucp_Ll || |
prop->chartype == ucp_Ll || |
| 2175 |
prop->chartype == ucp_Lt) == (op == OP_NOTPROP)) |
prop->chartype == ucp_Lt) == (op == OP_NOTPROP)) |
| 2176 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2177 |
break; |
break; |
| 2178 |
|
|
| 2179 |
case PT_GC: |
case PT_GC: |
| 2180 |
if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP)) |
if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP)) |
| 2181 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2182 |
break; |
break; |
| 2183 |
|
|
| 2184 |
case PT_PC: |
case PT_PC: |
| 2185 |
if ((ecode[2] != prop->chartype) == (op == OP_PROP)) |
if ((ecode[2] != prop->chartype) == (op == OP_PROP)) |
| 2186 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2187 |
break; |
break; |
| 2188 |
|
|
| 2189 |
case PT_SC: |
case PT_SC: |
| 2190 |
if ((ecode[2] != prop->script) == (op == OP_PROP)) |
if ((ecode[2] != prop->script) == (op == OP_PROP)) |
| 2191 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2192 |
|
break; |
| 2193 |
|
|
| 2194 |
|
/* These are specials */ |
| 2195 |
|
|
| 2196 |
|
case PT_ALNUM: |
| 2197 |
|
if ((_pcre_ucp_gentype[prop->chartype] == ucp_L || |
| 2198 |
|
_pcre_ucp_gentype[prop->chartype] == ucp_N) == (op == OP_NOTPROP)) |
| 2199 |
|
MRRETURN(MATCH_NOMATCH); |
| 2200 |
|
break; |
| 2201 |
|
|
| 2202 |
|
case PT_SPACE: /* Perl space */ |
| 2203 |
|
if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z || |
| 2204 |
|
c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR) |
| 2205 |
|
== (op == OP_NOTPROP)) |
| 2206 |
|
MRRETURN(MATCH_NOMATCH); |
| 2207 |
|
break; |
| 2208 |
|
|
| 2209 |
|
case PT_PXSPACE: /* POSIX space */ |
| 2210 |
|
if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z || |
| 2211 |
|
c == CHAR_HT || c == CHAR_NL || c == CHAR_VT || |
| 2212 |
|
c == CHAR_FF || c == CHAR_CR) |
| 2213 |
|
== (op == OP_NOTPROP)) |
| 2214 |
|
MRRETURN(MATCH_NOMATCH); |
| 2215 |
|
break; |
| 2216 |
|
|
| 2217 |
|
case PT_WORD: |
| 2218 |
|
if ((_pcre_ucp_gentype[prop->chartype] == ucp_L || |
| 2219 |
|
_pcre_ucp_gentype[prop->chartype] == ucp_N || |
| 2220 |
|
c == CHAR_UNDERSCORE) == (op == OP_NOTPROP)) |
| 2221 |
|
MRRETURN(MATCH_NOMATCH); |
| 2222 |
break; |
break; |
| 2223 |
|
|
| 2224 |
|
/* This should never occur */ |
| 2225 |
|
|
| 2226 |
default: |
default: |
| 2227 |
RRETURN(PCRE_ERROR_INTERNAL); |
RRETURN(PCRE_ERROR_INTERNAL); |
| 2228 |
} |
} |
| 2238 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2239 |
{ |
{ |
| 2240 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2241 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2242 |
} |
} |
| 2243 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2244 |
{ |
{ |
| 2245 |
int category = UCD_CATEGORY(c); |
int category = UCD_CATEGORY(c); |
| 2246 |
if (category == ucp_M) RRETURN(MATCH_NOMATCH); |
if (category == ucp_M) MRRETURN(MATCH_NOMATCH); |
| 2247 |
while (eptr < md->end_subject) |
while (eptr < md->end_subject) |
| 2248 |
{ |
{ |
| 2249 |
int len = 1; |
int len = 1; |
| 2270 |
loops). */ |
loops). */ |
| 2271 |
|
|
| 2272 |
case OP_REF: |
case OP_REF: |
| 2273 |
{ |
offset = GET2(ecode, 1) << 1; /* Doubled ref number */ |
| 2274 |
offset = GET2(ecode, 1) << 1; /* Doubled ref number */ |
ecode += 3; |
|
ecode += 3; |
|
| 2275 |
|
|
| 2276 |
/* If the reference is unset, there are two possibilities: |
/* If the reference is unset, there are two possibilities: |
| 2277 |
|
|
| 2278 |
(a) In the default, Perl-compatible state, set the length to be longer |
(a) In the default, Perl-compatible state, set the length negative; |
| 2279 |
than the amount of subject left; this ensures that every attempt at a |
this ensures that every attempt at a match fails. We can't just fail |
| 2280 |
match fails. We can't just fail here, because of the possibility of |
here, because of the possibility of quantifiers with zero minima. |
|
quantifiers with zero minima. |
|
| 2281 |
|
|
| 2282 |
(b) If the JavaScript compatibility flag is set, set the length to zero |
(b) If the JavaScript compatibility flag is set, set the length to zero |
| 2283 |
so that the back reference matches an empty string. |
so that the back reference matches an empty string. |
| 2284 |
|
|
| 2285 |
Otherwise, set the length to the length of what was matched by the |
Otherwise, set the length to the length of what was matched by the |
| 2286 |
referenced subpattern. */ |
referenced subpattern. */ |
| 2287 |
|
|
| 2288 |
if (offset >= offset_top || md->offset_vector[offset] < 0) |
if (offset >= offset_top || md->offset_vector[offset] < 0) |
| 2289 |
length = (md->jscript_compat)? 0 : md->end_subject - eptr + 1; |
length = (md->jscript_compat)? 0 : -1; |
| 2290 |
else |
else |
| 2291 |
length = md->offset_vector[offset+1] - md->offset_vector[offset]; |
length = md->offset_vector[offset+1] - md->offset_vector[offset]; |
| 2292 |
|
|
| 2293 |
/* Set up for repetition, or handle the non-repeated case */ |
/* Set up for repetition, or handle the non-repeated case */ |
| 2294 |
|
|
| 2295 |
switch (*ecode) |
switch (*ecode) |
| 2296 |
{ |
{ |
| 2297 |
case OP_CRSTAR: |
case OP_CRSTAR: |
| 2298 |
case OP_CRMINSTAR: |
case OP_CRMINSTAR: |
| 2299 |
case OP_CRPLUS: |
case OP_CRPLUS: |
| 2300 |
case OP_CRMINPLUS: |
case OP_CRMINPLUS: |
| 2301 |
case OP_CRQUERY: |
case OP_CRQUERY: |
| 2302 |
case OP_CRMINQUERY: |
case OP_CRMINQUERY: |
| 2303 |
c = *ecode++ - OP_CRSTAR; |
c = *ecode++ - OP_CRSTAR; |
| 2304 |
minimize = (c & 1) != 0; |
minimize = (c & 1) != 0; |
| 2305 |
min = rep_min[c]; /* Pick up values from tables; */ |
min = rep_min[c]; /* Pick up values from tables; */ |
| 2306 |
max = rep_max[c]; /* zero for max => infinity */ |
max = rep_max[c]; /* zero for max => infinity */ |
| 2307 |
if (max == 0) max = INT_MAX; |
if (max == 0) max = INT_MAX; |
| 2308 |
break; |
break; |
| 2309 |
|
|
| 2310 |
case OP_CRRANGE: |
case OP_CRRANGE: |
| 2311 |
case OP_CRMINRANGE: |
case OP_CRMINRANGE: |
| 2312 |
minimize = (*ecode == OP_CRMINRANGE); |
minimize = (*ecode == OP_CRMINRANGE); |
| 2313 |
min = GET2(ecode, 1); |
min = GET2(ecode, 1); |
| 2314 |
max = GET2(ecode, 3); |
max = GET2(ecode, 3); |
| 2315 |
if (max == 0) max = INT_MAX; |
if (max == 0) max = INT_MAX; |
| 2316 |
ecode += 5; |
ecode += 5; |
| 2317 |
break; |
break; |
| 2318 |
|
|
| 2319 |
default: /* No repeat follows */ |
default: /* No repeat follows */ |
| 2320 |
if (!match_ref(offset, eptr, length, md, ims)) |
if ((length = match_ref(offset, eptr, length, md, ims)) < 0) |
| 2321 |
{ |
{ |
| 2322 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2323 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
|
} |
|
|
eptr += length; |
|
|
continue; /* With the main loop */ |
|
| 2324 |
} |
} |
| 2325 |
|
eptr += length; |
| 2326 |
|
continue; /* With the main loop */ |
| 2327 |
|
} |
| 2328 |
|
|
| 2329 |
/* If the length of the reference is zero, just continue with the |
/* Handle repeated back references. If the length of the reference is |
| 2330 |
main loop. */ |
zero, just continue with the main loop. */ |
| 2331 |
|
|
| 2332 |
if (length == 0) continue; |
if (length == 0) continue; |
| 2333 |
|
|
| 2334 |
/* First, ensure the minimum number of matches are present. We get back |
/* First, ensure the minimum number of matches are present. We get back |
| 2335 |
the length of the reference string explicitly rather than passing the |
the length of the reference string explicitly rather than passing the |
| 2336 |
address of eptr, so that eptr can be a register variable. */ |
address of eptr, so that eptr can be a register variable. */ |
| 2337 |
|
|
| 2338 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
| 2339 |
|
{ |
| 2340 |
|
int slength; |
| 2341 |
|
if ((slength = match_ref(offset, eptr, length, md, ims)) < 0) |
| 2342 |
{ |
{ |
| 2343 |
if (!match_ref(offset, eptr, length, md, ims)) |
CHECK_PARTIAL(); |
| 2344 |
{ |
MRRETURN(MATCH_NOMATCH); |
|
CHECK_PARTIAL(); |
|
|
RRETURN(MATCH_NOMATCH); |
|
|
} |
|
|
eptr += length; |
|
| 2345 |
} |
} |
| 2346 |
|
eptr += slength; |
| 2347 |
|
} |
| 2348 |
|
|
| 2349 |
/* If min = max, continue at the same level without recursion. |
/* If min = max, continue at the same level without recursion. |
| 2350 |
They are not both allowed to be zero. */ |
They are not both allowed to be zero. */ |
| 2351 |
|
|
| 2352 |
if (min == max) continue; |
if (min == max) continue; |
| 2353 |
|
|
| 2354 |
/* If minimizing, keep trying and advancing the pointer */ |
/* If minimizing, keep trying and advancing the pointer */ |
| 2355 |
|
|
| 2356 |
if (minimize) |
if (minimize) |
| 2357 |
|
{ |
| 2358 |
|
for (fi = min;; fi++) |
| 2359 |
{ |
{ |
| 2360 |
for (fi = min;; fi++) |
int slength; |
| 2361 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14); |
| 2362 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2363 |
|
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2364 |
|
if ((slength = match_ref(offset, eptr, length, md, ims)) < 0) |
| 2365 |
{ |
{ |
| 2366 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14); |
CHECK_PARTIAL(); |
| 2367 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
MRRETURN(MATCH_NOMATCH); |
|
if (fi >= max) RRETURN(MATCH_NOMATCH); |
|
|
if (!match_ref(offset, eptr, length, md, ims)) |
|
|
{ |
|
|
CHECK_PARTIAL(); |
|
|
RRETURN(MATCH_NOMATCH); |
|
|
} |
|
|
eptr += length; |
|
| 2368 |
} |
} |
| 2369 |
/* Control never gets here */ |
eptr += slength; |
| 2370 |
} |
} |
| 2371 |
|
/* Control never gets here */ |
| 2372 |
|
} |
| 2373 |
|
|
| 2374 |
/* If maximizing, find the longest string and work backwards */ |
/* If maximizing, find the longest string and work backwards */ |
| 2375 |
|
|
| 2376 |
else |
else |
| 2377 |
|
{ |
| 2378 |
|
pp = eptr; |
| 2379 |
|
for (i = min; i < max; i++) |
| 2380 |
{ |
{ |
| 2381 |
pp = eptr; |
int slength; |
| 2382 |
for (i = min; i < max; i++) |
if ((slength = match_ref(offset, eptr, length, md, ims)) < 0) |
| 2383 |
{ |
{ |
| 2384 |
if (!match_ref(offset, eptr, length, md, ims)) |
CHECK_PARTIAL(); |
| 2385 |
{ |
break; |
|
CHECK_PARTIAL(); |
|
|
break; |
|
|
} |
|
|
eptr += length; |
|
|
} |
|
|
while (eptr >= pp) |
|
|
{ |
|
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM15); |
|
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
|
|
eptr -= length; |
|
| 2386 |
} |
} |
| 2387 |
RRETURN(MATCH_NOMATCH); |
eptr += slength; |
| 2388 |
|
} |
| 2389 |
|
while (eptr >= pp) |
| 2390 |
|
{ |
| 2391 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM15); |
| 2392 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2393 |
|
eptr -= length; |
| 2394 |
} |
} |
| 2395 |
|
MRRETURN(MATCH_NOMATCH); |
| 2396 |
} |
} |
| 2397 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2398 |
|
|
| 2453 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2454 |
{ |
{ |
| 2455 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2456 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2457 |
} |
} |
| 2458 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 2459 |
if (c > 255) |
if (c > 255) |
| 2460 |
{ |
{ |
| 2461 |
if (op == OP_CLASS) RRETURN(MATCH_NOMATCH); |
if (op == OP_CLASS) MRRETURN(MATCH_NOMATCH); |
| 2462 |
} |
} |
| 2463 |
else |
else |
| 2464 |
{ |
{ |
| 2465 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2466 |
} |
} |
| 2467 |
} |
} |
| 2468 |
} |
} |
| 2475 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2476 |
{ |
{ |
| 2477 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2478 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2479 |
} |
} |
| 2480 |
c = *eptr++; |
c = *eptr++; |
| 2481 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2482 |
} |
} |
| 2483 |
} |
} |
| 2484 |
|
|
| 2500 |
{ |
{ |
| 2501 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16); |
| 2502 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2503 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2504 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2505 |
{ |
{ |
| 2506 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2507 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2508 |
} |
} |
| 2509 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 2510 |
if (c > 255) |
if (c > 255) |
| 2511 |
{ |
{ |
| 2512 |
if (op == OP_CLASS) RRETURN(MATCH_NOMATCH); |
if (op == OP_CLASS) MRRETURN(MATCH_NOMATCH); |
| 2513 |
} |
} |
| 2514 |
else |
else |
| 2515 |
{ |
{ |
| 2516 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2517 |
} |
} |
| 2518 |
} |
} |
| 2519 |
} |
} |
| 2525 |
{ |
{ |
| 2526 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17); |
| 2527 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2528 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2529 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2530 |
{ |
{ |
| 2531 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2532 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2533 |
} |
} |
| 2534 |
c = *eptr++; |
c = *eptr++; |
| 2535 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2536 |
} |
} |
| 2537 |
} |
} |
| 2538 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2598 |
} |
} |
| 2599 |
} |
} |
| 2600 |
|
|
| 2601 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2602 |
} |
} |
| 2603 |
} |
} |
| 2604 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2650 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2651 |
{ |
{ |
| 2652 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2653 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2654 |
} |
} |
| 2655 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2656 |
if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH); |
if (!_pcre_xclass(c, data)) MRRETURN(MATCH_NOMATCH); |
| 2657 |
} |
} |
| 2658 |
|
|
| 2659 |
/* If max == min we can continue with the main loop without the |
/* If max == min we can continue with the main loop without the |
| 2670 |
{ |
{ |
| 2671 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20); |
| 2672 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2673 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2674 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2675 |
{ |
{ |
| 2676 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2677 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2678 |
} |
} |
| 2679 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2680 |
if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH); |
if (!_pcre_xclass(c, data)) MRRETURN(MATCH_NOMATCH); |
| 2681 |
} |
} |
| 2682 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2683 |
} |
} |
| 2706 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 2707 |
if (utf8) BACKCHAR(eptr); |
if (utf8) BACKCHAR(eptr); |
| 2708 |
} |
} |
| 2709 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2710 |
} |
} |
| 2711 |
|
|
| 2712 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2725 |
if (length > md->end_subject - eptr) |
if (length > md->end_subject - eptr) |
| 2726 |
{ |
{ |
| 2727 |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
| 2728 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2729 |
} |
} |
| 2730 |
while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH); |
while (length-- > 0) if (*ecode++ != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 2731 |
} |
} |
| 2732 |
else |
else |
| 2733 |
#endif |
#endif |
| 2737 |
if (md->end_subject - eptr < 1) |
if (md->end_subject - eptr < 1) |
| 2738 |
{ |
{ |
| 2739 |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
| 2740 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2741 |
} |
} |
| 2742 |
if (ecode[1] != *eptr++) RRETURN(MATCH_NOMATCH); |
if (ecode[1] != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 2743 |
ecode += 2; |
ecode += 2; |
| 2744 |
} |
} |
| 2745 |
break; |
break; |
| 2757 |
if (length > md->end_subject - eptr) |
if (length > md->end_subject - eptr) |
| 2758 |
{ |
{ |
| 2759 |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
| 2760 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2761 |
} |
} |
| 2762 |
|
|
| 2763 |
/* If the pattern character's value is < 128, we have only one byte, and |
/* If the pattern character's value is < 128, we have only one byte, and |
| 2765 |
|
|
| 2766 |
if (fc < 128) |
if (fc < 128) |
| 2767 |
{ |
{ |
| 2768 |
if (md->lcc[*ecode++] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (md->lcc[*ecode++] != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2769 |
} |
} |
| 2770 |
|
|
| 2771 |
/* Otherwise we must pick up the subject character */ |
/* Otherwise we must pick up the subject character */ |
| 2784 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2785 |
if (dc != UCD_OTHERCASE(fc)) |
if (dc != UCD_OTHERCASE(fc)) |
| 2786 |
#endif |
#endif |
| 2787 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2788 |
} |
} |
| 2789 |
} |
} |
| 2790 |
} |
} |
| 2796 |
if (md->end_subject - eptr < 1) |
if (md->end_subject - eptr < 1) |
| 2797 |
{ |
{ |
| 2798 |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
| 2799 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2800 |
} |
} |
| 2801 |
if (md->lcc[ecode[1]] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (md->lcc[ecode[1]] != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2802 |
ecode += 2; |
ecode += 2; |
| 2803 |
} |
} |
| 2804 |
break; |
break; |
| 2892 |
else |
else |
| 2893 |
{ |
{ |
| 2894 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2895 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2896 |
} |
} |
| 2897 |
} |
} |
| 2898 |
|
|
| 2904 |
{ |
{ |
| 2905 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22); |
| 2906 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2907 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2908 |
if (eptr <= md->end_subject - length && |
if (eptr <= md->end_subject - length && |
| 2909 |
memcmp(eptr, charptr, length) == 0) eptr += length; |
memcmp(eptr, charptr, length) == 0) eptr += length; |
| 2910 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2915 |
else |
else |
| 2916 |
{ |
{ |
| 2917 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2918 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2919 |
} |
} |
| 2920 |
} |
} |
| 2921 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2946 |
{ |
{ |
| 2947 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23); |
| 2948 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2949 |
if (eptr == pp) { RRETURN(MATCH_NOMATCH); } |
if (eptr == pp) { MRRETURN(MATCH_NOMATCH); } |
| 2950 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2951 |
eptr--; |
eptr--; |
| 2952 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 2989 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2990 |
{ |
{ |
| 2991 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2992 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2993 |
} |
} |
| 2994 |
if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2995 |
} |
} |
| 2996 |
if (min == max) continue; |
if (min == max) continue; |
| 2997 |
if (minimize) |
if (minimize) |
| 3000 |
{ |
{ |
| 3001 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24); |
| 3002 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3003 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3004 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3005 |
{ |
{ |
| 3006 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3007 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3008 |
} |
} |
| 3009 |
if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 3010 |
} |
} |
| 3011 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3012 |
} |
} |
| 3032 |
eptr--; |
eptr--; |
| 3033 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3034 |
} |
} |
| 3035 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3036 |
} |
} |
| 3037 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3038 |
} |
} |
| 3046 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3047 |
{ |
{ |
| 3048 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3049 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3050 |
} |
} |
| 3051 |
if (fc != *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3052 |
} |
} |
| 3053 |
|
|
| 3054 |
if (min == max) continue; |
if (min == max) continue; |
| 3059 |
{ |
{ |
| 3060 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26); |
| 3061 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3062 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3063 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3064 |
{ |
{ |
| 3065 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3066 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3067 |
} |
} |
| 3068 |
if (fc != *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3069 |
} |
} |
| 3070 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3071 |
} |
} |
| 3090 |
eptr--; |
eptr--; |
| 3091 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3092 |
} |
} |
| 3093 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3094 |
} |
} |
| 3095 |
} |
} |
| 3096 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3102 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3103 |
{ |
{ |
| 3104 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3105 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3106 |
} |
} |
| 3107 |
ecode++; |
ecode++; |
| 3108 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3112 |
if (c < 256) |
if (c < 256) |
| 3113 |
#endif |
#endif |
| 3114 |
c = md->lcc[c]; |
c = md->lcc[c]; |
| 3115 |
if (md->lcc[*ecode++] == c) RRETURN(MATCH_NOMATCH); |
if (md->lcc[*ecode++] == c) MRRETURN(MATCH_NOMATCH); |
| 3116 |
} |
} |
| 3117 |
else |
else |
| 3118 |
{ |
{ |
| 3119 |
if (*ecode++ == c) RRETURN(MATCH_NOMATCH); |
if (*ecode++ == c) MRRETURN(MATCH_NOMATCH); |
| 3120 |
} |
} |
| 3121 |
break; |
break; |
| 3122 |
|
|
| 3210 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3211 |
{ |
{ |
| 3212 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3213 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3214 |
} |
} |
| 3215 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3216 |
if (d < 256) d = md->lcc[d]; |
if (d < 256) d = md->lcc[d]; |
| 3217 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3218 |
} |
} |
| 3219 |
} |
} |
| 3220 |
else |
else |
| 3227 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3228 |
{ |
{ |
| 3229 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3230 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3231 |
} |
} |
| 3232 |
if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc == md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 3233 |
} |
} |
| 3234 |
} |
} |
| 3235 |
|
|
| 3246 |
{ |
{ |
| 3247 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28); |
| 3248 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3249 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3250 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3251 |
{ |
{ |
| 3252 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3253 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3254 |
} |
} |
| 3255 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3256 |
if (d < 256) d = md->lcc[d]; |
if (d < 256) d = md->lcc[d]; |
| 3257 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3258 |
} |
} |
| 3259 |
} |
} |
| 3260 |
else |
else |
| 3265 |
{ |
{ |
| 3266 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29); |
| 3267 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3268 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3269 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3270 |
{ |
{ |
| 3271 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3272 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3273 |
} |
} |
| 3274 |
if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc == md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 3275 |
} |
} |
| 3276 |
} |
} |
| 3277 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3333 |
} |
} |
| 3334 |
} |
} |
| 3335 |
|
|
| 3336 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3337 |
} |
} |
| 3338 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3339 |
} |
} |
| 3352 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3353 |
{ |
{ |
| 3354 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3355 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3356 |
} |
} |
| 3357 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3358 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3359 |
} |
} |
| 3360 |
} |
} |
| 3361 |
else |
else |
| 3367 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3368 |
{ |
{ |
| 3369 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3370 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3371 |
} |
} |
| 3372 |
if (fc == *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc == *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3373 |
} |
} |
| 3374 |
} |
} |
| 3375 |
|
|
| 3386 |
{ |
{ |
| 3387 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32); |
| 3388 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3389 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3390 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3391 |
{ |
{ |
| 3392 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3393 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3394 |
} |
} |
| 3395 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3396 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3397 |
} |
} |
| 3398 |
} |
} |
| 3399 |
else |
else |
| 3404 |
{ |
{ |
| 3405 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33); |
| 3406 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3407 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3408 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3409 |
{ |
{ |
| 3410 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3411 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3412 |
} |
} |
| 3413 |
if (fc == *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc == *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3414 |
} |
} |
| 3415 |
} |
} |
| 3416 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3471 |
} |
} |
| 3472 |
} |
} |
| 3473 |
|
|
| 3474 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3475 |
} |
} |
| 3476 |
} |
} |
| 3477 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3565 |
switch(prop_type) |
switch(prop_type) |
| 3566 |
{ |
{ |
| 3567 |
case PT_ANY: |
case PT_ANY: |
| 3568 |
if (prop_fail_result) RRETURN(MATCH_NOMATCH); |
if (prop_fail_result) MRRETURN(MATCH_NOMATCH); |
| 3569 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
| 3570 |
{ |
{ |
| 3571 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3572 |
{ |
{ |
| 3573 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3574 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3575 |
} |
} |
| 3576 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3577 |
} |
} |
| 3583 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3584 |
{ |
{ |
| 3585 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3586 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3587 |
} |
} |
| 3588 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3589 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 3590 |
if ((prop_chartype == ucp_Lu || |
if ((prop_chartype == ucp_Lu || |
| 3591 |
prop_chartype == ucp_Ll || |
prop_chartype == ucp_Ll || |
| 3592 |
prop_chartype == ucp_Lt) == prop_fail_result) |
prop_chartype == ucp_Lt) == prop_fail_result) |
| 3593 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3594 |
} |
} |
| 3595 |
break; |
break; |
| 3596 |
|
|
| 3600 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3601 |
{ |
{ |
| 3602 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3603 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3604 |
} |
} |
| 3605 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3606 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 3607 |
if ((prop_category == prop_value) == prop_fail_result) |
if ((prop_category == prop_value) == prop_fail_result) |
| 3608 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3609 |
} |
} |
| 3610 |
break; |
break; |
| 3611 |
|
|
| 3615 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3616 |
{ |
{ |
| 3617 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3618 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3619 |
} |
} |
| 3620 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3621 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 3622 |
if ((prop_chartype == prop_value) == prop_fail_result) |
if ((prop_chartype == prop_value) == prop_fail_result) |
| 3623 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3624 |
} |
} |
| 3625 |
break; |
break; |
| 3626 |
|
|
| 3630 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3631 |
{ |
{ |
| 3632 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3633 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3634 |
} |
} |
| 3635 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3636 |
prop_script = UCD_SCRIPT(c); |
prop_script = UCD_SCRIPT(c); |
| 3637 |
if ((prop_script == prop_value) == prop_fail_result) |
if ((prop_script == prop_value) == prop_fail_result) |
| 3638 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3639 |
} |
} |
| 3640 |
break; |
break; |
| 3641 |
|
|
| 3642 |
|
case PT_ALNUM: |
| 3643 |
|
for (i = 1; i <= min; i++) |
| 3644 |
|
{ |
| 3645 |
|
if (eptr >= md->end_subject) |
| 3646 |
|
{ |
| 3647 |
|
SCHECK_PARTIAL(); |
| 3648 |
|
MRRETURN(MATCH_NOMATCH); |
| 3649 |
|
} |
| 3650 |
|
GETCHARINCTEST(c, eptr); |
| 3651 |
|
prop_category = UCD_CATEGORY(c); |
| 3652 |
|
if ((prop_category == ucp_L || prop_category == ucp_N) |
| 3653 |
|
== prop_fail_result) |
| 3654 |
|
MRRETURN(MATCH_NOMATCH); |
| 3655 |
|
} |
| 3656 |
|
break; |
| 3657 |
|
|
| 3658 |
|
case PT_SPACE: /* Perl space */ |
| 3659 |
|
for (i = 1; i <= min; i++) |
| 3660 |
|
{ |
| 3661 |
|
if (eptr >= md->end_subject) |
| 3662 |
|
{ |
| 3663 |
|
SCHECK_PARTIAL(); |
| 3664 |
|
MRRETURN(MATCH_NOMATCH); |
| 3665 |
|
} |
| 3666 |
|
GETCHARINCTEST(c, eptr); |
| 3667 |
|
prop_category = UCD_CATEGORY(c); |
| 3668 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 3669 |
|
c == CHAR_FF || c == CHAR_CR) |
| 3670 |
|
== prop_fail_result) |
| 3671 |
|
MRRETURN(MATCH_NOMATCH); |
| 3672 |
|
} |
| 3673 |
|
break; |
| 3674 |
|
|
| 3675 |
|
case PT_PXSPACE: /* POSIX space */ |
| 3676 |
|
for (i = 1; i <= min; i++) |
| 3677 |
|
{ |
| 3678 |
|
if (eptr >= md->end_subject) |
| 3679 |
|
{ |
| 3680 |
|
SCHECK_PARTIAL(); |
| 3681 |
|
MRRETURN(MATCH_NOMATCH); |
| 3682 |
|
} |
| 3683 |
|
GETCHARINCTEST(c, eptr); |
| 3684 |
|
prop_category = UCD_CATEGORY(c); |
| 3685 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 3686 |
|
c == CHAR_VT || c == CHAR_FF || c == CHAR_CR) |
| 3687 |
|
== prop_fail_result) |
| 3688 |
|
MRRETURN(MATCH_NOMATCH); |
| 3689 |
|
} |
| 3690 |
|
break; |
| 3691 |
|
|
| 3692 |
|
case PT_WORD: |
| 3693 |
|
for (i = 1; i <= min; i++) |
| 3694 |
|
{ |
| 3695 |
|
if (eptr >= md->end_subject) |
| 3696 |
|
{ |
| 3697 |
|
SCHECK_PARTIAL(); |
| 3698 |
|
MRRETURN(MATCH_NOMATCH); |
| 3699 |
|
} |
| 3700 |
|
GETCHARINCTEST(c, eptr); |
| 3701 |
|
prop_category = UCD_CATEGORY(c); |
| 3702 |
|
if ((prop_category == ucp_L || prop_category == ucp_N || |
| 3703 |
|
c == CHAR_UNDERSCORE) |
| 3704 |
|
== prop_fail_result) |
| 3705 |
|
MRRETURN(MATCH_NOMATCH); |
| 3706 |
|
} |
| 3707 |
|
break; |
| 3708 |
|
|
| 3709 |
|
/* This should not occur */ |
| 3710 |
|
|
| 3711 |
default: |
default: |
| 3712 |
RRETURN(PCRE_ERROR_INTERNAL); |
RRETURN(PCRE_ERROR_INTERNAL); |
| 3713 |
} |
} |
| 3723 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3724 |
{ |
{ |
| 3725 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3726 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3727 |
} |
} |
| 3728 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3729 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 3730 |
if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH); |
if (prop_category == ucp_M) MRRETURN(MATCH_NOMATCH); |
| 3731 |
while (eptr < md->end_subject) |
while (eptr < md->end_subject) |
| 3732 |
{ |
{ |
| 3733 |
int len = 1; |
int len = 1; |
| 3754 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3755 |
{ |
{ |
| 3756 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3757 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3758 |
} |
} |
| 3759 |
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); |
if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); |
| 3760 |
eptr++; |
eptr++; |
| 3761 |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 3762 |
} |
} |
| 3768 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3769 |
{ |
{ |
| 3770 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3771 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3772 |
} |
} |
| 3773 |
eptr++; |
eptr++; |
| 3774 |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 3776 |
break; |
break; |
| 3777 |
|
|
| 3778 |
case OP_ANYBYTE: |
case OP_ANYBYTE: |
| 3779 |
if (eptr > md->end_subject - min) RRETURN(MATCH_NOMATCH); |
if (eptr > md->end_subject - min) MRRETURN(MATCH_NOMATCH); |
| 3780 |
eptr += min; |
eptr += min; |
| 3781 |
break; |
break; |
| 3782 |
|
|
| 3786 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3787 |
{ |
{ |
| 3788 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3789 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3790 |
} |
} |
| 3791 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3792 |
switch(c) |
switch(c) |
| 3793 |
{ |
{ |
| 3794 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3795 |
|
|
| 3796 |
case 0x000d: |
case 0x000d: |
| 3797 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 3798 |
break; |
break; |
| 3805 |
case 0x0085: |
case 0x0085: |
| 3806 |
case 0x2028: |
case 0x2028: |
| 3807 |
case 0x2029: |
case 0x2029: |
| 3808 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 3809 |
break; |
break; |
| 3810 |
} |
} |
| 3811 |
} |
} |
| 3817 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3818 |
{ |
{ |
| 3819 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3820 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3821 |
} |
} |
| 3822 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3823 |
switch(c) |
switch(c) |
| 3842 |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 3843 |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 3844 |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 3845 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3846 |
} |
} |
| 3847 |
} |
} |
| 3848 |
break; |
break; |
| 3853 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3854 |
{ |
{ |
| 3855 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3856 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3857 |
} |
} |
| 3858 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3859 |
switch(c) |
switch(c) |
| 3860 |
{ |
{ |
| 3861 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3862 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 3863 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 3864 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 3889 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3890 |
{ |
{ |
| 3891 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3892 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3893 |
} |
} |
| 3894 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3895 |
switch(c) |
switch(c) |
| 3902 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 3903 |
case 0x2028: /* LINE SEPARATOR */ |
case 0x2028: /* LINE SEPARATOR */ |
| 3904 |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 3905 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3906 |
} |
} |
| 3907 |
} |
} |
| 3908 |
break; |
break; |
| 3913 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3914 |
{ |
{ |
| 3915 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3916 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3917 |
} |
} |
| 3918 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3919 |
switch(c) |
switch(c) |
| 3920 |
{ |
{ |
| 3921 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3922 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 3923 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 3924 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 3937 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3938 |
{ |
{ |
| 3939 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3940 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3941 |
} |
} |
| 3942 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3943 |
if (c < 128 && (md->ctypes[c] & ctype_digit) != 0) |
if (c < 128 && (md->ctypes[c] & ctype_digit) != 0) |
| 3944 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3945 |
} |
} |
| 3946 |
break; |
break; |
| 3947 |
|
|
| 3951 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3952 |
{ |
{ |
| 3953 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3954 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3955 |
} |
} |
| 3956 |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_digit) == 0) |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_digit) == 0) |
| 3957 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3958 |
/* No need to skip more bytes - we know it's a 1-byte character */ |
/* No need to skip more bytes - we know it's a 1-byte character */ |
| 3959 |
} |
} |
| 3960 |
break; |
break; |
| 3965 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3966 |
{ |
{ |
| 3967 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3968 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3969 |
} |
} |
| 3970 |
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0) |
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0) |
| 3971 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3972 |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
| 3973 |
} |
} |
| 3974 |
break; |
break; |
| 3979 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3980 |
{ |
{ |
| 3981 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3982 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3983 |
} |
} |
| 3984 |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_space) == 0) |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_space) == 0) |
| 3985 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3986 |
/* No need to skip more bytes - we know it's a 1-byte character */ |
/* No need to skip more bytes - we know it's a 1-byte character */ |
| 3987 |
} |
} |
| 3988 |
break; |
break; |
| 3993 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3994 |
{ |
{ |
| 3995 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3996 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3997 |
} |
} |
| 3998 |
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0) |
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0) |
| 3999 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4000 |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
| 4001 |
} |
} |
| 4002 |
break; |
break; |
| 4007 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4008 |
{ |
{ |
| 4009 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4010 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4011 |
} |
} |
| 4012 |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_word) == 0) |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_word) == 0) |
| 4013 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4014 |
/* No need to skip more bytes - we know it's a 1-byte character */ |
/* No need to skip more bytes - we know it's a 1-byte character */ |
| 4015 |
} |
} |
| 4016 |
break; |
break; |
| 4033 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4034 |
{ |
{ |
| 4035 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4036 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4037 |
} |
} |
| 4038 |
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); |
if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); |
| 4039 |
eptr++; |
eptr++; |
| 4040 |
} |
} |
| 4041 |
break; |
break; |
| 4044 |
if (eptr > md->end_subject - min) |
if (eptr > md->end_subject - min) |
| 4045 |
{ |
{ |
| 4046 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4047 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4048 |
} |
} |
| 4049 |
eptr += min; |
eptr += min; |
| 4050 |
break; |
break; |
| 4053 |
if (eptr > md->end_subject - min) |
if (eptr > md->end_subject - min) |
| 4054 |
{ |
{ |
| 4055 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4056 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4057 |
} |
} |
| 4058 |
eptr += min; |
eptr += min; |
| 4059 |
break; |
break; |
| 4064 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4065 |
{ |
{ |
| 4066 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4067 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4068 |
} |
} |
| 4069 |
switch(*eptr++) |
switch(*eptr++) |
| 4070 |
{ |
{ |
| 4071 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4072 |
|
|
| 4073 |
case 0x000d: |
case 0x000d: |
| 4074 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 4075 |
break; |
break; |
| 4076 |
|
|
| 4077 |
case 0x000a: |
case 0x000a: |
| 4078 |
break; |
break; |
| 4079 |
|
|
| 4080 |
case 0x000b: |
case 0x000b: |
| 4081 |
case 0x000c: |
case 0x000c: |
| 4082 |
case 0x0085: |
case 0x0085: |
| 4083 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 4084 |
break; |
break; |
| 4085 |
} |
} |
| 4086 |
} |
} |
| 4092 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4093 |
{ |
{ |
| 4094 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4095 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4096 |
} |
} |
| 4097 |
switch(*eptr++) |
switch(*eptr++) |
| 4098 |
{ |
{ |
| 4100 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4101 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4102 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4103 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4104 |
} |
} |
| 4105 |
} |
} |
| 4106 |
break; |
break; |
| 4111 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4112 |
{ |
{ |
| 4113 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4114 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4115 |
} |
} |
| 4116 |
switch(*eptr++) |
switch(*eptr++) |
| 4117 |
{ |
{ |
| 4118 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4119 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4120 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4121 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4130 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4131 |
{ |
{ |
| 4132 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4133 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4134 |
} |
} |
| 4135 |
switch(*eptr++) |
switch(*eptr++) |
| 4136 |
{ |
{ |
| 4140 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4141 |
case 0x0d: /* CR */ |
case 0x0d: /* CR */ |
| 4142 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 4143 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4144 |
} |
} |
| 4145 |
} |
} |
| 4146 |
break; |
break; |
| 4151 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4152 |
{ |
{ |
| 4153 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4154 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4155 |
} |
} |
| 4156 |
switch(*eptr++) |
switch(*eptr++) |
| 4157 |
{ |
{ |
| 4158 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4159 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 4160 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 4161 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4172 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4173 |
{ |
{ |
| 4174 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4175 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4176 |
} |
} |
| 4177 |
if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_digit) != 0) MRRETURN(MATCH_NOMATCH); |
| 4178 |
} |
} |
| 4179 |
break; |
break; |
| 4180 |
|
|
| 4184 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4185 |
{ |
{ |
| 4186 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4187 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4188 |
} |
} |
| 4189 |
if ((md->ctypes[*eptr++] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_digit) == 0) MRRETURN(MATCH_NOMATCH); |
| 4190 |
} |
} |
| 4191 |
break; |
break; |
| 4192 |
|
|
| 4196 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4197 |
{ |
{ |
| 4198 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4199 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4200 |
} |
} |
| 4201 |
if ((md->ctypes[*eptr++] & ctype_space) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_space) != 0) MRRETURN(MATCH_NOMATCH); |
| 4202 |
} |
} |
| 4203 |
break; |
break; |
| 4204 |
|
|
| 4208 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4209 |
{ |
{ |
| 4210 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4211 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4212 |
} |
} |
| 4213 |
if ((md->ctypes[*eptr++] & ctype_space) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_space) == 0) MRRETURN(MATCH_NOMATCH); |
| 4214 |
} |
} |
| 4215 |
break; |
break; |
| 4216 |
|
|
| 4220 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4221 |
{ |
{ |
| 4222 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4223 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4224 |
} |
} |
| 4225 |
if ((md->ctypes[*eptr++] & ctype_word) != 0) |
if ((md->ctypes[*eptr++] & ctype_word) != 0) |
| 4226 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4227 |
} |
} |
| 4228 |
break; |
break; |
| 4229 |
|
|
| 4233 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4234 |
{ |
{ |
| 4235 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4236 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4237 |
} |
} |
| 4238 |
if ((md->ctypes[*eptr++] & ctype_word) == 0) |
if ((md->ctypes[*eptr++] & ctype_word) == 0) |
| 4239 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4240 |
} |
} |
| 4241 |
break; |
break; |
| 4242 |
|
|
| 4265 |
{ |
{ |
| 4266 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36); |
| 4267 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4268 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4269 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4270 |
{ |
{ |
| 4271 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4272 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4273 |
} |
} |
| 4274 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4275 |
if (prop_fail_result) RRETURN(MATCH_NOMATCH); |
if (prop_fail_result) MRRETURN(MATCH_NOMATCH); |
| 4276 |
} |
} |
| 4277 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4278 |
|
|
| 4281 |
{ |
{ |
| 4282 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37); |
| 4283 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4284 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4285 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4286 |
{ |
{ |
| 4287 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4288 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4289 |
} |
} |
| 4290 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4291 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4292 |
if ((prop_chartype == ucp_Lu || |
if ((prop_chartype == ucp_Lu || |
| 4293 |
prop_chartype == ucp_Ll || |
prop_chartype == ucp_Ll || |
| 4294 |
prop_chartype == ucp_Lt) == prop_fail_result) |
prop_chartype == ucp_Lt) == prop_fail_result) |
| 4295 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4296 |
} |
} |
| 4297 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4298 |
|
|
| 4301 |
{ |
{ |
| 4302 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38); |
| 4303 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4304 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4305 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4306 |
{ |
{ |
| 4307 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4308 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4309 |
} |
} |
| 4310 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4311 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4312 |
if ((prop_category == prop_value) == prop_fail_result) |
if ((prop_category == prop_value) == prop_fail_result) |
| 4313 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4314 |
} |
} |
| 4315 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4316 |
|
|
| 4319 |
{ |
{ |
| 4320 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39); |
| 4321 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4322 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4323 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4324 |
{ |
{ |
| 4325 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4326 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4327 |
} |
} |
| 4328 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4329 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4330 |
if ((prop_chartype == prop_value) == prop_fail_result) |
if ((prop_chartype == prop_value) == prop_fail_result) |
| 4331 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4332 |
} |
} |
| 4333 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4334 |
|
|
| 4337 |
{ |
{ |
| 4338 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40); |
| 4339 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4340 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4341 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4342 |
{ |
{ |
| 4343 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4344 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4345 |
} |
} |
| 4346 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4347 |
prop_script = UCD_SCRIPT(c); |
prop_script = UCD_SCRIPT(c); |
| 4348 |
if ((prop_script == prop_value) == prop_fail_result) |
if ((prop_script == prop_value) == prop_fail_result) |
| 4349 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4350 |
} |
} |
| 4351 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4352 |
|
|
| 4353 |
|
case PT_ALNUM: |
| 4354 |
|
for (fi = min;; fi++) |
| 4355 |
|
{ |
| 4356 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM59); |
| 4357 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4358 |
|
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4359 |
|
if (eptr >= md->end_subject) |
| 4360 |
|
{ |
| 4361 |
|
SCHECK_PARTIAL(); |
| 4362 |
|
MRRETURN(MATCH_NOMATCH); |
| 4363 |
|
} |
| 4364 |
|
GETCHARINCTEST(c, eptr); |
| 4365 |
|
prop_category = UCD_CATEGORY(c); |
| 4366 |
|
if ((prop_category == ucp_L || prop_category == ucp_N) |
| 4367 |
|
== prop_fail_result) |
| 4368 |
|
MRRETURN(MATCH_NOMATCH); |
| 4369 |
|
} |
| 4370 |
|
/* Control never gets here */ |
| 4371 |
|
|
| 4372 |
|
case PT_SPACE: /* Perl space */ |
| 4373 |
|
for (fi = min;; fi++) |
| 4374 |
|
{ |
| 4375 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM60); |
| 4376 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4377 |
|
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4378 |
|
if (eptr >= md->end_subject) |
| 4379 |
|
{ |
| 4380 |
|
SCHECK_PARTIAL(); |
| 4381 |
|
MRRETURN(MATCH_NOMATCH); |
| 4382 |
|
} |
| 4383 |
|
GETCHARINCTEST(c, eptr); |
| 4384 |
|
prop_category = UCD_CATEGORY(c); |
| 4385 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 4386 |
|
c == CHAR_FF || c == CHAR_CR) |
| 4387 |
|
== prop_fail_result) |
| 4388 |
|
MRRETURN(MATCH_NOMATCH); |
| 4389 |
|
} |
| 4390 |
|
/* Control never gets here */ |
| 4391 |
|
|
| 4392 |
|
case PT_PXSPACE: /* POSIX space */ |
| 4393 |
|
for (fi = min;; fi++) |
| 4394 |
|
{ |
| 4395 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM61); |
| 4396 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4397 |
|
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4398 |
|
if (eptr >= md->end_subject) |
| 4399 |
|
{ |
| 4400 |
|
SCHECK_PARTIAL(); |
| 4401 |
|
MRRETURN(MATCH_NOMATCH); |
| 4402 |
|
} |
| 4403 |
|
GETCHARINCTEST(c, eptr); |
| 4404 |
|
prop_category = UCD_CATEGORY(c); |
| 4405 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 4406 |
|
c == CHAR_VT || c == CHAR_FF || c == CHAR_CR) |
| 4407 |
|
== prop_fail_result) |
| 4408 |
|
MRRETURN(MATCH_NOMATCH); |
| 4409 |
|
} |
| 4410 |
|
/* Control never gets here */ |
| 4411 |
|
|
| 4412 |
|
case PT_WORD: |
| 4413 |
|
for (fi = min;; fi++) |
| 4414 |
|
{ |
| 4415 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM62); |
| 4416 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4417 |
|
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4418 |
|
if (eptr >= md->end_subject) |
| 4419 |
|
{ |
| 4420 |
|
SCHECK_PARTIAL(); |
| 4421 |
|
MRRETURN(MATCH_NOMATCH); |
| 4422 |
|
} |
| 4423 |
|
GETCHARINCTEST(c, eptr); |
| 4424 |
|
prop_category = UCD_CATEGORY(c); |
| 4425 |
|
if ((prop_category == ucp_L || |
| 4426 |
|
prop_category == ucp_N || |
| 4427 |
|
c == CHAR_UNDERSCORE) |
| 4428 |
|
== prop_fail_result) |
| 4429 |
|
MRRETURN(MATCH_NOMATCH); |
| 4430 |
|
} |
| 4431 |
|
/* Control never gets here */ |
| 4432 |
|
|
| 4433 |
|
/* This should never occur */ |
| 4434 |
|
|
| 4435 |
default: |
default: |
| 4436 |
RRETURN(PCRE_ERROR_INTERNAL); |
RRETURN(PCRE_ERROR_INTERNAL); |
| 4437 |
} |
} |
| 4446 |
{ |
{ |
| 4447 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41); |
| 4448 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4449 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4450 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4451 |
{ |
{ |
| 4452 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4453 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4454 |
} |
} |
| 4455 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4456 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4457 |
if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH); |
if (prop_category == ucp_M) MRRETURN(MATCH_NOMATCH); |
| 4458 |
while (eptr < md->end_subject) |
while (eptr < md->end_subject) |
| 4459 |
{ |
{ |
| 4460 |
int len = 1; |
int len = 1; |
| 4478 |
{ |
{ |
| 4479 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42); |
| 4480 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4481 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4482 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4483 |
{ |
{ |
| 4484 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4485 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4486 |
} |
} |
| 4487 |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
| 4488 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4489 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 4490 |
switch(ctype) |
switch(ctype) |
| 4491 |
{ |
{ |
| 4497 |
case OP_ANYNL: |
case OP_ANYNL: |
| 4498 |
switch(c) |
switch(c) |
| 4499 |
{ |
{ |
| 4500 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4501 |
case 0x000d: |
case 0x000d: |
| 4502 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 4503 |
break; |
break; |
| 4509 |
case 0x0085: |
case 0x0085: |
| 4510 |
case 0x2028: |
case 0x2028: |
| 4511 |
case 0x2029: |
case 0x2029: |
| 4512 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 4513 |
break; |
break; |
| 4514 |
} |
} |
| 4515 |
break; |
break; |
| 4537 |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 4538 |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 4539 |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 4540 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4541 |
} |
} |
| 4542 |
break; |
break; |
| 4543 |
|
|
| 4544 |
case OP_HSPACE: |
case OP_HSPACE: |
| 4545 |
switch(c) |
switch(c) |
| 4546 |
{ |
{ |
| 4547 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4548 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4549 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4550 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4579 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 4580 |
case 0x2028: /* LINE SEPARATOR */ |
case 0x2028: /* LINE SEPARATOR */ |
| 4581 |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 4582 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4583 |
} |
} |
| 4584 |
break; |
break; |
| 4585 |
|
|
| 4586 |
case OP_VSPACE: |
case OP_VSPACE: |
| 4587 |
switch(c) |
switch(c) |
| 4588 |
{ |
{ |
| 4589 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4590 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 4591 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 4592 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4600 |
|
|
| 4601 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 4602 |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) |
| 4603 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4604 |
break; |
break; |
| 4605 |
|
|
| 4606 |
case OP_DIGIT: |
case OP_DIGIT: |
| 4607 |
if (c >= 256 || (md->ctypes[c] & ctype_digit) == 0) |
if (c >= 256 || (md->ctypes[c] & ctype_digit) == 0) |
| 4608 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4609 |
break; |
break; |
| 4610 |
|
|
| 4611 |
case OP_NOT_WHITESPACE: |
case OP_NOT_WHITESPACE: |
| 4612 |
if (c < 256 && (md->ctypes[c] & ctype_space) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_space) != 0) |
| 4613 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4614 |
break; |
break; |
| 4615 |
|
|
| 4616 |
case OP_WHITESPACE: |
case OP_WHITESPACE: |
| 4617 |
if (c >= 256 || (md->ctypes[c] & ctype_space) == 0) |
if (c >= 256 || (md->ctypes[c] & ctype_space) == 0) |
| 4618 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4619 |
break; |
break; |
| 4620 |
|
|
| 4621 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 4622 |
if (c < 256 && (md->ctypes[c] & ctype_word) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_word) != 0) |
| 4623 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4624 |
break; |
break; |
| 4625 |
|
|
| 4626 |
case OP_WORDCHAR: |
case OP_WORDCHAR: |
| 4627 |
if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) |
if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) |
| 4628 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4629 |
break; |
break; |
| 4630 |
|
|
| 4631 |
default: |
default: |
| 4641 |
{ |
{ |
| 4642 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43); |
| 4643 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4644 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4645 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4646 |
{ |
{ |
| 4647 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4648 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4649 |
} |
} |
| 4650 |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
| 4651 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4652 |
c = *eptr++; |
c = *eptr++; |
| 4653 |
switch(ctype) |
switch(ctype) |
| 4654 |
{ |
{ |
| 4660 |
case OP_ANYNL: |
case OP_ANYNL: |
| 4661 |
switch(c) |
switch(c) |
| 4662 |
{ |
{ |
| 4663 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4664 |
case 0x000d: |
case 0x000d: |
| 4665 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 4666 |
break; |
break; |
| 4671 |
case 0x000b: |
case 0x000b: |
| 4672 |
case 0x000c: |
case 0x000c: |
| 4673 |
case 0x0085: |
case 0x0085: |
| 4674 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 4675 |
break; |
break; |
| 4676 |
} |
} |
| 4677 |
break; |
break; |
| 4683 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4684 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4685 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4686 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4687 |
} |
} |
| 4688 |
break; |
break; |
| 4689 |
|
|
| 4690 |
case OP_HSPACE: |
case OP_HSPACE: |
| 4691 |
switch(c) |
switch(c) |
| 4692 |
{ |
{ |
| 4693 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4694 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4695 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4696 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4707 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4708 |
case 0x0d: /* CR */ |
case 0x0d: /* CR */ |
| 4709 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 4710 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4711 |
} |
} |
| 4712 |
break; |
break; |
| 4713 |
|
|
| 4714 |
case OP_VSPACE: |
case OP_VSPACE: |
| 4715 |
switch(c) |
switch(c) |
| 4716 |
{ |
{ |
| 4717 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4718 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 4719 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 4720 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4725 |
break; |
break; |
| 4726 |
|
|
| 4727 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 4728 |
if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_digit) != 0) MRRETURN(MATCH_NOMATCH); |
| 4729 |
break; |
break; |
| 4730 |
|
|
| 4731 |
case OP_DIGIT: |
case OP_DIGIT: |
| 4732 |
if ((md->ctypes[c] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_digit) == 0) MRRETURN(MATCH_NOMATCH); |
| 4733 |
break; |
break; |
| 4734 |
|
|
| 4735 |
case OP_NOT_WHITESPACE: |
case OP_NOT_WHITESPACE: |
| 4736 |
if ((md->ctypes[c] & ctype_space) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_space) != 0) MRRETURN(MATCH_NOMATCH); |
| 4737 |
break; |
break; |
| 4738 |
|
|
| 4739 |
case OP_WHITESPACE: |
case OP_WHITESPACE: |
| 4740 |
if ((md->ctypes[c] & ctype_space) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_space) == 0) MRRETURN(MATCH_NOMATCH); |
| 4741 |
break; |
break; |
| 4742 |
|
|
| 4743 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 4744 |
if ((md->ctypes[c] & ctype_word) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_word) != 0) MRRETURN(MATCH_NOMATCH); |
| 4745 |
break; |
break; |
| 4746 |
|
|
| 4747 |
case OP_WORDCHAR: |
case OP_WORDCHAR: |
| 4748 |
if ((md->ctypes[c] & ctype_word) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_word) == 0) MRRETURN(MATCH_NOMATCH); |
| 4749 |
break; |
break; |
| 4750 |
|
|
| 4751 |
default: |
default: |
| 4778 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4779 |
break; |
break; |
| 4780 |
} |
} |
| 4781 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4782 |
if (prop_fail_result) break; |
if (prop_fail_result) break; |
| 4783 |
eptr+= len; |
eptr+= len; |
| 4784 |
} |
} |
| 4793 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4794 |
break; |
break; |
| 4795 |
} |
} |
| 4796 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4797 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4798 |
if ((prop_chartype == ucp_Lu || |
if ((prop_chartype == ucp_Lu || |
| 4799 |
prop_chartype == ucp_Ll || |
prop_chartype == ucp_Ll || |
| 4812 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4813 |
break; |
break; |
| 4814 |
} |
} |
| 4815 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4816 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4817 |
if ((prop_category == prop_value) == prop_fail_result) |
if ((prop_category == prop_value) == prop_fail_result) |
| 4818 |
break; |
break; |
| 4829 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4830 |
break; |
break; |
| 4831 |
} |
} |
| 4832 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4833 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4834 |
if ((prop_chartype == prop_value) == prop_fail_result) |
if ((prop_chartype == prop_value) == prop_fail_result) |
| 4835 |
break; |
break; |
| 4846 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4847 |
break; |
break; |
| 4848 |
} |
} |
| 4849 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4850 |
prop_script = UCD_SCRIPT(c); |
prop_script = UCD_SCRIPT(c); |
| 4851 |
if ((prop_script == prop_value) == prop_fail_result) |
if ((prop_script == prop_value) == prop_fail_result) |
| 4852 |
break; |
break; |
| 4853 |
eptr+= len; |
eptr+= len; |
| 4854 |
} |
} |
| 4855 |
break; |
break; |
| 4856 |
|
|
| 4857 |
|
case PT_ALNUM: |
| 4858 |
|
for (i = min; i < max; i++) |
| 4859 |
|
{ |
| 4860 |
|
int len = 1; |
| 4861 |
|
if (eptr >= md->end_subject) |
| 4862 |
|
{ |
| 4863 |
|
SCHECK_PARTIAL(); |
| 4864 |
|
break; |
| 4865 |
|
} |
| 4866 |
|
GETCHARLENTEST(c, eptr, len); |
| 4867 |
|
prop_category = UCD_CATEGORY(c); |
| 4868 |
|
if ((prop_category == ucp_L || prop_category == ucp_N) |
| 4869 |
|
== prop_fail_result) |
| 4870 |
|
break; |
| 4871 |
|
eptr+= len; |
| 4872 |
|
} |
| 4873 |
|
break; |
| 4874 |
|
|
| 4875 |
|
case PT_SPACE: /* Perl space */ |
| 4876 |
|
for (i = min; i < max; i++) |
| 4877 |
|
{ |
| 4878 |
|
int len = 1; |
| 4879 |
|
if (eptr >= md->end_subject) |
| 4880 |
|
{ |
| 4881 |
|
SCHECK_PARTIAL(); |
| 4882 |
|
break; |
| 4883 |
|
} |
| 4884 |
|
GETCHARLENTEST(c, eptr, len); |
| 4885 |
|
prop_category = UCD_CATEGORY(c); |
| 4886 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 4887 |
|
c == CHAR_FF || c == CHAR_CR) |
| 4888 |
|
== prop_fail_result) |
| 4889 |
|
break; |
| 4890 |
|
eptr+= len; |
| 4891 |
|
} |
| 4892 |
|
break; |
| 4893 |
|
|
| 4894 |
|
case PT_PXSPACE: /* POSIX space */ |
| 4895 |
|
for (i = min; i < max; i++) |
| 4896 |
|
{ |
| 4897 |
|
int len = 1; |
| 4898 |
|
if (eptr >= md->end_subject) |
| 4899 |
|
{ |
| 4900 |
|
SCHECK_PARTIAL(); |
| 4901 |
|
break; |
| 4902 |
|
} |
| 4903 |
|
GETCHARLENTEST(c, eptr, len); |
| 4904 |
|
prop_category = UCD_CATEGORY(c); |
| 4905 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 4906 |
|
c == CHAR_VT || c == CHAR_FF || c == CHAR_CR) |
| 4907 |
|
== prop_fail_result) |
| 4908 |
|
break; |
| 4909 |
|
eptr+= len; |
| 4910 |
|
} |
| 4911 |
|
break; |
| 4912 |
|
|
| 4913 |
|
case PT_WORD: |
| 4914 |
|
for (i = min; i < max; i++) |
| 4915 |
|
{ |
| 4916 |
|
int len = 1; |
| 4917 |
|
if (eptr >= md->end_subject) |
| 4918 |
|
{ |
| 4919 |
|
SCHECK_PARTIAL(); |
| 4920 |
|
break; |
| 4921 |
|
} |
| 4922 |
|
GETCHARLENTEST(c, eptr, len); |
| 4923 |
|
prop_category = UCD_CATEGORY(c); |
| 4924 |
|
if ((prop_category == ucp_L || prop_category == ucp_N || |
| 4925 |
|
c == CHAR_UNDERSCORE) == prop_fail_result) |
| 4926 |
|
break; |
| 4927 |
|
eptr+= len; |
| 4928 |
|
} |
| 4929 |
|
break; |
| 4930 |
|
|
| 4931 |
|
default: |
| 4932 |
|
RRETURN(PCRE_ERROR_INTERNAL); |
| 4933 |
} |
} |
| 4934 |
|
|
| 4935 |
/* eptr is now past the end of the maximum run */ |
/* eptr is now past the end of the maximum run */ |
| 5262 |
RRETURN(PCRE_ERROR_INTERNAL); |
RRETURN(PCRE_ERROR_INTERNAL); |
| 5263 |
} |
} |
| 5264 |
|
|
| 5265 |
/* eptr is now past the end of the maximum run */ |
/* eptr is now past the end of the maximum run. If possessive, we are |
| 5266 |
|
done (no backing up). Otherwise, match at this position; anything other |
| 5267 |
|
than no match is immediately returned. For nomatch, back up one |
| 5268 |
|
character, unless we are matching \R and the last thing matched was |
| 5269 |
|
\r\n, in which case, back up two bytes. */ |
| 5270 |
|
|
| 5271 |
if (possessive) continue; |
if (possessive) continue; |
| 5272 |
for(;;) |
for(;;) |
| 5275 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 5276 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 5277 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 5278 |
|
if (ctype == OP_ANYNL && eptr > pp && *eptr == '\n' && |
| 5279 |
|
eptr[-1] == '\r') eptr--; |
| 5280 |
} |
} |
| 5281 |
} |
} |
| 5282 |
else |
else |
| 5475 |
RRETURN(PCRE_ERROR_INTERNAL); |
RRETURN(PCRE_ERROR_INTERNAL); |
| 5476 |
} |
} |
| 5477 |
|
|
| 5478 |
/* eptr is now past the end of the maximum run */ |
/* eptr is now past the end of the maximum run. If possessive, we are |
| 5479 |
|
done (no backing up). Otherwise, match at this position; anything other |
| 5480 |
|
than no match is immediately returned. For nomatch, back up one |
| 5481 |
|
character (byte), unless we are matching \R and the last thing matched |
| 5482 |
|
was \r\n, in which case, back up two bytes. */ |
| 5483 |
|
|
| 5484 |
if (possessive) continue; |
if (possessive) continue; |
| 5485 |
while (eptr >= pp) |
while (eptr >= pp) |
| 5486 |
{ |
{ |
| 5487 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM47); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM47); |
|
eptr--; |
|
| 5488 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 5489 |
|
eptr--; |
| 5490 |
|
if (ctype == OP_ANYNL && eptr > pp && *eptr == '\n' && |
| 5491 |
|
eptr[-1] == '\r') eptr--; |
| 5492 |
} |
} |
| 5493 |
} |
} |
| 5494 |
|
|
| 5495 |
/* Get here if we can't make it match with any permitted repetitions */ |
/* Get here if we can't make it match with any permitted repetitions */ |
| 5496 |
|
|
| 5497 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 5498 |
} |
} |
| 5499 |
/* Control never gets here */ |
/* Control never gets here */ |
| 5500 |
|
|
| 5527 |
LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17) |
LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17) |
| 5528 |
LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33) |
LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33) |
| 5529 |
LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52) |
LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52) |
| 5530 |
LBL(53) LBL(54) |
LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) |
| 5531 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 5532 |
LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30) |
LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30) |
| 5533 |
LBL(32) LBL(34) LBL(42) LBL(46) |
LBL(32) LBL(34) LBL(42) LBL(46) |
| 5534 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 5535 |
LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45) |
LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45) |
| 5536 |
|
LBL(59) LBL(60) LBL(61) LBL(62) |
| 5537 |
#endif /* SUPPORT_UCP */ |
#endif /* SUPPORT_UCP */ |
| 5538 |
#endif /* SUPPORT_UTF8 */ |
#endif /* SUPPORT_UTF8 */ |
| 5539 |
default: |
default: |
| 5667 |
if (re == NULL || subject == NULL || |
if (re == NULL || subject == NULL || |
| 5668 |
(offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL; |
(offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL; |
| 5669 |
if (offsetcount < 0) return PCRE_ERROR_BADCOUNT; |
if (offsetcount < 0) return PCRE_ERROR_BADCOUNT; |
| 5670 |
|
if (start_offset < 0 || start_offset > length) return PCRE_ERROR_BADOFFSET; |
| 5671 |
|
|
| 5672 |
/* This information is for finding all the numbers associated with a given |
/* This information is for finding all the numbers associated with a given |
| 5673 |
name, for condition testing. */ |
name, for condition testing. */ |
| 5738 |
|
|
| 5739 |
md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0; |
md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0; |
| 5740 |
utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0; |
utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0; |
| 5741 |
|
md->use_ucp = (re->options & PCRE_UCP) != 0; |
| 5742 |
md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0; |
md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0; |
| 5743 |
|
|
| 5744 |
md->notbol = (options & PCRE_NOTBOL) != 0; |
md->notbol = (options & PCRE_NOTBOL) != 0; |
| 5748 |
md->partial = ((options & PCRE_PARTIAL_HARD) != 0)? 2 : |
md->partial = ((options & PCRE_PARTIAL_HARD) != 0)? 2 : |
| 5749 |
((options & PCRE_PARTIAL_SOFT) != 0)? 1 : 0; |
((options & PCRE_PARTIAL_SOFT) != 0)? 1 : 0; |
| 5750 |
md->hitend = FALSE; |
md->hitend = FALSE; |
| 5751 |
|
md->mark = NULL; /* In case never set */ |
| 5752 |
|
|
| 5753 |
md->recursive = NULL; /* No recursion at top level */ |
md->recursive = NULL; /* No recursion at top level */ |
| 5754 |
|
|
| 5828 |
if (md->partial && (re->flags & PCRE_NOPARTIAL) != 0) |
if (md->partial && (re->flags & PCRE_NOPARTIAL) != 0) |
| 5829 |
return PCRE_ERROR_BADPARTIAL; |
return PCRE_ERROR_BADPARTIAL; |
| 5830 |
|
|
| 5831 |
/* Check a UTF-8 string if required. Unfortunately there's no way of passing |
/* Check a UTF-8 string if required. Pass back the character offset and error |
| 5832 |
back the character offset. */ |
code if a results vector is available. */ |
| 5833 |
|
|
| 5834 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 5835 |
if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) |
if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) |
| 5836 |
{ |
{ |
| 5837 |
if (_pcre_valid_utf8((USPTR)subject, length) >= 0) |
int errorcode; |
| 5838 |
return PCRE_ERROR_BADUTF8; |
int tb = _pcre_valid_utf8((USPTR)subject, length, &errorcode); |
| 5839 |
if (start_offset > 0 && start_offset < length) |
if (tb >= 0) |
| 5840 |
{ |
{ |
| 5841 |
int tb = ((USPTR)subject)[start_offset]; |
if (offsetcount >= 2) |
|
if (tb > 127) |
|
| 5842 |
{ |
{ |
| 5843 |
tb &= 0xc0; |
offsets[0] = tb; |
| 5844 |
if (tb != 0 && tb != 0xc0) return PCRE_ERROR_BADUTF8_OFFSET; |
offsets[1] = errorcode; |
| 5845 |
} |
} |
| 5846 |
|
return (errorcode <= PCRE_UTF8_ERR5 && md->partial > 1)? |
| 5847 |
|
PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8; |
| 5848 |
|
} |
| 5849 |
|
if (start_offset > 0 && start_offset < length) |
| 5850 |
|
{ |
| 5851 |
|
tb = ((USPTR)subject)[start_offset] & 0xc0; |
| 5852 |
|
if (tb == 0x80) return PCRE_ERROR_BADUTF8_OFFSET; |
| 5853 |
} |
} |
| 5854 |
} |
} |
| 5855 |
#endif |
#endif |
| 5977 |
/* There are some optimizations that avoid running the match if a known |
/* There are some optimizations that avoid running the match if a known |
| 5978 |
starting point is not found, or if a known later character is not present. |
starting point is not found, or if a known later character is not present. |
| 5979 |
However, there is an option that disables these, for testing and for ensuring |
However, there is an option that disables these, for testing and for ensuring |
| 5980 |
that all callouts do actually occur. */ |
that all callouts do actually occur. The option can be set in the regex by |
| 5981 |
|
(*NO_START_OPT) or passed in match-time options. */ |
| 5982 |
|
|
| 5983 |
if ((options & PCRE_NO_START_OPTIMIZE) == 0) |
if (((options | re->options) & PCRE_NO_START_OPTIMIZE) == 0) |
| 5984 |
{ |
{ |
| 5985 |
/* Advance to a unique first byte if there is one. */ |
/* Advance to a unique first byte if there is one. */ |
| 5986 |
|
|
| 6034 |
while (start_match < end_subject) |
while (start_match < end_subject) |
| 6035 |
{ |
{ |
| 6036 |
register unsigned int c = *start_match; |
register unsigned int c = *start_match; |
| 6037 |
if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; |
if ((start_bits[c/8] & (1 << (c&7))) == 0) |
| 6038 |
else break; |
{ |
| 6039 |
|
start_match++; |
| 6040 |
|
#ifdef SUPPORT_UTF8 |
| 6041 |
|
if (utf8) |
| 6042 |
|
while(start_match < end_subject && (*start_match & 0xc0) == 0x80) |
| 6043 |
|
start_match++; |
| 6044 |
|
#endif |
| 6045 |
|
} |
| 6046 |
|
else break; |
| 6047 |
} |
} |
| 6048 |
} |
} |
| 6049 |
} /* Starting optimizations */ |
} /* Starting optimizations */ |
| 6138 |
md->start_match_ptr = start_match; |
md->start_match_ptr = start_match; |
| 6139 |
md->start_used_ptr = start_match; |
md->start_used_ptr = start_match; |
| 6140 |
md->match_call_count = 0; |
md->match_call_count = 0; |
| 6141 |
rc = match(start_match, md->start_code, start_match, 2, md, ims, NULL, 0, 0); |
rc = match(start_match, md->start_code, start_match, NULL, 2, md, ims, NULL, |
| 6142 |
|
0, 0); |
| 6143 |
if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr; |
if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr; |
| 6144 |
|
|
| 6145 |
switch(rc) |
switch(rc) |
| 6146 |
{ |
{ |
| 6147 |
|
/* SKIP passes back the next starting point explicitly, but if it is the |
| 6148 |
|
same as the match we have just done, treat it as NOMATCH. */ |
| 6149 |
|
|
| 6150 |
|
case MATCH_SKIP: |
| 6151 |
|
if (md->start_match_ptr != start_match) |
| 6152 |
|
{ |
| 6153 |
|
new_start_match = md->start_match_ptr; |
| 6154 |
|
break; |
| 6155 |
|
} |
| 6156 |
|
/* Fall through */ |
| 6157 |
|
|
| 6158 |
|
/* If MATCH_SKIP_ARG reaches this level it means that a MARK that matched |
| 6159 |
|
the SKIP's arg was not found. We also treat this as NOMATCH. */ |
| 6160 |
|
|
| 6161 |
|
case MATCH_SKIP_ARG: |
| 6162 |
|
/* Fall through */ |
| 6163 |
|
|
| 6164 |
/* NOMATCH and PRUNE advance by one character. THEN at this level acts |
/* NOMATCH and PRUNE advance by one character. THEN at this level acts |
| 6165 |
exactly like PRUNE. */ |
exactly like PRUNE. */ |
| 6166 |
|
|
| 6175 |
#endif |
#endif |
| 6176 |
break; |
break; |
| 6177 |
|
|
|
/* SKIP passes back the next starting point explicitly. */ |
|
|
|
|
|
case MATCH_SKIP: |
|
|
new_start_match = md->start_match_ptr; |
|
|
break; |
|
|
|
|
| 6178 |
/* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */ |
/* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */ |
| 6179 |
|
|
| 6180 |
case MATCH_COMMIT: |
case MATCH_COMMIT: |
| 6220 |
md->nllen == 2)) |
md->nllen == 2)) |
| 6221 |
start_match++; |
start_match++; |
| 6222 |
|
|
| 6223 |
} /* End of for(;;) "bumpalong" loop */ |
md->mark = NULL; /* Reset for start of next match attempt */ |
| 6224 |
|
} /* End of for(;;) "bumpalong" loop */ |
| 6225 |
|
|
| 6226 |
/* ==========================================================================*/ |
/* ==========================================================================*/ |
| 6227 |
|
|
| 6245 |
|
|
| 6246 |
ENDLOOP: |
ENDLOOP: |
| 6247 |
|
|
| 6248 |
if (rc == MATCH_MATCH) |
if (rc == MATCH_MATCH || rc == MATCH_ACCEPT) |
| 6249 |
{ |
{ |
| 6250 |
if (using_temporary_offsets) |
if (using_temporary_offsets) |
| 6251 |
{ |
{ |
| 6271 |
|
|
| 6272 |
if (offsetcount < 2) rc = 0; else |
if (offsetcount < 2) rc = 0; else |
| 6273 |
{ |
{ |
| 6274 |
offsets[0] = md->start_match_ptr - md->start_subject; |
offsets[0] = (int)(md->start_match_ptr - md->start_subject); |
| 6275 |
offsets[1] = md->end_match_ptr - md->start_subject; |
offsets[1] = (int)(md->end_match_ptr - md->start_subject); |
| 6276 |
} |
} |
| 6277 |
|
|
| 6278 |
DPRINTF((">>>> returning %d\n", rc)); |
DPRINTF((">>>> returning %d\n", rc)); |
| 6279 |
return rc; |
goto RETURN_MARK; |
| 6280 |
} |
} |
| 6281 |
|
|
| 6282 |
/* Control gets here if there has been an error, or if the overall match |
/* Control gets here if there has been an error, or if the overall match |
| 6288 |
(pcre_free)(md->offset_vector); |
(pcre_free)(md->offset_vector); |
| 6289 |
} |
} |
| 6290 |
|
|
| 6291 |
|
/* For anything other than nomatch or partial match, just return the code. */ |
| 6292 |
|
|
| 6293 |
if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL) |
if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL) |
| 6294 |
{ |
{ |
| 6295 |
DPRINTF((">>>> error: returning %d\n", rc)); |
DPRINTF((">>>> error: returning %d\n", rc)); |
| 6296 |
return rc; |
return rc; |
| 6297 |
} |
} |
| 6298 |
else if (start_partial != NULL) |
|
| 6299 |
|
/* Handle partial matches - disable any mark data */ |
| 6300 |
|
|
| 6301 |
|
if (start_partial != NULL) |
| 6302 |
{ |
{ |
| 6303 |
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n")); |
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n")); |
| 6304 |
|
md->mark = NULL; |
| 6305 |
if (offsetcount > 1) |
if (offsetcount > 1) |
| 6306 |
{ |
{ |
| 6307 |
offsets[0] = start_partial - (USPTR)subject; |
offsets[0] = (int)(start_partial - (USPTR)subject); |
| 6308 |
offsets[1] = end_subject - (USPTR)subject; |
offsets[1] = (int)(end_subject - (USPTR)subject); |
| 6309 |
} |
} |
| 6310 |
return PCRE_ERROR_PARTIAL; |
rc = PCRE_ERROR_PARTIAL; |
| 6311 |
} |
} |
| 6312 |
|
|
| 6313 |
|
/* This is the classic nomatch case */ |
| 6314 |
|
|
| 6315 |
else |
else |
| 6316 |
{ |
{ |
| 6317 |
DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n")); |
DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n")); |
| 6318 |
return PCRE_ERROR_NOMATCH; |
rc = PCRE_ERROR_NOMATCH; |
| 6319 |
} |
} |
| 6320 |
|
|
| 6321 |
|
/* Return the MARK data if it has been requested. */ |
| 6322 |
|
|
| 6323 |
|
RETURN_MARK: |
| 6324 |
|
|
| 6325 |
|
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0) |
| 6326 |
|
*(extra_data->mark) = (unsigned char *)(md->mark); |
| 6327 |
|
return rc; |
| 6328 |
} |
} |
| 6329 |
|
|
| 6330 |
/* End of pcre_exec.c */ |
/* End of pcre_exec.c */ |