| 6 |
and semantics are as close as possible to those of the Perl 5 language. |
and semantics are as close as possible to those of the Perl 5 language. |
| 7 |
|
|
| 8 |
Written by Philip Hazel |
Written by Philip Hazel |
| 9 |
Copyright (c) 1997-2009 University of Cambridge |
Copyright (c) 1997-2010 University of Cambridge |
| 10 |
|
|
| 11 |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
| 12 |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
| 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, |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 103 |
/************************************************* |
/************************************************* |
| 104 |
* Debugging function to print chars * |
* Debugging function to print chars * |
| 105 |
*************************************************/ |
*************************************************/ |
| 151 |
{ |
{ |
| 152 |
USPTR p = md->start_subject + md->offset_vector[offset]; |
USPTR p = md->start_subject + md->offset_vector[offset]; |
| 153 |
|
|
| 154 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 155 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 156 |
printf("matching subject <null>"); |
printf("matching subject <null>"); |
| 157 |
else |
else |
| 255 |
RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30, |
RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30, |
| 256 |
RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40, |
RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40, |
| 257 |
RM41, RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50, |
RM41, RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50, |
| 258 |
RM51, RM52, RM53, RM54 }; |
RM51, RM52, RM53, RM54, RM55, RM56, RM57, RM58, RM59, RM60, |
| 259 |
|
RM61, RM62 }; |
| 260 |
|
|
| 261 |
/* 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 |
| 262 |
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 |
| 263 |
actuall used in this definition. */ |
actually used in this definition. */ |
| 264 |
|
|
| 265 |
#ifndef NO_RECURSE |
#ifndef NO_RECURSE |
| 266 |
#define REGISTER register |
#define REGISTER register |
| 267 |
|
|
| 268 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 269 |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
| 270 |
{ \ |
{ \ |
| 271 |
printf("match() called in line %d\n", __LINE__); \ |
printf("match() called in line %d\n", __LINE__); \ |
| 272 |
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); \ |
| 273 |
printf("to line %d\n", __LINE__); \ |
printf("to line %d\n", __LINE__); \ |
| 274 |
} |
} |
| 275 |
#define RRETURN(ra) \ |
#define RRETURN(ra) \ |
| 279 |
} |
} |
| 280 |
#else |
#else |
| 281 |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \ |
| 282 |
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) |
| 283 |
#define RRETURN(ra) return ra |
#define RRETURN(ra) return ra |
| 284 |
#endif |
#endif |
| 285 |
|
|
| 294 |
|
|
| 295 |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\ |
#define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\ |
| 296 |
{\ |
{\ |
| 297 |
heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\ |
heapframe *newframe = (heapframe *)(pcre_stack_malloc)(sizeof(heapframe));\ |
| 298 |
|
if (newframe == NULL) RRETURN(PCRE_ERROR_NOMEMORY);\ |
| 299 |
frame->Xwhere = rw; \ |
frame->Xwhere = rw; \ |
| 300 |
newframe->Xeptr = ra;\ |
newframe->Xeptr = ra;\ |
| 301 |
newframe->Xecode = rb;\ |
newframe->Xecode = rb;\ |
| 302 |
newframe->Xmstart = mstart;\ |
newframe->Xmstart = mstart;\ |
| 303 |
|
newframe->Xmarkptr = markptr;\ |
| 304 |
newframe->Xoffset_top = rc;\ |
newframe->Xoffset_top = rc;\ |
| 305 |
newframe->Xims = re;\ |
newframe->Xims = re;\ |
| 306 |
newframe->Xeptrb = rf;\ |
newframe->Xeptrb = rf;\ |
| 316 |
|
|
| 317 |
#define RRETURN(ra)\ |
#define RRETURN(ra)\ |
| 318 |
{\ |
{\ |
| 319 |
heapframe *newframe = frame;\ |
heapframe *oldframe = frame;\ |
| 320 |
frame = newframe->Xprevframe;\ |
frame = oldframe->Xprevframe;\ |
| 321 |
(pcre_stack_free)(newframe);\ |
(pcre_stack_free)(oldframe);\ |
| 322 |
if (frame != NULL)\ |
if (frame != NULL)\ |
| 323 |
{\ |
{\ |
| 324 |
rrc = ra;\ |
rrc = ra;\ |
| 338 |
USPTR Xeptr; |
USPTR Xeptr; |
| 339 |
const uschar *Xecode; |
const uschar *Xecode; |
| 340 |
USPTR Xmstart; |
USPTR Xmstart; |
| 341 |
|
USPTR Xmarkptr; |
| 342 |
int Xoffset_top; |
int Xoffset_top; |
| 343 |
long int Xims; |
long int Xims; |
| 344 |
eptrblock *Xeptrb; |
eptrblock *Xeptrb; |
| 422 |
the subject. */ |
the subject. */ |
| 423 |
|
|
| 424 |
#define CHECK_PARTIAL()\ |
#define CHECK_PARTIAL()\ |
| 425 |
if (md->partial != 0 && eptr >= md->end_subject && eptr > mstart)\ |
if (md->partial != 0 && eptr >= md->end_subject && \ |
| 426 |
{\ |
eptr > md->start_used_ptr) \ |
| 427 |
md->hitend = TRUE;\ |
{ \ |
| 428 |
if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\ |
md->hitend = TRUE; \ |
| 429 |
|
if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL); \ |
| 430 |
} |
} |
| 431 |
|
|
| 432 |
#define SCHECK_PARTIAL()\ |
#define SCHECK_PARTIAL()\ |
| 433 |
if (md->partial != 0 && eptr > mstart)\ |
if (md->partial != 0 && eptr > md->start_used_ptr) \ |
| 434 |
{\ |
{ \ |
| 435 |
md->hitend = TRUE;\ |
md->hitend = TRUE; \ |
| 436 |
if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\ |
if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL); \ |
| 437 |
} |
} |
| 438 |
|
|
| 439 |
|
|
| 447 |
ecode pointer to current position in compiled code |
ecode pointer to current position in compiled code |
| 448 |
mstart pointer to the current match start position (can be modified |
mstart pointer to the current match start position (can be modified |
| 449 |
by encountering \K) |
by encountering \K) |
| 450 |
|
markptr pointer to the most recent MARK name, or NULL |
| 451 |
offset_top current top pointer |
offset_top current top pointer |
| 452 |
md pointer to "static" info for the match |
md pointer to "static" info for the match |
| 453 |
ims current /i, /m, and /s options |
ims current /i, /m, and /s options |
| 461 |
|
|
| 462 |
Returns: MATCH_MATCH if matched ) these values are >= 0 |
Returns: MATCH_MATCH if matched ) these values are >= 0 |
| 463 |
MATCH_NOMATCH if failed to match ) |
MATCH_NOMATCH if failed to match ) |
| 464 |
|
a negative MATCH_xxx value for PRUNE, SKIP, etc |
| 465 |
a negative PCRE_ERROR_xxx value if aborted by an error condition |
a negative PCRE_ERROR_xxx value if aborted by an error condition |
| 466 |
(e.g. stopped by repeated call or recursion limit) |
(e.g. stopped by repeated call or recursion limit) |
| 467 |
*/ |
*/ |
| 468 |
|
|
| 469 |
static int |
static int |
| 470 |
match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart, |
match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart, |
| 471 |
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, |
| 472 |
int flags, unsigned int rdepth) |
eptrblock *eptrb, int flags, unsigned int rdepth) |
| 473 |
{ |
{ |
| 474 |
/* 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, |
| 475 |
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 |
| 489 |
heap whenever RMATCH() does a "recursion". See the macro definitions above. */ |
heap whenever RMATCH() does a "recursion". See the macro definitions above. */ |
| 490 |
|
|
| 491 |
#ifdef NO_RECURSE |
#ifdef NO_RECURSE |
| 492 |
heapframe *frame = (pcre_stack_malloc)(sizeof(heapframe)); |
heapframe *frame = (heapframe *)(pcre_stack_malloc)(sizeof(heapframe)); |
| 493 |
|
if (frame == NULL) RRETURN(PCRE_ERROR_NOMEMORY); |
| 494 |
frame->Xprevframe = NULL; /* Marks the top level */ |
frame->Xprevframe = NULL; /* Marks the top level */ |
| 495 |
|
|
| 496 |
/* Copy in the original argument variables */ |
/* Copy in the original argument variables */ |
| 498 |
frame->Xeptr = eptr; |
frame->Xeptr = eptr; |
| 499 |
frame->Xecode = ecode; |
frame->Xecode = ecode; |
| 500 |
frame->Xmstart = mstart; |
frame->Xmstart = mstart; |
| 501 |
|
frame->Xmarkptr = markptr; |
| 502 |
frame->Xoffset_top = offset_top; |
frame->Xoffset_top = offset_top; |
| 503 |
frame->Xims = ims; |
frame->Xims = ims; |
| 504 |
frame->Xeptrb = eptrb; |
frame->Xeptrb = eptrb; |
| 514 |
#define eptr frame->Xeptr |
#define eptr frame->Xeptr |
| 515 |
#define ecode frame->Xecode |
#define ecode frame->Xecode |
| 516 |
#define mstart frame->Xmstart |
#define mstart frame->Xmstart |
| 517 |
|
#define markptr frame->Xmarkptr |
| 518 |
#define offset_top frame->Xoffset_top |
#define offset_top frame->Xoffset_top |
| 519 |
#define ims frame->Xims |
#define ims frame->Xims |
| 520 |
#define eptrb frame->Xeptrb |
#define eptrb frame->Xeptrb |
| 642 |
/* OK, now we can get on with the real code of the function. Recursive calls |
/* OK, now we can get on with the real code of the function. Recursive calls |
| 643 |
are specified by the macro RMATCH and RRETURN is used to return. When |
are specified by the macro RMATCH and RRETURN is used to return. When |
| 644 |
NO_RECURSE is *not* defined, these just turn into a recursive call to match() |
NO_RECURSE is *not* defined, these just turn into a recursive call to match() |
| 645 |
and a "return", respectively (possibly with some debugging if DEBUG is |
and a "return", respectively (possibly with some debugging if PCRE_DEBUG is |
| 646 |
defined). However, RMATCH isn't like a function call because it's quite a |
defined). However, RMATCH isn't like a function call because it's quite a |
| 647 |
complicated macro. It has to be used in one particular way. This shouldn't, |
complicated macro. It has to be used in one particular way. This shouldn't, |
| 648 |
however, impact performance when true recursion is being used. */ |
however, impact performance when true recursion is being used. */ |
| 686 |
|
|
| 687 |
switch(op) |
switch(op) |
| 688 |
{ |
{ |
| 689 |
|
case OP_MARK: |
| 690 |
|
markptr = ecode + 2; |
| 691 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 692 |
|
ims, eptrb, flags, RM55); |
| 693 |
|
|
| 694 |
|
/* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an |
| 695 |
|
argument, and we must check whether that argument matches this MARK's |
| 696 |
|
argument. It is passed back in md->start_match_ptr (an overloading of that |
| 697 |
|
variable). If it does match, we reset that variable to the current subject |
| 698 |
|
position and return MATCH_SKIP. Otherwise, pass back the return code |
| 699 |
|
unaltered. */ |
| 700 |
|
|
| 701 |
|
if (rrc == MATCH_SKIP_ARG && |
| 702 |
|
strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0) |
| 703 |
|
{ |
| 704 |
|
md->start_match_ptr = eptr; |
| 705 |
|
RRETURN(MATCH_SKIP); |
| 706 |
|
} |
| 707 |
|
|
| 708 |
|
if (md->mark == NULL) md->mark = markptr; |
| 709 |
|
RRETURN(rrc); |
| 710 |
|
|
| 711 |
case OP_FAIL: |
case OP_FAIL: |
| 712 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 713 |
|
|
| 714 |
|
/* COMMIT overrides PRUNE, SKIP, and THEN */ |
| 715 |
|
|
| 716 |
|
case OP_COMMIT: |
| 717 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 718 |
|
ims, eptrb, flags, RM52); |
| 719 |
|
if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && |
| 720 |
|
rrc != MATCH_SKIP && rrc != MATCH_SKIP_ARG && |
| 721 |
|
rrc != MATCH_THEN) |
| 722 |
|
RRETURN(rrc); |
| 723 |
|
MRRETURN(MATCH_COMMIT); |
| 724 |
|
|
| 725 |
|
/* PRUNE overrides THEN */ |
| 726 |
|
|
| 727 |
case OP_PRUNE: |
case OP_PRUNE: |
| 728 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 729 |
ims, eptrb, flags, RM51); |
ims, eptrb, flags, RM51); |
| 730 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
| 731 |
|
MRRETURN(MATCH_PRUNE); |
| 732 |
|
|
| 733 |
|
case OP_PRUNE_ARG: |
| 734 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 735 |
|
ims, eptrb, flags, RM56); |
| 736 |
|
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
| 737 |
|
md->mark = ecode + 2; |
| 738 |
RRETURN(MATCH_PRUNE); |
RRETURN(MATCH_PRUNE); |
| 739 |
|
|
| 740 |
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); |
|
| 741 |
|
|
| 742 |
case OP_SKIP: |
case OP_SKIP: |
| 743 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 744 |
ims, eptrb, flags, RM53); |
ims, eptrb, flags, RM53); |
| 745 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN) |
| 746 |
|
RRETURN(rrc); |
| 747 |
md->start_match_ptr = eptr; /* Pass back current position */ |
md->start_match_ptr = eptr; /* Pass back current position */ |
| 748 |
RRETURN(MATCH_SKIP); |
MRRETURN(MATCH_SKIP); |
| 749 |
|
|
| 750 |
|
case OP_SKIP_ARG: |
| 751 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
| 752 |
|
ims, eptrb, flags, RM57); |
| 753 |
|
if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN) |
| 754 |
|
RRETURN(rrc); |
| 755 |
|
|
| 756 |
|
/* Pass back the current skip name by overloading md->start_match_ptr and |
| 757 |
|
returning the special MATCH_SKIP_ARG return code. This will either be |
| 758 |
|
caught by a matching MARK, or get to the top, where it is treated the same |
| 759 |
|
as PRUNE. */ |
| 760 |
|
|
| 761 |
|
md->start_match_ptr = ecode + 2; |
| 762 |
|
RRETURN(MATCH_SKIP_ARG); |
| 763 |
|
|
| 764 |
|
/* For THEN (and THEN_ARG) we pass back the address of the bracket or |
| 765 |
|
the alt that is at the start of the current branch. This makes it possible |
| 766 |
|
to skip back past alternatives that precede the THEN within the current |
| 767 |
|
branch. */ |
| 768 |
|
|
| 769 |
case OP_THEN: |
case OP_THEN: |
| 770 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 771 |
ims, eptrb, flags, RM54); |
ims, eptrb, flags, RM54); |
| 772 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 773 |
|
md->start_match_ptr = ecode - GET(ecode, 1); |
| 774 |
|
MRRETURN(MATCH_THEN); |
| 775 |
|
|
| 776 |
|
case OP_THEN_ARG: |
| 777 |
|
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1+LINK_SIZE], |
| 778 |
|
offset_top, md, ims, eptrb, flags, RM58); |
| 779 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 780 |
|
md->start_match_ptr = ecode - GET(ecode, 1); |
| 781 |
|
md->mark = ecode + LINK_SIZE + 2; |
| 782 |
RRETURN(MATCH_THEN); |
RRETURN(MATCH_THEN); |
| 783 |
|
|
| 784 |
/* 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 |
| 800 |
number = GET2(ecode, 1+LINK_SIZE); |
number = GET2(ecode, 1+LINK_SIZE); |
| 801 |
offset = number << 1; |
offset = number << 1; |
| 802 |
|
|
| 803 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 804 |
printf("start bracket %d\n", number); |
printf("start bracket %d\n", number); |
| 805 |
printf("subject="); |
printf("subject="); |
| 806 |
pchars(eptr, 16, TRUE, md); |
pchars(eptr, 16, TRUE, md); |
| 815 |
save_capture_last = md->capture_last; |
save_capture_last = md->capture_last; |
| 816 |
|
|
| 817 |
DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3)); |
DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3)); |
| 818 |
md->offset_vector[md->offset_end - number] = eptr - md->start_subject; |
md->offset_vector[md->offset_end - number] = |
| 819 |
|
(int)(eptr - md->start_subject); |
| 820 |
|
|
| 821 |
flags = (op == OP_SCBRA)? match_cbegroup : 0; |
flags = (op == OP_SCBRA)? match_cbegroup : 0; |
| 822 |
do |
do |
| 823 |
{ |
{ |
| 824 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 825 |
ims, eptrb, flags, RM1); |
ims, eptrb, flags, RM1); |
| 826 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && |
| 827 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 828 |
|
RRETURN(rrc); |
| 829 |
md->capture_last = save_capture_last; |
md->capture_last = save_capture_last; |
| 830 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 831 |
} |
} |
| 837 |
md->offset_vector[offset+1] = save_offset2; |
md->offset_vector[offset+1] = save_offset2; |
| 838 |
md->offset_vector[md->offset_end - number] = save_offset3; |
md->offset_vector[md->offset_end - number] = save_offset3; |
| 839 |
|
|
| 840 |
|
if (rrc != MATCH_THEN) md->mark = markptr; |
| 841 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
| 842 |
} |
} |
| 843 |
|
|
| 877 |
|
|
| 878 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
| 879 |
eptrb, flags, RM48); |
eptrb, flags, RM48); |
| 880 |
|
if (rrc == MATCH_NOMATCH) md->mark = markptr; |
| 881 |
RRETURN(rrc); |
RRETURN(rrc); |
| 882 |
} |
} |
| 883 |
|
|
| 886 |
|
|
| 887 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
| 888 |
eptrb, flags, RM2); |
eptrb, flags, RM2); |
| 889 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && |
| 890 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 891 |
|
RRETURN(rrc); |
| 892 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 893 |
} |
} |
| 894 |
/* Control never reaches here. */ |
/* Control never reaches here. */ |
| 915 |
cb.callout_number = ecode[LINK_SIZE+2]; |
cb.callout_number = ecode[LINK_SIZE+2]; |
| 916 |
cb.offset_vector = md->offset_vector; |
cb.offset_vector = md->offset_vector; |
| 917 |
cb.subject = (PCRE_SPTR)md->start_subject; |
cb.subject = (PCRE_SPTR)md->start_subject; |
| 918 |
cb.subject_length = md->end_subject - md->start_subject; |
cb.subject_length = (int)(md->end_subject - md->start_subject); |
| 919 |
cb.start_match = mstart - md->start_subject; |
cb.start_match = (int)(mstart - md->start_subject); |
| 920 |
cb.current_position = eptr - md->start_subject; |
cb.current_position = (int)(eptr - md->start_subject); |
| 921 |
cb.pattern_position = GET(ecode, LINK_SIZE + 3); |
cb.pattern_position = GET(ecode, LINK_SIZE + 3); |
| 922 |
cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE); |
cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE); |
| 923 |
cb.capture_top = offset_top/2; |
cb.capture_top = offset_top/2; |
| 924 |
cb.capture_last = md->capture_last; |
cb.capture_last = md->capture_last; |
| 925 |
cb.callout_data = md->callout_data; |
cb.callout_data = md->callout_data; |
| 926 |
if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH); |
if ((rrc = (*pcre_callout)(&cb)) > 0) MRRETURN(MATCH_NOMATCH); |
| 927 |
if (rrc < 0) RRETURN(rrc); |
if (rrc < 0) RRETURN(rrc); |
| 928 |
} |
} |
| 929 |
ecode += _pcre_OP_lengths[OP_CALLOUT]; |
ecode += _pcre_OP_lengths[OP_CALLOUT]; |
| 1089 |
ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2); |
ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2); |
| 1090 |
while (*ecode == OP_ALT) ecode += GET(ecode, 1); |
while (*ecode == OP_ALT) ecode += GET(ecode, 1); |
| 1091 |
} |
} |
| 1092 |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
else if (rrc != MATCH_NOMATCH && |
| 1093 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1094 |
{ |
{ |
| 1095 |
RRETURN(rrc); /* Need braces because of following else */ |
RRETURN(rrc); /* Need braces because of following else */ |
| 1096 |
} |
} |
| 1134 |
number = GET2(ecode, 1); |
number = GET2(ecode, 1); |
| 1135 |
offset = number << 1; |
offset = number << 1; |
| 1136 |
|
|
| 1137 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 1138 |
printf("end bracket %d at *ACCEPT", number); |
printf("end bracket %d at *ACCEPT", number); |
| 1139 |
printf("\n"); |
printf("\n"); |
| 1140 |
#endif |
#endif |
| 1144 |
{ |
{ |
| 1145 |
md->offset_vector[offset] = |
md->offset_vector[offset] = |
| 1146 |
md->offset_vector[md->offset_end - number]; |
md->offset_vector[md->offset_end - number]; |
| 1147 |
md->offset_vector[offset+1] = eptr - md->start_subject; |
md->offset_vector[offset+1] = (int)(eptr - md->start_subject); |
| 1148 |
if (offset_top <= offset) offset_top = offset + 2; |
if (offset_top <= offset) offset_top = offset + 2; |
| 1149 |
} |
} |
| 1150 |
ecode += 3; |
ecode += 3; |
| 1165 |
memmove(md->offset_vector, rec->offset_save, |
memmove(md->offset_vector, rec->offset_save, |
| 1166 |
rec->saved_max * sizeof(int)); |
rec->saved_max * sizeof(int)); |
| 1167 |
offset_top = rec->save_offset_top; |
offset_top = rec->save_offset_top; |
|
mstart = rec->save_start; |
|
| 1168 |
ims = original_ims; |
ims = original_ims; |
| 1169 |
ecode = rec->after_call; |
ecode = rec->after_call; |
| 1170 |
break; |
break; |
| 1179 |
(md->notempty || |
(md->notempty || |
| 1180 |
(md->notempty_atstart && |
(md->notempty_atstart && |
| 1181 |
mstart == md->start_subject + md->start_offset))) |
mstart == md->start_subject + md->start_offset))) |
| 1182 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1183 |
|
|
| 1184 |
/* Otherwise, we have a match. */ |
/* Otherwise, we have a match. */ |
| 1185 |
|
|
| 1186 |
md->end_match_ptr = eptr; /* Record where we ended */ |
md->end_match_ptr = eptr; /* Record where we ended */ |
| 1187 |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
| 1188 |
md->start_match_ptr = mstart; /* and the start (\K can modify) */ |
md->start_match_ptr = mstart; /* and the start (\K can modify) */ |
| 1189 |
RRETURN(MATCH_MATCH); |
|
| 1190 |
|
/* For some reason, the macros don't work properly if an expression is |
| 1191 |
|
given as the argument to MRRETURN when the heap is in use. */ |
| 1192 |
|
|
| 1193 |
|
rrc = (op == OP_END)? MATCH_MATCH : MATCH_ACCEPT; |
| 1194 |
|
MRRETURN(rrc); |
| 1195 |
|
|
| 1196 |
/* Change option settings */ |
/* Change option settings */ |
| 1197 |
|
|
| 1213 |
{ |
{ |
| 1214 |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
| 1215 |
RM4); |
RM4); |
| 1216 |
if (rrc == MATCH_MATCH) break; |
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) |
| 1217 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
{ |
| 1218 |
|
mstart = md->start_match_ptr; /* In case \K reset it */ |
| 1219 |
|
break; |
| 1220 |
|
} |
| 1221 |
|
if (rrc != MATCH_NOMATCH && |
| 1222 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1223 |
|
RRETURN(rrc); |
| 1224 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 1225 |
} |
} |
| 1226 |
while (*ecode == OP_ALT); |
while (*ecode == OP_ALT); |
| 1227 |
if (*ecode == OP_KET) RRETURN(MATCH_NOMATCH); |
if (*ecode == OP_KET) MRRETURN(MATCH_NOMATCH); |
| 1228 |
|
|
| 1229 |
/* If checking an assertion for a condition, return MATCH_MATCH. */ |
/* If checking an assertion for a condition, return MATCH_MATCH. */ |
| 1230 |
|
|
| 1238 |
offset_top = md->end_offset_top; |
offset_top = md->end_offset_top; |
| 1239 |
continue; |
continue; |
| 1240 |
|
|
| 1241 |
/* Negative assertion: all branches must fail to match */ |
/* Negative assertion: all branches must fail to match. Encountering SKIP, |
| 1242 |
|
PRUNE, or COMMIT means we must assume failure without checking subsequent |
| 1243 |
|
branches. */ |
| 1244 |
|
|
| 1245 |
case OP_ASSERT_NOT: |
case OP_ASSERT_NOT: |
| 1246 |
case OP_ASSERTBACK_NOT: |
case OP_ASSERTBACK_NOT: |
| 1248 |
{ |
{ |
| 1249 |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0, |
| 1250 |
RM5); |
RM5); |
| 1251 |
if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH); |
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) MRRETURN(MATCH_NOMATCH); |
| 1252 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT) |
| 1253 |
|
{ |
| 1254 |
|
do ecode += GET(ecode,1); while (*ecode == OP_ALT); |
| 1255 |
|
break; |
| 1256 |
|
} |
| 1257 |
|
if (rrc != MATCH_NOMATCH && |
| 1258 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1259 |
|
RRETURN(rrc); |
| 1260 |
ecode += GET(ecode,1); |
ecode += GET(ecode,1); |
| 1261 |
} |
} |
| 1262 |
while (*ecode == OP_ALT); |
while (*ecode == OP_ALT); |
| 1279 |
while (i-- > 0) |
while (i-- > 0) |
| 1280 |
{ |
{ |
| 1281 |
eptr--; |
eptr--; |
| 1282 |
if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH); |
if (eptr < md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1283 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 1284 |
} |
} |
| 1285 |
} |
} |
| 1290 |
|
|
| 1291 |
{ |
{ |
| 1292 |
eptr -= GET(ecode, 1); |
eptr -= GET(ecode, 1); |
| 1293 |
if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH); |
if (eptr < md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1294 |
} |
} |
| 1295 |
|
|
| 1296 |
/* Save the earliest consulted character, then skip to next op code */ |
/* Save the earliest consulted character, then skip to next op code */ |
| 1311 |
cb.callout_number = ecode[1]; |
cb.callout_number = ecode[1]; |
| 1312 |
cb.offset_vector = md->offset_vector; |
cb.offset_vector = md->offset_vector; |
| 1313 |
cb.subject = (PCRE_SPTR)md->start_subject; |
cb.subject = (PCRE_SPTR)md->start_subject; |
| 1314 |
cb.subject_length = md->end_subject - md->start_subject; |
cb.subject_length = (int)(md->end_subject - md->start_subject); |
| 1315 |
cb.start_match = mstart - md->start_subject; |
cb.start_match = (int)(mstart - md->start_subject); |
| 1316 |
cb.current_position = eptr - md->start_subject; |
cb.current_position = (int)(eptr - md->start_subject); |
| 1317 |
cb.pattern_position = GET(ecode, 2); |
cb.pattern_position = GET(ecode, 2); |
| 1318 |
cb.next_item_length = GET(ecode, 2 + LINK_SIZE); |
cb.next_item_length = GET(ecode, 2 + LINK_SIZE); |
| 1319 |
cb.capture_top = offset_top/2; |
cb.capture_top = offset_top/2; |
| 1320 |
cb.capture_last = md->capture_last; |
cb.capture_last = md->capture_last; |
| 1321 |
cb.callout_data = md->callout_data; |
cb.callout_data = md->callout_data; |
| 1322 |
if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH); |
if ((rrc = (*pcre_callout)(&cb)) > 0) MRRETURN(MATCH_NOMATCH); |
| 1323 |
if (rrc < 0) RRETURN(rrc); |
if (rrc < 0) RRETURN(rrc); |
| 1324 |
} |
} |
| 1325 |
ecode += 2 + 2*LINK_SIZE; |
ecode += 2 + 2*LINK_SIZE; |
| 1374 |
|
|
| 1375 |
memcpy(new_recursive.offset_save, md->offset_vector, |
memcpy(new_recursive.offset_save, md->offset_vector, |
| 1376 |
new_recursive.saved_max * sizeof(int)); |
new_recursive.saved_max * sizeof(int)); |
|
new_recursive.save_start = mstart; |
|
| 1377 |
new_recursive.save_offset_top = offset_top; |
new_recursive.save_offset_top = offset_top; |
|
mstart = eptr; |
|
| 1378 |
|
|
| 1379 |
/* 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 |
| 1380 |
restore the offset and recursion data. */ |
restore the offset and recursion data. */ |
| 1385 |
{ |
{ |
| 1386 |
RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top, |
RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top, |
| 1387 |
md, ims, eptrb, flags, RM6); |
md, ims, eptrb, flags, RM6); |
| 1388 |
if (rrc == MATCH_MATCH) |
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) |
| 1389 |
{ |
{ |
| 1390 |
DPRINTF(("Recursion matched\n")); |
DPRINTF(("Recursion matched\n")); |
| 1391 |
md->recursive = new_recursive.prevrec; |
md->recursive = new_recursive.prevrec; |
| 1392 |
if (new_recursive.offset_save != stacksave) |
if (new_recursive.offset_save != stacksave) |
| 1393 |
(pcre_free)(new_recursive.offset_save); |
(pcre_free)(new_recursive.offset_save); |
| 1394 |
RRETURN(MATCH_MATCH); |
MRRETURN(MATCH_MATCH); |
| 1395 |
} |
} |
| 1396 |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
else if (rrc != MATCH_NOMATCH && |
| 1397 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1398 |
{ |
{ |
| 1399 |
DPRINTF(("Recursion gave error %d\n", rrc)); |
DPRINTF(("Recursion gave error %d\n", rrc)); |
| 1400 |
if (new_recursive.offset_save != stacksave) |
if (new_recursive.offset_save != stacksave) |
| 1413 |
md->recursive = new_recursive.prevrec; |
md->recursive = new_recursive.prevrec; |
| 1414 |
if (new_recursive.offset_save != stacksave) |
if (new_recursive.offset_save != stacksave) |
| 1415 |
(pcre_free)(new_recursive.offset_save); |
(pcre_free)(new_recursive.offset_save); |
| 1416 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1417 |
} |
} |
| 1418 |
/* Control never reaches here */ |
/* Control never reaches here */ |
| 1419 |
|
|
| 1422 |
a move back into the brackets. Friedl calls these "atomic" subpatterns. |
a move back into the brackets. Friedl calls these "atomic" subpatterns. |
| 1423 |
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 |
| 1424 |
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 |
| 1425 |
the end of a normal bracket, leaving the subject pointer. */ |
the end of a normal bracket, leaving the subject pointer, but resetting |
| 1426 |
|
the start-of-match value in case it was changed by \K. */ |
| 1427 |
|
|
| 1428 |
case OP_ONCE: |
case OP_ONCE: |
| 1429 |
prev = ecode; |
prev = ecode; |
| 1432 |
do |
do |
| 1433 |
{ |
{ |
| 1434 |
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); |
| 1435 |
if (rrc == MATCH_MATCH) break; |
if (rrc == MATCH_MATCH) /* Note: _not_ MATCH_ACCEPT */ |
| 1436 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
{ |
| 1437 |
|
mstart = md->start_match_ptr; |
| 1438 |
|
break; |
| 1439 |
|
} |
| 1440 |
|
if (rrc != MATCH_NOMATCH && |
| 1441 |
|
(rrc != MATCH_THEN || md->start_match_ptr != ecode)) |
| 1442 |
|
RRETURN(rrc); |
| 1443 |
ecode += GET(ecode,1); |
ecode += GET(ecode,1); |
| 1444 |
} |
} |
| 1445 |
while (*ecode == OP_ALT); |
while (*ecode == OP_ALT); |
| 1557 |
} |
} |
| 1558 |
else saved_eptr = NULL; |
else saved_eptr = NULL; |
| 1559 |
|
|
| 1560 |
/* 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 |
| 1561 |
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 |
| 1562 |
assertions. Do this also for the "once" (atomic) groups. */ |
use by positive assertions. We also need to record the match start in case |
| 1563 |
|
it was changed by \K. */ |
| 1564 |
|
|
| 1565 |
if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT || |
if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT || |
| 1566 |
*prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT || |
*prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT || |
| 1568 |
{ |
{ |
| 1569 |
md->end_match_ptr = eptr; /* For ONCE */ |
md->end_match_ptr = eptr; /* For ONCE */ |
| 1570 |
md->end_offset_top = offset_top; |
md->end_offset_top = offset_top; |
| 1571 |
RRETURN(MATCH_MATCH); |
md->start_match_ptr = mstart; |
| 1572 |
|
MRRETURN(MATCH_MATCH); |
| 1573 |
} |
} |
| 1574 |
|
|
| 1575 |
/* 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 |
| 1583 |
number = GET2(prev, 1+LINK_SIZE); |
number = GET2(prev, 1+LINK_SIZE); |
| 1584 |
offset = number << 1; |
offset = number << 1; |
| 1585 |
|
|
| 1586 |
#ifdef DEBUG |
#ifdef PCRE_DEBUG |
| 1587 |
printf("end bracket %d", number); |
printf("end bracket %d", number); |
| 1588 |
printf("\n"); |
printf("\n"); |
| 1589 |
#endif |
#endif |
| 1593 |
{ |
{ |
| 1594 |
md->offset_vector[offset] = |
md->offset_vector[offset] = |
| 1595 |
md->offset_vector[md->offset_end - number]; |
md->offset_vector[md->offset_end - number]; |
| 1596 |
md->offset_vector[offset+1] = eptr - md->start_subject; |
md->offset_vector[offset+1] = (int)(eptr - md->start_subject); |
| 1597 |
if (offset_top <= offset) offset_top = offset + 2; |
if (offset_top <= offset) offset_top = offset + 2; |
| 1598 |
} |
} |
| 1599 |
|
|
| 1605 |
recursion_info *rec = md->recursive; |
recursion_info *rec = md->recursive; |
| 1606 |
DPRINTF(("Recursion (%d) succeeded - continuing\n", number)); |
DPRINTF(("Recursion (%d) succeeded - continuing\n", number)); |
| 1607 |
md->recursive = rec->prevrec; |
md->recursive = rec->prevrec; |
|
mstart = rec->save_start; |
|
| 1608 |
memcpy(md->offset_vector, rec->offset_save, |
memcpy(md->offset_vector, rec->offset_save, |
| 1609 |
rec->saved_max * sizeof(int)); |
rec->saved_max * sizeof(int)); |
| 1610 |
offset_top = rec->save_offset_top; |
offset_top = rec->save_offset_top; |
| 1664 |
/* Start of subject unless notbol, or after internal newline if multiline */ |
/* Start of subject unless notbol, or after internal newline if multiline */ |
| 1665 |
|
|
| 1666 |
case OP_CIRC: |
case OP_CIRC: |
| 1667 |
if (md->notbol && eptr == md->start_subject) RRETURN(MATCH_NOMATCH); |
if (md->notbol && eptr == md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1668 |
if ((ims & PCRE_MULTILINE) != 0) |
if ((ims & PCRE_MULTILINE) != 0) |
| 1669 |
{ |
{ |
| 1670 |
if (eptr != md->start_subject && |
if (eptr != md->start_subject && |
| 1671 |
(eptr == md->end_subject || !WAS_NEWLINE(eptr))) |
(eptr == md->end_subject || !WAS_NEWLINE(eptr))) |
| 1672 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1673 |
ecode++; |
ecode++; |
| 1674 |
break; |
break; |
| 1675 |
} |
} |
| 1678 |
/* Start of subject assertion */ |
/* Start of subject assertion */ |
| 1679 |
|
|
| 1680 |
case OP_SOD: |
case OP_SOD: |
| 1681 |
if (eptr != md->start_subject) RRETURN(MATCH_NOMATCH); |
if (eptr != md->start_subject) MRRETURN(MATCH_NOMATCH); |
| 1682 |
ecode++; |
ecode++; |
| 1683 |
break; |
break; |
| 1684 |
|
|
| 1685 |
/* Start of match assertion */ |
/* Start of match assertion */ |
| 1686 |
|
|
| 1687 |
case OP_SOM: |
case OP_SOM: |
| 1688 |
if (eptr != md->start_subject + md->start_offset) RRETURN(MATCH_NOMATCH); |
if (eptr != md->start_subject + md->start_offset) MRRETURN(MATCH_NOMATCH); |
| 1689 |
ecode++; |
ecode++; |
| 1690 |
break; |
break; |
| 1691 |
|
|
| 1703 |
if ((ims & PCRE_MULTILINE) != 0) |
if ((ims & PCRE_MULTILINE) != 0) |
| 1704 |
{ |
{ |
| 1705 |
if (eptr < md->end_subject) |
if (eptr < md->end_subject) |
| 1706 |
{ if (!IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); } |
{ if (!IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); } |
| 1707 |
else |
else |
| 1708 |
{ if (md->noteol) RRETURN(MATCH_NOMATCH); } |
{ |
| 1709 |
|
if (md->noteol) MRRETURN(MATCH_NOMATCH); |
| 1710 |
|
SCHECK_PARTIAL(); |
| 1711 |
|
} |
| 1712 |
ecode++; |
ecode++; |
| 1713 |
break; |
break; |
| 1714 |
} |
} |
| 1715 |
else |
else /* Not multiline */ |
| 1716 |
{ |
{ |
| 1717 |
if (md->noteol) RRETURN(MATCH_NOMATCH); |
if (md->noteol) MRRETURN(MATCH_NOMATCH); |
| 1718 |
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; |
|
|
} |
|
| 1719 |
} |
} |
| 1720 |
|
|
| 1721 |
/* ... else fall through for endonly */ |
/* ... else fall through for endonly */ |
| 1722 |
|
|
| 1723 |
/* End of subject assertion (\z) */ |
/* End of subject assertion (\z) */ |
| 1724 |
|
|
| 1725 |
case OP_EOD: |
case OP_EOD: |
| 1726 |
if (eptr < md->end_subject) RRETURN(MATCH_NOMATCH); |
if (eptr < md->end_subject) MRRETURN(MATCH_NOMATCH); |
| 1727 |
|
SCHECK_PARTIAL(); |
| 1728 |
ecode++; |
ecode++; |
| 1729 |
break; |
break; |
| 1730 |
|
|
| 1731 |
/* End of subject or ending \n assertion (\Z) */ |
/* End of subject or ending \n assertion (\Z) */ |
| 1732 |
|
|
| 1733 |
case OP_EODN: |
case OP_EODN: |
| 1734 |
if (eptr != md->end_subject && |
ASSERT_NL_OR_EOS: |
| 1735 |
|
if (eptr < md->end_subject && |
| 1736 |
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen)) |
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen)) |
| 1737 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1738 |
|
|
| 1739 |
|
/* Either at end of string or \n before end. */ |
| 1740 |
|
|
| 1741 |
|
SCHECK_PARTIAL(); |
| 1742 |
ecode++; |
ecode++; |
| 1743 |
break; |
break; |
| 1744 |
|
|
| 1756 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1757 |
if (utf8) |
if (utf8) |
| 1758 |
{ |
{ |
| 1759 |
|
/* Get status of previous character */ |
| 1760 |
|
|
| 1761 |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
| 1762 |
{ |
{ |
| 1763 |
USPTR lastptr = eptr - 1; |
USPTR lastptr = eptr - 1; |
| 1764 |
while((*lastptr & 0xc0) == 0x80) lastptr--; |
while((*lastptr & 0xc0) == 0x80) lastptr--; |
| 1765 |
if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr; |
if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr; |
| 1766 |
GETCHAR(c, lastptr); |
GETCHAR(c, lastptr); |
| 1767 |
|
#ifdef SUPPORT_UCP |
| 1768 |
|
if (md->use_ucp) |
| 1769 |
|
{ |
| 1770 |
|
if (c == '_') prev_is_word = TRUE; else |
| 1771 |
|
{ |
| 1772 |
|
int cat = UCD_CATEGORY(c); |
| 1773 |
|
prev_is_word = (cat == ucp_L || cat == ucp_N); |
| 1774 |
|
} |
| 1775 |
|
} |
| 1776 |
|
else |
| 1777 |
|
#endif |
| 1778 |
prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
| 1779 |
} |
} |
| 1780 |
|
|
| 1781 |
|
/* Get status of next character */ |
| 1782 |
|
|
| 1783 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1784 |
{ |
{ |
| 1785 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1788 |
else |
else |
| 1789 |
{ |
{ |
| 1790 |
GETCHAR(c, eptr); |
GETCHAR(c, eptr); |
| 1791 |
|
#ifdef SUPPORT_UCP |
| 1792 |
|
if (md->use_ucp) |
| 1793 |
|
{ |
| 1794 |
|
if (c == '_') cur_is_word = TRUE; else |
| 1795 |
|
{ |
| 1796 |
|
int cat = UCD_CATEGORY(c); |
| 1797 |
|
cur_is_word = (cat == ucp_L || cat == ucp_N); |
| 1798 |
|
} |
| 1799 |
|
} |
| 1800 |
|
else |
| 1801 |
|
#endif |
| 1802 |
cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; |
| 1803 |
} |
} |
| 1804 |
} |
} |
| 1805 |
else |
else |
| 1806 |
#endif |
#endif |
| 1807 |
|
|
| 1808 |
/* Not in UTF-8 mode */ |
/* Not in UTF-8 mode, but we may still have PCRE_UCP set, and for |
| 1809 |
|
consistency with the behaviour of \w we do use it in this case. */ |
| 1810 |
|
|
| 1811 |
{ |
{ |
| 1812 |
|
/* Get status of previous character */ |
| 1813 |
|
|
| 1814 |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
if (eptr == md->start_subject) prev_is_word = FALSE; else |
| 1815 |
{ |
{ |
| 1816 |
if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1; |
if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1; |
| 1817 |
|
#ifdef SUPPORT_UCP |
| 1818 |
|
if (md->use_ucp) |
| 1819 |
|
{ |
| 1820 |
|
c = eptr[-1]; |
| 1821 |
|
if (c == '_') prev_is_word = TRUE; else |
| 1822 |
|
{ |
| 1823 |
|
int cat = UCD_CATEGORY(c); |
| 1824 |
|
prev_is_word = (cat == ucp_L || cat == ucp_N); |
| 1825 |
|
} |
| 1826 |
|
} |
| 1827 |
|
else |
| 1828 |
|
#endif |
| 1829 |
prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0); |
prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0); |
| 1830 |
} |
} |
| 1831 |
|
|
| 1832 |
|
/* Get status of next character */ |
| 1833 |
|
|
| 1834 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1835 |
{ |
{ |
| 1836 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1837 |
cur_is_word = FALSE; |
cur_is_word = FALSE; |
| 1838 |
} |
} |
| 1839 |
else cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0); |
else |
| 1840 |
|
#ifdef SUPPORT_UCP |
| 1841 |
|
if (md->use_ucp) |
| 1842 |
|
{ |
| 1843 |
|
c = *eptr; |
| 1844 |
|
if (c == '_') cur_is_word = TRUE; else |
| 1845 |
|
{ |
| 1846 |
|
int cat = UCD_CATEGORY(c); |
| 1847 |
|
cur_is_word = (cat == ucp_L || cat == ucp_N); |
| 1848 |
|
} |
| 1849 |
|
} |
| 1850 |
|
else |
| 1851 |
|
#endif |
| 1852 |
|
cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0); |
| 1853 |
} |
} |
| 1854 |
|
|
| 1855 |
/* Now see if the situation is what we want */ |
/* Now see if the situation is what we want */ |
| 1856 |
|
|
| 1857 |
if ((*ecode++ == OP_WORD_BOUNDARY)? |
if ((*ecode++ == OP_WORD_BOUNDARY)? |
| 1858 |
cur_is_word == prev_is_word : cur_is_word != prev_is_word) |
cur_is_word == prev_is_word : cur_is_word != prev_is_word) |
| 1859 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1860 |
} |
} |
| 1861 |
break; |
break; |
| 1862 |
|
|
| 1863 |
/* Match a single character type; inline for speed */ |
/* Match a single character type; inline for speed */ |
| 1864 |
|
|
| 1865 |
case OP_ANY: |
case OP_ANY: |
| 1866 |
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); |
if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); |
| 1867 |
/* Fall through */ |
/* Fall through */ |
| 1868 |
|
|
| 1869 |
case OP_ALLANY: |
case OP_ALLANY: |
| 1870 |
if (eptr++ >= md->end_subject) |
if (eptr++ >= md->end_subject) |
| 1871 |
{ |
{ |
| 1872 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1873 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1874 |
} |
} |
| 1875 |
if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 1876 |
ecode++; |
ecode++; |
| 1883 |
if (eptr++ >= md->end_subject) |
if (eptr++ >= md->end_subject) |
| 1884 |
{ |
{ |
| 1885 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1886 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1887 |
} |
} |
| 1888 |
ecode++; |
ecode++; |
| 1889 |
break; |
break; |
| 1892 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 1893 |
{ |
{ |
| 1894 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 1895 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1896 |
} |
} |
| 1897 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 1898 |
if ( |
if ( |
| 1901 |
#endif |
#endif |
| 1902 |
(md->ctypes[c] & ctype_digit) != 0 |
(md->ctypes[c] & ctype_digit) != 0 |
| 1903 |
) |
) |
| 1904 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 1905 |
ecode++; |
ecode++; |
| 1906 |
break; |
break; |
| 1907 |
|
|
| 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_space) != 0 |
(md->ctypes[c] & ctype_space) != 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_word) != 0 |
(md->ctypes[c] & ctype_word) != 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 |
switch(c) |
switch(c) |
| 2001 |
{ |
{ |
| 2002 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 2003 |
case 0x000d: |
case 0x000d: |
| 2004 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 2005 |
break; |
break; |
| 2012 |
case 0x0085: |
case 0x0085: |
| 2013 |
case 0x2028: |
case 0x2028: |
| 2014 |
case 0x2029: |
case 0x2029: |
| 2015 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 2016 |
break; |
break; |
| 2017 |
} |
} |
| 2018 |
ecode++; |
ecode++; |
| 2022 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2023 |
{ |
{ |
| 2024 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2025 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2026 |
} |
} |
| 2027 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2028 |
switch(c) |
switch(c) |
| 2047 |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 2048 |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 2049 |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 2050 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2051 |
} |
} |
| 2052 |
ecode++; |
ecode++; |
| 2053 |
break; |
break; |
| 2056 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2057 |
{ |
{ |
| 2058 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2059 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2060 |
} |
} |
| 2061 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2062 |
switch(c) |
switch(c) |
| 2063 |
{ |
{ |
| 2064 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 2065 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 2066 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 2067 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 2090 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2091 |
{ |
{ |
| 2092 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2093 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2094 |
} |
} |
| 2095 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2096 |
switch(c) |
switch(c) |
| 2103 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 2104 |
case 0x2028: /* LINE SEPARATOR */ |
case 0x2028: /* LINE SEPARATOR */ |
| 2105 |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 2106 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2107 |
} |
} |
| 2108 |
ecode++; |
ecode++; |
| 2109 |
break; |
break; |
| 2112 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2113 |
{ |
{ |
| 2114 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2115 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2116 |
} |
} |
| 2117 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2118 |
switch(c) |
switch(c) |
| 2119 |
{ |
{ |
| 2120 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 2121 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 2122 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 2123 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 2139 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2140 |
{ |
{ |
| 2141 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2142 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2143 |
} |
} |
| 2144 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2145 |
{ |
{ |
| 2148 |
switch(ecode[1]) |
switch(ecode[1]) |
| 2149 |
{ |
{ |
| 2150 |
case PT_ANY: |
case PT_ANY: |
| 2151 |
if (op == OP_NOTPROP) RRETURN(MATCH_NOMATCH); |
if (op == OP_NOTPROP) MRRETURN(MATCH_NOMATCH); |
| 2152 |
break; |
break; |
| 2153 |
|
|
| 2154 |
case PT_LAMP: |
case PT_LAMP: |
| 2155 |
if ((prop->chartype == ucp_Lu || |
if ((prop->chartype == ucp_Lu || |
| 2156 |
prop->chartype == ucp_Ll || |
prop->chartype == ucp_Ll || |
| 2157 |
prop->chartype == ucp_Lt) == (op == OP_NOTPROP)) |
prop->chartype == ucp_Lt) == (op == OP_NOTPROP)) |
| 2158 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2159 |
break; |
break; |
| 2160 |
|
|
| 2161 |
case PT_GC: |
case PT_GC: |
| 2162 |
if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP)) |
if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP)) |
| 2163 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2164 |
break; |
break; |
| 2165 |
|
|
| 2166 |
case PT_PC: |
case PT_PC: |
| 2167 |
if ((ecode[2] != prop->chartype) == (op == OP_PROP)) |
if ((ecode[2] != prop->chartype) == (op == OP_PROP)) |
| 2168 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2169 |
break; |
break; |
| 2170 |
|
|
| 2171 |
case PT_SC: |
case PT_SC: |
| 2172 |
if ((ecode[2] != prop->script) == (op == OP_PROP)) |
if ((ecode[2] != prop->script) == (op == OP_PROP)) |
| 2173 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2174 |
|
break; |
| 2175 |
|
|
| 2176 |
|
/* These are specials */ |
| 2177 |
|
|
| 2178 |
|
case PT_ALNUM: |
| 2179 |
|
if ((_pcre_ucp_gentype[prop->chartype] == ucp_L || |
| 2180 |
|
_pcre_ucp_gentype[prop->chartype] == ucp_N) == (op == OP_NOTPROP)) |
| 2181 |
|
MRRETURN(MATCH_NOMATCH); |
| 2182 |
|
break; |
| 2183 |
|
|
| 2184 |
|
case PT_SPACE: /* Perl space */ |
| 2185 |
|
if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z || |
| 2186 |
|
c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR) |
| 2187 |
|
== (op == OP_NOTPROP)) |
| 2188 |
|
MRRETURN(MATCH_NOMATCH); |
| 2189 |
break; |
break; |
| 2190 |
|
|
| 2191 |
|
case PT_PXSPACE: /* POSIX space */ |
| 2192 |
|
if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z || |
| 2193 |
|
c == CHAR_HT || c == CHAR_NL || c == CHAR_VT || |
| 2194 |
|
c == CHAR_FF || c == CHAR_CR) |
| 2195 |
|
== (op == OP_NOTPROP)) |
| 2196 |
|
MRRETURN(MATCH_NOMATCH); |
| 2197 |
|
break; |
| 2198 |
|
|
| 2199 |
|
case PT_WORD: |
| 2200 |
|
if ((_pcre_ucp_gentype[prop->chartype] == ucp_L || |
| 2201 |
|
_pcre_ucp_gentype[prop->chartype] == ucp_N || |
| 2202 |
|
c == CHAR_UNDERSCORE) == (op == OP_NOTPROP)) |
| 2203 |
|
MRRETURN(MATCH_NOMATCH); |
| 2204 |
|
break; |
| 2205 |
|
|
| 2206 |
|
/* This should never occur */ |
| 2207 |
|
|
| 2208 |
default: |
default: |
| 2209 |
RRETURN(PCRE_ERROR_INTERNAL); |
RRETURN(PCRE_ERROR_INTERNAL); |
| 2210 |
} |
} |
| 2220 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2221 |
{ |
{ |
| 2222 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2223 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2224 |
} |
} |
| 2225 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2226 |
{ |
{ |
| 2227 |
int category = UCD_CATEGORY(c); |
int category = UCD_CATEGORY(c); |
| 2228 |
if (category == ucp_M) RRETURN(MATCH_NOMATCH); |
if (category == ucp_M) MRRETURN(MATCH_NOMATCH); |
| 2229 |
while (eptr < md->end_subject) |
while (eptr < md->end_subject) |
| 2230 |
{ |
{ |
| 2231 |
int len = 1; |
int len = 1; |
| 2270 |
referenced subpattern. */ |
referenced subpattern. */ |
| 2271 |
|
|
| 2272 |
if (offset >= offset_top || md->offset_vector[offset] < 0) |
if (offset >= offset_top || md->offset_vector[offset] < 0) |
| 2273 |
length = (md->jscript_compat)? 0 : md->end_subject - eptr + 1; |
length = (md->jscript_compat)? 0 : (int)(md->end_subject - eptr + 1); |
| 2274 |
else |
else |
| 2275 |
length = md->offset_vector[offset+1] - md->offset_vector[offset]; |
length = md->offset_vector[offset+1] - md->offset_vector[offset]; |
| 2276 |
|
|
| 2304 |
if (!match_ref(offset, eptr, length, md, ims)) |
if (!match_ref(offset, eptr, length, md, ims)) |
| 2305 |
{ |
{ |
| 2306 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2307 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2308 |
} |
} |
| 2309 |
eptr += length; |
eptr += length; |
| 2310 |
continue; /* With the main loop */ |
continue; /* With the main loop */ |
| 2324 |
if (!match_ref(offset, eptr, length, md, ims)) |
if (!match_ref(offset, eptr, length, md, ims)) |
| 2325 |
{ |
{ |
| 2326 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2327 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2328 |
} |
} |
| 2329 |
eptr += length; |
eptr += length; |
| 2330 |
} |
} |
| 2342 |
{ |
{ |
| 2343 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14); |
| 2344 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2345 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2346 |
if (!match_ref(offset, eptr, length, md, ims)) |
if (!match_ref(offset, eptr, length, md, ims)) |
| 2347 |
{ |
{ |
| 2348 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2349 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2350 |
} |
} |
| 2351 |
eptr += length; |
eptr += length; |
| 2352 |
} |
} |
| 2373 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2374 |
eptr -= length; |
eptr -= length; |
| 2375 |
} |
} |
| 2376 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2377 |
} |
} |
| 2378 |
} |
} |
| 2379 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2435 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2436 |
{ |
{ |
| 2437 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2438 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2439 |
} |
} |
| 2440 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 2441 |
if (c > 255) |
if (c > 255) |
| 2442 |
{ |
{ |
| 2443 |
if (op == OP_CLASS) RRETURN(MATCH_NOMATCH); |
if (op == OP_CLASS) MRRETURN(MATCH_NOMATCH); |
| 2444 |
} |
} |
| 2445 |
else |
else |
| 2446 |
{ |
{ |
| 2447 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2448 |
} |
} |
| 2449 |
} |
} |
| 2450 |
} |
} |
| 2457 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2458 |
{ |
{ |
| 2459 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2460 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2461 |
} |
} |
| 2462 |
c = *eptr++; |
c = *eptr++; |
| 2463 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2464 |
} |
} |
| 2465 |
} |
} |
| 2466 |
|
|
| 2482 |
{ |
{ |
| 2483 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16); |
| 2484 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2485 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2486 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2487 |
{ |
{ |
| 2488 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2489 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2490 |
} |
} |
| 2491 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 2492 |
if (c > 255) |
if (c > 255) |
| 2493 |
{ |
{ |
| 2494 |
if (op == OP_CLASS) RRETURN(MATCH_NOMATCH); |
if (op == OP_CLASS) MRRETURN(MATCH_NOMATCH); |
| 2495 |
} |
} |
| 2496 |
else |
else |
| 2497 |
{ |
{ |
| 2498 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2499 |
} |
} |
| 2500 |
} |
} |
| 2501 |
} |
} |
| 2507 |
{ |
{ |
| 2508 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17); |
| 2509 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2510 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2511 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2512 |
{ |
{ |
| 2513 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2514 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2515 |
} |
} |
| 2516 |
c = *eptr++; |
c = *eptr++; |
| 2517 |
if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH); |
if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH); |
| 2518 |
} |
} |
| 2519 |
} |
} |
| 2520 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2580 |
} |
} |
| 2581 |
} |
} |
| 2582 |
|
|
| 2583 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2584 |
} |
} |
| 2585 |
} |
} |
| 2586 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2632 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2633 |
{ |
{ |
| 2634 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2635 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2636 |
} |
} |
| 2637 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2638 |
if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH); |
if (!_pcre_xclass(c, data)) MRRETURN(MATCH_NOMATCH); |
| 2639 |
} |
} |
| 2640 |
|
|
| 2641 |
/* If max == min we can continue with the main loop without the |
/* If max == min we can continue with the main loop without the |
| 2652 |
{ |
{ |
| 2653 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20); |
| 2654 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2655 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2656 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2657 |
{ |
{ |
| 2658 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2659 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2660 |
} |
} |
| 2661 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 2662 |
if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH); |
if (!_pcre_xclass(c, data)) MRRETURN(MATCH_NOMATCH); |
| 2663 |
} |
} |
| 2664 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2665 |
} |
} |
| 2688 |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
if (eptr-- == pp) break; /* Stop if tried at original pos */ |
| 2689 |
if (utf8) BACKCHAR(eptr); |
if (utf8) BACKCHAR(eptr); |
| 2690 |
} |
} |
| 2691 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2692 |
} |
} |
| 2693 |
|
|
| 2694 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2707 |
if (length > md->end_subject - eptr) |
if (length > md->end_subject - eptr) |
| 2708 |
{ |
{ |
| 2709 |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
| 2710 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2711 |
} |
} |
| 2712 |
while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH); |
while (length-- > 0) if (*ecode++ != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 2713 |
} |
} |
| 2714 |
else |
else |
| 2715 |
#endif |
#endif |
| 2719 |
if (md->end_subject - eptr < 1) |
if (md->end_subject - eptr < 1) |
| 2720 |
{ |
{ |
| 2721 |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
| 2722 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2723 |
} |
} |
| 2724 |
if (ecode[1] != *eptr++) RRETURN(MATCH_NOMATCH); |
if (ecode[1] != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 2725 |
ecode += 2; |
ecode += 2; |
| 2726 |
} |
} |
| 2727 |
break; |
break; |
| 2739 |
if (length > md->end_subject - eptr) |
if (length > md->end_subject - eptr) |
| 2740 |
{ |
{ |
| 2741 |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */ |
| 2742 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2743 |
} |
} |
| 2744 |
|
|
| 2745 |
/* 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 |
| 2747 |
|
|
| 2748 |
if (fc < 128) |
if (fc < 128) |
| 2749 |
{ |
{ |
| 2750 |
if (md->lcc[*ecode++] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (md->lcc[*ecode++] != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2751 |
} |
} |
| 2752 |
|
|
| 2753 |
/* Otherwise we must pick up the subject character */ |
/* Otherwise we must pick up the subject character */ |
| 2766 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2767 |
if (dc != UCD_OTHERCASE(fc)) |
if (dc != UCD_OTHERCASE(fc)) |
| 2768 |
#endif |
#endif |
| 2769 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2770 |
} |
} |
| 2771 |
} |
} |
| 2772 |
} |
} |
| 2778 |
if (md->end_subject - eptr < 1) |
if (md->end_subject - eptr < 1) |
| 2779 |
{ |
{ |
| 2780 |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */ |
| 2781 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2782 |
} |
} |
| 2783 |
if (md->lcc[ecode[1]] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (md->lcc[ecode[1]] != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2784 |
ecode += 2; |
ecode += 2; |
| 2785 |
} |
} |
| 2786 |
break; |
break; |
| 2874 |
else |
else |
| 2875 |
{ |
{ |
| 2876 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2877 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2878 |
} |
} |
| 2879 |
} |
} |
| 2880 |
|
|
| 2886 |
{ |
{ |
| 2887 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22); |
| 2888 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2889 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2890 |
if (eptr <= md->end_subject - length && |
if (eptr <= md->end_subject - length && |
| 2891 |
memcmp(eptr, charptr, length) == 0) eptr += length; |
memcmp(eptr, charptr, length) == 0) eptr += length; |
| 2892 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2897 |
else |
else |
| 2898 |
{ |
{ |
| 2899 |
CHECK_PARTIAL(); |
CHECK_PARTIAL(); |
| 2900 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2901 |
} |
} |
| 2902 |
} |
} |
| 2903 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2928 |
{ |
{ |
| 2929 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23); |
| 2930 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2931 |
if (eptr == pp) { RRETURN(MATCH_NOMATCH); } |
if (eptr == pp) { MRRETURN(MATCH_NOMATCH); } |
| 2932 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 2933 |
eptr--; |
eptr--; |
| 2934 |
BACKCHAR(eptr); |
BACKCHAR(eptr); |
| 2971 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2972 |
{ |
{ |
| 2973 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2974 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2975 |
} |
} |
| 2976 |
if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2977 |
} |
} |
| 2978 |
if (min == max) continue; |
if (min == max) continue; |
| 2979 |
if (minimize) |
if (minimize) |
| 2982 |
{ |
{ |
| 2983 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24); |
| 2984 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 2985 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 2986 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 2987 |
{ |
{ |
| 2988 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 2989 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 2990 |
} |
} |
| 2991 |
if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 2992 |
} |
} |
| 2993 |
/* Control never gets here */ |
/* Control never gets here */ |
| 2994 |
} |
} |
| 3014 |
eptr--; |
eptr--; |
| 3015 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3016 |
} |
} |
| 3017 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3018 |
} |
} |
| 3019 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3020 |
} |
} |
| 3028 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3029 |
{ |
{ |
| 3030 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3031 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3032 |
} |
} |
| 3033 |
if (fc != *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3034 |
} |
} |
| 3035 |
|
|
| 3036 |
if (min == max) continue; |
if (min == max) continue; |
| 3041 |
{ |
{ |
| 3042 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26); |
| 3043 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3044 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3045 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3046 |
{ |
{ |
| 3047 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3048 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3049 |
} |
} |
| 3050 |
if (fc != *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc != *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3051 |
} |
} |
| 3052 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3053 |
} |
} |
| 3072 |
eptr--; |
eptr--; |
| 3073 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3074 |
} |
} |
| 3075 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3076 |
} |
} |
| 3077 |
} |
} |
| 3078 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3084 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3085 |
{ |
{ |
| 3086 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3087 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3088 |
} |
} |
| 3089 |
ecode++; |
ecode++; |
| 3090 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3094 |
if (c < 256) |
if (c < 256) |
| 3095 |
#endif |
#endif |
| 3096 |
c = md->lcc[c]; |
c = md->lcc[c]; |
| 3097 |
if (md->lcc[*ecode++] == c) RRETURN(MATCH_NOMATCH); |
if (md->lcc[*ecode++] == c) MRRETURN(MATCH_NOMATCH); |
| 3098 |
} |
} |
| 3099 |
else |
else |
| 3100 |
{ |
{ |
| 3101 |
if (*ecode++ == c) RRETURN(MATCH_NOMATCH); |
if (*ecode++ == c) MRRETURN(MATCH_NOMATCH); |
| 3102 |
} |
} |
| 3103 |
break; |
break; |
| 3104 |
|
|
| 3192 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3193 |
{ |
{ |
| 3194 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3195 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3196 |
} |
} |
| 3197 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3198 |
if (d < 256) d = md->lcc[d]; |
if (d < 256) d = md->lcc[d]; |
| 3199 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3200 |
} |
} |
| 3201 |
} |
} |
| 3202 |
else |
else |
| 3209 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3210 |
{ |
{ |
| 3211 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3212 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3213 |
} |
} |
| 3214 |
if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc == md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 3215 |
} |
} |
| 3216 |
} |
} |
| 3217 |
|
|
| 3228 |
{ |
{ |
| 3229 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28); |
| 3230 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3231 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3232 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3233 |
{ |
{ |
| 3234 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3235 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3236 |
} |
} |
| 3237 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3238 |
if (d < 256) d = md->lcc[d]; |
if (d < 256) d = md->lcc[d]; |
| 3239 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3240 |
} |
} |
| 3241 |
} |
} |
| 3242 |
else |
else |
| 3247 |
{ |
{ |
| 3248 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29); |
| 3249 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3250 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3251 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3252 |
{ |
{ |
| 3253 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3254 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3255 |
} |
} |
| 3256 |
if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH); |
if (fc == md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH); |
| 3257 |
} |
} |
| 3258 |
} |
} |
| 3259 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3315 |
} |
} |
| 3316 |
} |
} |
| 3317 |
|
|
| 3318 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3319 |
} |
} |
| 3320 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3321 |
} |
} |
| 3334 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3335 |
{ |
{ |
| 3336 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3337 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3338 |
} |
} |
| 3339 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3340 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3341 |
} |
} |
| 3342 |
} |
} |
| 3343 |
else |
else |
| 3349 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3350 |
{ |
{ |
| 3351 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3352 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3353 |
} |
} |
| 3354 |
if (fc == *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc == *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3355 |
} |
} |
| 3356 |
} |
} |
| 3357 |
|
|
| 3368 |
{ |
{ |
| 3369 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32); |
| 3370 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 3371 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 3372 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3373 |
{ |
{ |
| 3374 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3375 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3376 |
} |
} |
| 3377 |
GETCHARINC(d, eptr); |
GETCHARINC(d, eptr); |
| 3378 |
if (fc == d) RRETURN(MATCH_NOMATCH); |
if (fc == d) MRRETURN(MATCH_NOMATCH); |
| 3379 |
} |
} |
| 3380 |
} |
} |
| 3381 |
else |
else |
| 3386 |
{ |
{ |
| 3387 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33); |
| 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 |
if (fc == *eptr++) RRETURN(MATCH_NOMATCH); |
if (fc == *eptr++) MRRETURN(MATCH_NOMATCH); |
| 3396 |
} |
} |
| 3397 |
} |
} |
| 3398 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3453 |
} |
} |
| 3454 |
} |
} |
| 3455 |
|
|
| 3456 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3457 |
} |
} |
| 3458 |
} |
} |
| 3459 |
/* Control never gets here */ |
/* Control never gets here */ |
| 3547 |
switch(prop_type) |
switch(prop_type) |
| 3548 |
{ |
{ |
| 3549 |
case PT_ANY: |
case PT_ANY: |
| 3550 |
if (prop_fail_result) RRETURN(MATCH_NOMATCH); |
if (prop_fail_result) MRRETURN(MATCH_NOMATCH); |
| 3551 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
| 3552 |
{ |
{ |
| 3553 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3554 |
{ |
{ |
| 3555 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3556 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3557 |
} |
} |
| 3558 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3559 |
} |
} |
| 3565 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3566 |
{ |
{ |
| 3567 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3568 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3569 |
} |
} |
| 3570 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3571 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 3572 |
if ((prop_chartype == ucp_Lu || |
if ((prop_chartype == ucp_Lu || |
| 3573 |
prop_chartype == ucp_Ll || |
prop_chartype == ucp_Ll || |
| 3574 |
prop_chartype == ucp_Lt) == prop_fail_result) |
prop_chartype == ucp_Lt) == prop_fail_result) |
| 3575 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3576 |
} |
} |
| 3577 |
break; |
break; |
| 3578 |
|
|
| 3582 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3583 |
{ |
{ |
| 3584 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3585 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3586 |
} |
} |
| 3587 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3588 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 3589 |
if ((prop_category == prop_value) == prop_fail_result) |
if ((prop_category == prop_value) == prop_fail_result) |
| 3590 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3591 |
} |
} |
| 3592 |
break; |
break; |
| 3593 |
|
|
| 3597 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3598 |
{ |
{ |
| 3599 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3600 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3601 |
} |
} |
| 3602 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3603 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 3604 |
if ((prop_chartype == prop_value) == prop_fail_result) |
if ((prop_chartype == prop_value) == prop_fail_result) |
| 3605 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3606 |
} |
} |
| 3607 |
break; |
break; |
| 3608 |
|
|
| 3612 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3613 |
{ |
{ |
| 3614 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3615 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3616 |
} |
} |
| 3617 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3618 |
prop_script = UCD_SCRIPT(c); |
prop_script = UCD_SCRIPT(c); |
| 3619 |
if ((prop_script == prop_value) == prop_fail_result) |
if ((prop_script == prop_value) == prop_fail_result) |
| 3620 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3621 |
} |
} |
| 3622 |
break; |
break; |
| 3623 |
|
|
| 3624 |
|
case PT_ALNUM: |
| 3625 |
|
for (i = 1; i <= min; i++) |
| 3626 |
|
{ |
| 3627 |
|
if (eptr >= md->end_subject) |
| 3628 |
|
{ |
| 3629 |
|
SCHECK_PARTIAL(); |
| 3630 |
|
MRRETURN(MATCH_NOMATCH); |
| 3631 |
|
} |
| 3632 |
|
GETCHARINCTEST(c, eptr); |
| 3633 |
|
prop_category = UCD_CATEGORY(c); |
| 3634 |
|
if ((prop_category == ucp_L || prop_category == ucp_N) |
| 3635 |
|
== prop_fail_result) |
| 3636 |
|
MRRETURN(MATCH_NOMATCH); |
| 3637 |
|
} |
| 3638 |
|
break; |
| 3639 |
|
|
| 3640 |
|
case PT_SPACE: /* Perl space */ |
| 3641 |
|
for (i = 1; i <= min; i++) |
| 3642 |
|
{ |
| 3643 |
|
if (eptr >= md->end_subject) |
| 3644 |
|
{ |
| 3645 |
|
SCHECK_PARTIAL(); |
| 3646 |
|
MRRETURN(MATCH_NOMATCH); |
| 3647 |
|
} |
| 3648 |
|
GETCHARINCTEST(c, eptr); |
| 3649 |
|
prop_category = UCD_CATEGORY(c); |
| 3650 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 3651 |
|
c == CHAR_FF || c == CHAR_CR) |
| 3652 |
|
== prop_fail_result) |
| 3653 |
|
MRRETURN(MATCH_NOMATCH); |
| 3654 |
|
} |
| 3655 |
|
break; |
| 3656 |
|
|
| 3657 |
|
case PT_PXSPACE: /* POSIX space */ |
| 3658 |
|
for (i = 1; i <= min; i++) |
| 3659 |
|
{ |
| 3660 |
|
if (eptr >= md->end_subject) |
| 3661 |
|
{ |
| 3662 |
|
SCHECK_PARTIAL(); |
| 3663 |
|
MRRETURN(MATCH_NOMATCH); |
| 3664 |
|
} |
| 3665 |
|
GETCHARINCTEST(c, eptr); |
| 3666 |
|
prop_category = UCD_CATEGORY(c); |
| 3667 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 3668 |
|
c == CHAR_VT || c == CHAR_FF || c == CHAR_CR) |
| 3669 |
|
== prop_fail_result) |
| 3670 |
|
MRRETURN(MATCH_NOMATCH); |
| 3671 |
|
} |
| 3672 |
|
break; |
| 3673 |
|
|
| 3674 |
|
case PT_WORD: |
| 3675 |
|
for (i = 1; i <= min; i++) |
| 3676 |
|
{ |
| 3677 |
|
if (eptr >= md->end_subject) |
| 3678 |
|
{ |
| 3679 |
|
SCHECK_PARTIAL(); |
| 3680 |
|
MRRETURN(MATCH_NOMATCH); |
| 3681 |
|
} |
| 3682 |
|
GETCHARINCTEST(c, eptr); |
| 3683 |
|
prop_category = UCD_CATEGORY(c); |
| 3684 |
|
if ((prop_category == ucp_L || prop_category == ucp_N || |
| 3685 |
|
c == CHAR_UNDERSCORE) |
| 3686 |
|
== prop_fail_result) |
| 3687 |
|
MRRETURN(MATCH_NOMATCH); |
| 3688 |
|
} |
| 3689 |
|
break; |
| 3690 |
|
|
| 3691 |
|
/* This should not occur */ |
| 3692 |
|
|
| 3693 |
default: |
default: |
| 3694 |
RRETURN(PCRE_ERROR_INTERNAL); |
RRETURN(PCRE_ERROR_INTERNAL); |
| 3695 |
} |
} |
| 3705 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3706 |
{ |
{ |
| 3707 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3708 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3709 |
} |
} |
| 3710 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 3711 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 3712 |
if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH); |
if (prop_category == ucp_M) MRRETURN(MATCH_NOMATCH); |
| 3713 |
while (eptr < md->end_subject) |
while (eptr < md->end_subject) |
| 3714 |
{ |
{ |
| 3715 |
int len = 1; |
int len = 1; |
| 3736 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3737 |
{ |
{ |
| 3738 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3739 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3740 |
} |
} |
| 3741 |
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); |
if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); |
| 3742 |
eptr++; |
eptr++; |
| 3743 |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 3744 |
} |
} |
| 3750 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3751 |
{ |
{ |
| 3752 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3753 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3754 |
} |
} |
| 3755 |
eptr++; |
eptr++; |
| 3756 |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++; |
| 3758 |
break; |
break; |
| 3759 |
|
|
| 3760 |
case OP_ANYBYTE: |
case OP_ANYBYTE: |
| 3761 |
if (eptr > md->end_subject - min) RRETURN(MATCH_NOMATCH); |
if (eptr > md->end_subject - min) MRRETURN(MATCH_NOMATCH); |
| 3762 |
eptr += min; |
eptr += min; |
| 3763 |
break; |
break; |
| 3764 |
|
|
| 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 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3774 |
switch(c) |
switch(c) |
| 3775 |
{ |
{ |
| 3776 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3777 |
case 0x000d: |
case 0x000d: |
| 3778 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 3779 |
break; |
break; |
| 3786 |
case 0x0085: |
case 0x0085: |
| 3787 |
case 0x2028: |
case 0x2028: |
| 3788 |
case 0x2029: |
case 0x2029: |
| 3789 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 3790 |
break; |
break; |
| 3791 |
} |
} |
| 3792 |
} |
} |
| 3798 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3799 |
{ |
{ |
| 3800 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3801 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3802 |
} |
} |
| 3803 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3804 |
switch(c) |
switch(c) |
| 3823 |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 3824 |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 3825 |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 3826 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3827 |
} |
} |
| 3828 |
} |
} |
| 3829 |
break; |
break; |
| 3834 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3835 |
{ |
{ |
| 3836 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3837 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3838 |
} |
} |
| 3839 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3840 |
switch(c) |
switch(c) |
| 3841 |
{ |
{ |
| 3842 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3843 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 3844 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 3845 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 3870 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3871 |
{ |
{ |
| 3872 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3873 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3874 |
} |
} |
| 3875 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3876 |
switch(c) |
switch(c) |
| 3883 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 3884 |
case 0x2028: /* LINE SEPARATOR */ |
case 0x2028: /* LINE SEPARATOR */ |
| 3885 |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 3886 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3887 |
} |
} |
| 3888 |
} |
} |
| 3889 |
break; |
break; |
| 3894 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3895 |
{ |
{ |
| 3896 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3897 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3898 |
} |
} |
| 3899 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3900 |
switch(c) |
switch(c) |
| 3901 |
{ |
{ |
| 3902 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 3903 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 3904 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 3905 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 3918 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3919 |
{ |
{ |
| 3920 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3921 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3922 |
} |
} |
| 3923 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 3924 |
if (c < 128 && (md->ctypes[c] & ctype_digit) != 0) |
if (c < 128 && (md->ctypes[c] & ctype_digit) != 0) |
| 3925 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3926 |
} |
} |
| 3927 |
break; |
break; |
| 3928 |
|
|
| 3932 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3933 |
{ |
{ |
| 3934 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3935 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3936 |
} |
} |
| 3937 |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_digit) == 0) |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_digit) == 0) |
| 3938 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3939 |
/* 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 */ |
| 3940 |
} |
} |
| 3941 |
break; |
break; |
| 3946 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3947 |
{ |
{ |
| 3948 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3949 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3950 |
} |
} |
| 3951 |
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0) |
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0) |
| 3952 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3953 |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
| 3954 |
} |
} |
| 3955 |
break; |
break; |
| 3960 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3961 |
{ |
{ |
| 3962 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3963 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3964 |
} |
} |
| 3965 |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_space) == 0) |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_space) == 0) |
| 3966 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3967 |
/* 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 */ |
| 3968 |
} |
} |
| 3969 |
break; |
break; |
| 3971 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 3972 |
for (i = 1; i <= min; i++) |
for (i = 1; i <= min; i++) |
| 3973 |
{ |
{ |
| 3974 |
if (eptr >= md->end_subject || |
if (eptr >= md->end_subject) |
| 3975 |
(*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0)) |
{ |
| 3976 |
RRETURN(MATCH_NOMATCH); |
SCHECK_PARTIAL(); |
| 3977 |
|
MRRETURN(MATCH_NOMATCH); |
| 3978 |
|
} |
| 3979 |
|
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0) |
| 3980 |
|
MRRETURN(MATCH_NOMATCH); |
| 3981 |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80); |
| 3982 |
} |
} |
| 3983 |
break; |
break; |
| 3988 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 3989 |
{ |
{ |
| 3990 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 3991 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3992 |
} |
} |
| 3993 |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_word) == 0) |
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_word) == 0) |
| 3994 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 3995 |
/* 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 */ |
| 3996 |
} |
} |
| 3997 |
break; |
break; |
| 4014 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4015 |
{ |
{ |
| 4016 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4017 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4018 |
} |
} |
| 4019 |
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); |
if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); |
| 4020 |
eptr++; |
eptr++; |
| 4021 |
} |
} |
| 4022 |
break; |
break; |
| 4025 |
if (eptr > md->end_subject - min) |
if (eptr > md->end_subject - min) |
| 4026 |
{ |
{ |
| 4027 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4028 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4029 |
} |
} |
| 4030 |
eptr += min; |
eptr += min; |
| 4031 |
break; |
break; |
| 4034 |
if (eptr > md->end_subject - min) |
if (eptr > md->end_subject - min) |
| 4035 |
{ |
{ |
| 4036 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4037 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4038 |
} |
} |
| 4039 |
eptr += min; |
eptr += min; |
| 4040 |
break; |
break; |
| 4045 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4046 |
{ |
{ |
| 4047 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4048 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4049 |
} |
} |
| 4050 |
switch(*eptr++) |
switch(*eptr++) |
| 4051 |
{ |
{ |
| 4052 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4053 |
case 0x000d: |
case 0x000d: |
| 4054 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 4055 |
break; |
break; |
| 4059 |
case 0x000b: |
case 0x000b: |
| 4060 |
case 0x000c: |
case 0x000c: |
| 4061 |
case 0x0085: |
case 0x0085: |
| 4062 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 4063 |
break; |
break; |
| 4064 |
} |
} |
| 4065 |
} |
} |
| 4071 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4072 |
{ |
{ |
| 4073 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4074 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4075 |
} |
} |
| 4076 |
switch(*eptr++) |
switch(*eptr++) |
| 4077 |
{ |
{ |
| 4079 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4080 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4081 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4082 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4083 |
} |
} |
| 4084 |
} |
} |
| 4085 |
break; |
break; |
| 4090 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4091 |
{ |
{ |
| 4092 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4093 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4094 |
} |
} |
| 4095 |
switch(*eptr++) |
switch(*eptr++) |
| 4096 |
{ |
{ |
| 4097 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4098 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4099 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4100 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4109 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4110 |
{ |
{ |
| 4111 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4112 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4113 |
} |
} |
| 4114 |
switch(*eptr++) |
switch(*eptr++) |
| 4115 |
{ |
{ |
| 4119 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4120 |
case 0x0d: /* CR */ |
case 0x0d: /* CR */ |
| 4121 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 4122 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4123 |
} |
} |
| 4124 |
} |
} |
| 4125 |
break; |
break; |
| 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 |
{ |
{ |
| 4137 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4138 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 4139 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 4140 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 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 |
if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_digit) != 0) MRRETURN(MATCH_NOMATCH); |
| 4157 |
} |
} |
| 4158 |
break; |
break; |
| 4159 |
|
|
| 4163 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4164 |
{ |
{ |
| 4165 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4166 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4167 |
} |
} |
| 4168 |
if ((md->ctypes[*eptr++] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_digit) == 0) MRRETURN(MATCH_NOMATCH); |
| 4169 |
} |
} |
| 4170 |
break; |
break; |
| 4171 |
|
|
| 4175 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4176 |
{ |
{ |
| 4177 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4178 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4179 |
} |
} |
| 4180 |
if ((md->ctypes[*eptr++] & ctype_space) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_space) != 0) MRRETURN(MATCH_NOMATCH); |
| 4181 |
} |
} |
| 4182 |
break; |
break; |
| 4183 |
|
|
| 4187 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4188 |
{ |
{ |
| 4189 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4190 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4191 |
} |
} |
| 4192 |
if ((md->ctypes[*eptr++] & ctype_space) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[*eptr++] & ctype_space) == 0) MRRETURN(MATCH_NOMATCH); |
| 4193 |
} |
} |
| 4194 |
break; |
break; |
| 4195 |
|
|
| 4199 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4200 |
{ |
{ |
| 4201 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4202 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4203 |
} |
} |
| 4204 |
if ((md->ctypes[*eptr++] & ctype_word) != 0) |
if ((md->ctypes[*eptr++] & ctype_word) != 0) |
| 4205 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4206 |
} |
} |
| 4207 |
break; |
break; |
| 4208 |
|
|
| 4212 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4213 |
{ |
{ |
| 4214 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4215 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4216 |
} |
} |
| 4217 |
if ((md->ctypes[*eptr++] & ctype_word) == 0) |
if ((md->ctypes[*eptr++] & ctype_word) == 0) |
| 4218 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4219 |
} |
} |
| 4220 |
break; |
break; |
| 4221 |
|
|
| 4244 |
{ |
{ |
| 4245 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36); |
| 4246 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4247 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4248 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4249 |
{ |
{ |
| 4250 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4251 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4252 |
} |
} |
| 4253 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4254 |
if (prop_fail_result) RRETURN(MATCH_NOMATCH); |
if (prop_fail_result) MRRETURN(MATCH_NOMATCH); |
| 4255 |
} |
} |
| 4256 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4257 |
|
|
| 4260 |
{ |
{ |
| 4261 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37); |
| 4262 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4263 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4264 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4265 |
{ |
{ |
| 4266 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4267 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4268 |
} |
} |
| 4269 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4270 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4271 |
if ((prop_chartype == ucp_Lu || |
if ((prop_chartype == ucp_Lu || |
| 4272 |
prop_chartype == ucp_Ll || |
prop_chartype == ucp_Ll || |
| 4273 |
prop_chartype == ucp_Lt) == prop_fail_result) |
prop_chartype == ucp_Lt) == prop_fail_result) |
| 4274 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4275 |
} |
} |
| 4276 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4277 |
|
|
| 4280 |
{ |
{ |
| 4281 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38); |
| 4282 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4283 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4284 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4285 |
{ |
{ |
| 4286 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4287 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4288 |
} |
} |
| 4289 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4290 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4291 |
if ((prop_category == prop_value) == prop_fail_result) |
if ((prop_category == prop_value) == prop_fail_result) |
| 4292 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4293 |
} |
} |
| 4294 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4295 |
|
|
| 4298 |
{ |
{ |
| 4299 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39); |
| 4300 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4301 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4302 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4303 |
{ |
{ |
| 4304 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4305 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4306 |
} |
} |
| 4307 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4308 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4309 |
if ((prop_chartype == prop_value) == prop_fail_result) |
if ((prop_chartype == prop_value) == prop_fail_result) |
| 4310 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4311 |
} |
} |
| 4312 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4313 |
|
|
| 4316 |
{ |
{ |
| 4317 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40); |
| 4318 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4319 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4320 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4321 |
{ |
{ |
| 4322 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4323 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4324 |
} |
} |
| 4325 |
GETCHARINC(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4326 |
prop_script = UCD_SCRIPT(c); |
prop_script = UCD_SCRIPT(c); |
| 4327 |
if ((prop_script == prop_value) == prop_fail_result) |
if ((prop_script == prop_value) == prop_fail_result) |
| 4328 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4329 |
} |
} |
| 4330 |
/* Control never gets here */ |
/* Control never gets here */ |
| 4331 |
|
|
| 4332 |
|
case PT_ALNUM: |
| 4333 |
|
for (fi = min;; fi++) |
| 4334 |
|
{ |
| 4335 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM59); |
| 4336 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4337 |
|
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4338 |
|
if (eptr >= md->end_subject) |
| 4339 |
|
{ |
| 4340 |
|
SCHECK_PARTIAL(); |
| 4341 |
|
MRRETURN(MATCH_NOMATCH); |
| 4342 |
|
} |
| 4343 |
|
GETCHARINCTEST(c, eptr); |
| 4344 |
|
prop_category = UCD_CATEGORY(c); |
| 4345 |
|
if ((prop_category == ucp_L || prop_category == ucp_N) |
| 4346 |
|
== prop_fail_result) |
| 4347 |
|
MRRETURN(MATCH_NOMATCH); |
| 4348 |
|
} |
| 4349 |
|
/* Control never gets here */ |
| 4350 |
|
|
| 4351 |
|
case PT_SPACE: /* Perl space */ |
| 4352 |
|
for (fi = min;; fi++) |
| 4353 |
|
{ |
| 4354 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM60); |
| 4355 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4356 |
|
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4357 |
|
if (eptr >= md->end_subject) |
| 4358 |
|
{ |
| 4359 |
|
SCHECK_PARTIAL(); |
| 4360 |
|
MRRETURN(MATCH_NOMATCH); |
| 4361 |
|
} |
| 4362 |
|
GETCHARINCTEST(c, eptr); |
| 4363 |
|
prop_category = UCD_CATEGORY(c); |
| 4364 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 4365 |
|
c == CHAR_FF || c == CHAR_CR) |
| 4366 |
|
== prop_fail_result) |
| 4367 |
|
MRRETURN(MATCH_NOMATCH); |
| 4368 |
|
} |
| 4369 |
|
/* Control never gets here */ |
| 4370 |
|
|
| 4371 |
|
case PT_PXSPACE: /* POSIX space */ |
| 4372 |
|
for (fi = min;; fi++) |
| 4373 |
|
{ |
| 4374 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM61); |
| 4375 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4376 |
|
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4377 |
|
if (eptr >= md->end_subject) |
| 4378 |
|
{ |
| 4379 |
|
SCHECK_PARTIAL(); |
| 4380 |
|
MRRETURN(MATCH_NOMATCH); |
| 4381 |
|
} |
| 4382 |
|
GETCHARINCTEST(c, eptr); |
| 4383 |
|
prop_category = UCD_CATEGORY(c); |
| 4384 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 4385 |
|
c == CHAR_VT || c == CHAR_FF || c == CHAR_CR) |
| 4386 |
|
== prop_fail_result) |
| 4387 |
|
MRRETURN(MATCH_NOMATCH); |
| 4388 |
|
} |
| 4389 |
|
/* Control never gets here */ |
| 4390 |
|
|
| 4391 |
|
case PT_WORD: |
| 4392 |
|
for (fi = min;; fi++) |
| 4393 |
|
{ |
| 4394 |
|
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM62); |
| 4395 |
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4396 |
|
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4397 |
|
if (eptr >= md->end_subject) |
| 4398 |
|
{ |
| 4399 |
|
SCHECK_PARTIAL(); |
| 4400 |
|
MRRETURN(MATCH_NOMATCH); |
| 4401 |
|
} |
| 4402 |
|
GETCHARINCTEST(c, eptr); |
| 4403 |
|
prop_category = UCD_CATEGORY(c); |
| 4404 |
|
if ((prop_category == ucp_L || |
| 4405 |
|
prop_category == ucp_N || |
| 4406 |
|
c == CHAR_UNDERSCORE) |
| 4407 |
|
== prop_fail_result) |
| 4408 |
|
MRRETURN(MATCH_NOMATCH); |
| 4409 |
|
} |
| 4410 |
|
/* Control never gets here */ |
| 4411 |
|
|
| 4412 |
|
/* This should never occur */ |
| 4413 |
|
|
| 4414 |
default: |
default: |
| 4415 |
RRETURN(PCRE_ERROR_INTERNAL); |
RRETURN(PCRE_ERROR_INTERNAL); |
| 4416 |
} |
} |
| 4425 |
{ |
{ |
| 4426 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41); |
| 4427 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4428 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4429 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4430 |
{ |
{ |
| 4431 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4432 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4433 |
} |
} |
| 4434 |
GETCHARINCTEST(c, eptr); |
GETCHARINCTEST(c, eptr); |
| 4435 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4436 |
if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH); |
if (prop_category == ucp_M) MRRETURN(MATCH_NOMATCH); |
| 4437 |
while (eptr < md->end_subject) |
while (eptr < md->end_subject) |
| 4438 |
{ |
{ |
| 4439 |
int len = 1; |
int len = 1; |
| 4457 |
{ |
{ |
| 4458 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42); |
| 4459 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4460 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4461 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4462 |
{ |
{ |
| 4463 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4464 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4465 |
} |
} |
| 4466 |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
| 4467 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4468 |
GETCHARINC(c, eptr); |
GETCHARINC(c, eptr); |
| 4469 |
switch(ctype) |
switch(ctype) |
| 4470 |
{ |
{ |
| 4476 |
case OP_ANYNL: |
case OP_ANYNL: |
| 4477 |
switch(c) |
switch(c) |
| 4478 |
{ |
{ |
| 4479 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4480 |
case 0x000d: |
case 0x000d: |
| 4481 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 4482 |
break; |
break; |
| 4488 |
case 0x0085: |
case 0x0085: |
| 4489 |
case 0x2028: |
case 0x2028: |
| 4490 |
case 0x2029: |
case 0x2029: |
| 4491 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 4492 |
break; |
break; |
| 4493 |
} |
} |
| 4494 |
break; |
break; |
| 4516 |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
case 0x202f: /* NARROW NO-BREAK SPACE */ |
| 4517 |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ |
| 4518 |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
case 0x3000: /* IDEOGRAPHIC SPACE */ |
| 4519 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4520 |
} |
} |
| 4521 |
break; |
break; |
| 4522 |
|
|
| 4523 |
case OP_HSPACE: |
case OP_HSPACE: |
| 4524 |
switch(c) |
switch(c) |
| 4525 |
{ |
{ |
| 4526 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4527 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4528 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4529 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4558 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 4559 |
case 0x2028: /* LINE SEPARATOR */ |
case 0x2028: /* LINE SEPARATOR */ |
| 4560 |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
case 0x2029: /* PARAGRAPH SEPARATOR */ |
| 4561 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4562 |
} |
} |
| 4563 |
break; |
break; |
| 4564 |
|
|
| 4565 |
case OP_VSPACE: |
case OP_VSPACE: |
| 4566 |
switch(c) |
switch(c) |
| 4567 |
{ |
{ |
| 4568 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4569 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 4570 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 4571 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4579 |
|
|
| 4580 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 4581 |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) |
| 4582 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4583 |
break; |
break; |
| 4584 |
|
|
| 4585 |
case OP_DIGIT: |
case OP_DIGIT: |
| 4586 |
if (c >= 256 || (md->ctypes[c] & ctype_digit) == 0) |
if (c >= 256 || (md->ctypes[c] & ctype_digit) == 0) |
| 4587 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4588 |
break; |
break; |
| 4589 |
|
|
| 4590 |
case OP_NOT_WHITESPACE: |
case OP_NOT_WHITESPACE: |
| 4591 |
if (c < 256 && (md->ctypes[c] & ctype_space) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_space) != 0) |
| 4592 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4593 |
break; |
break; |
| 4594 |
|
|
| 4595 |
case OP_WHITESPACE: |
case OP_WHITESPACE: |
| 4596 |
if (c >= 256 || (md->ctypes[c] & ctype_space) == 0) |
if (c >= 256 || (md->ctypes[c] & ctype_space) == 0) |
| 4597 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4598 |
break; |
break; |
| 4599 |
|
|
| 4600 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 4601 |
if (c < 256 && (md->ctypes[c] & ctype_word) != 0) |
if (c < 256 && (md->ctypes[c] & ctype_word) != 0) |
| 4602 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4603 |
break; |
break; |
| 4604 |
|
|
| 4605 |
case OP_WORDCHAR: |
case OP_WORDCHAR: |
| 4606 |
if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) |
if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) |
| 4607 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4608 |
break; |
break; |
| 4609 |
|
|
| 4610 |
default: |
default: |
| 4620 |
{ |
{ |
| 4621 |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43); |
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43); |
| 4622 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 4623 |
if (fi >= max) RRETURN(MATCH_NOMATCH); |
if (fi >= max) MRRETURN(MATCH_NOMATCH); |
| 4624 |
if (eptr >= md->end_subject) |
if (eptr >= md->end_subject) |
| 4625 |
{ |
{ |
| 4626 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4627 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4628 |
} |
} |
| 4629 |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
if (ctype == OP_ANY && IS_NEWLINE(eptr)) |
| 4630 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4631 |
c = *eptr++; |
c = *eptr++; |
| 4632 |
switch(ctype) |
switch(ctype) |
| 4633 |
{ |
{ |
| 4639 |
case OP_ANYNL: |
case OP_ANYNL: |
| 4640 |
switch(c) |
switch(c) |
| 4641 |
{ |
{ |
| 4642 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4643 |
case 0x000d: |
case 0x000d: |
| 4644 |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
if (eptr < md->end_subject && *eptr == 0x0a) eptr++; |
| 4645 |
break; |
break; |
| 4650 |
case 0x000b: |
case 0x000b: |
| 4651 |
case 0x000c: |
case 0x000c: |
| 4652 |
case 0x0085: |
case 0x0085: |
| 4653 |
if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH); |
if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH); |
| 4654 |
break; |
break; |
| 4655 |
} |
} |
| 4656 |
break; |
break; |
| 4662 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4663 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4664 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4665 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4666 |
} |
} |
| 4667 |
break; |
break; |
| 4668 |
|
|
| 4669 |
case OP_HSPACE: |
case OP_HSPACE: |
| 4670 |
switch(c) |
switch(c) |
| 4671 |
{ |
{ |
| 4672 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4673 |
case 0x09: /* HT */ |
case 0x09: /* HT */ |
| 4674 |
case 0x20: /* SPACE */ |
case 0x20: /* SPACE */ |
| 4675 |
case 0xa0: /* NBSP */ |
case 0xa0: /* NBSP */ |
| 4686 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4687 |
case 0x0d: /* CR */ |
case 0x0d: /* CR */ |
| 4688 |
case 0x85: /* NEL */ |
case 0x85: /* NEL */ |
| 4689 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 4690 |
} |
} |
| 4691 |
break; |
break; |
| 4692 |
|
|
| 4693 |
case OP_VSPACE: |
case OP_VSPACE: |
| 4694 |
switch(c) |
switch(c) |
| 4695 |
{ |
{ |
| 4696 |
default: RRETURN(MATCH_NOMATCH); |
default: MRRETURN(MATCH_NOMATCH); |
| 4697 |
case 0x0a: /* LF */ |
case 0x0a: /* LF */ |
| 4698 |
case 0x0b: /* VT */ |
case 0x0b: /* VT */ |
| 4699 |
case 0x0c: /* FF */ |
case 0x0c: /* FF */ |
| 4704 |
break; |
break; |
| 4705 |
|
|
| 4706 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
| 4707 |
if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_digit) != 0) MRRETURN(MATCH_NOMATCH); |
| 4708 |
break; |
break; |
| 4709 |
|
|
| 4710 |
case OP_DIGIT: |
case OP_DIGIT: |
| 4711 |
if ((md->ctypes[c] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_digit) == 0) MRRETURN(MATCH_NOMATCH); |
| 4712 |
break; |
break; |
| 4713 |
|
|
| 4714 |
case OP_NOT_WHITESPACE: |
case OP_NOT_WHITESPACE: |
| 4715 |
if ((md->ctypes[c] & ctype_space) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_space) != 0) MRRETURN(MATCH_NOMATCH); |
| 4716 |
break; |
break; |
| 4717 |
|
|
| 4718 |
case OP_WHITESPACE: |
case OP_WHITESPACE: |
| 4719 |
if ((md->ctypes[c] & ctype_space) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_space) == 0) MRRETURN(MATCH_NOMATCH); |
| 4720 |
break; |
break; |
| 4721 |
|
|
| 4722 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
| 4723 |
if ((md->ctypes[c] & ctype_word) != 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_word) != 0) MRRETURN(MATCH_NOMATCH); |
| 4724 |
break; |
break; |
| 4725 |
|
|
| 4726 |
case OP_WORDCHAR: |
case OP_WORDCHAR: |
| 4727 |
if ((md->ctypes[c] & ctype_word) == 0) RRETURN(MATCH_NOMATCH); |
if ((md->ctypes[c] & ctype_word) == 0) MRRETURN(MATCH_NOMATCH); |
| 4728 |
break; |
break; |
| 4729 |
|
|
| 4730 |
default: |
default: |
| 4757 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4758 |
break; |
break; |
| 4759 |
} |
} |
| 4760 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4761 |
if (prop_fail_result) break; |
if (prop_fail_result) break; |
| 4762 |
eptr+= len; |
eptr+= len; |
| 4763 |
} |
} |
| 4772 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4773 |
break; |
break; |
| 4774 |
} |
} |
| 4775 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4776 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4777 |
if ((prop_chartype == ucp_Lu || |
if ((prop_chartype == ucp_Lu || |
| 4778 |
prop_chartype == ucp_Ll || |
prop_chartype == ucp_Ll || |
| 4791 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4792 |
break; |
break; |
| 4793 |
} |
} |
| 4794 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4795 |
prop_category = UCD_CATEGORY(c); |
prop_category = UCD_CATEGORY(c); |
| 4796 |
if ((prop_category == prop_value) == prop_fail_result) |
if ((prop_category == prop_value) == prop_fail_result) |
| 4797 |
break; |
break; |
| 4808 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4809 |
break; |
break; |
| 4810 |
} |
} |
| 4811 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4812 |
prop_chartype = UCD_CHARTYPE(c); |
prop_chartype = UCD_CHARTYPE(c); |
| 4813 |
if ((prop_chartype == prop_value) == prop_fail_result) |
if ((prop_chartype == prop_value) == prop_fail_result) |
| 4814 |
break; |
break; |
| 4825 |
SCHECK_PARTIAL(); |
SCHECK_PARTIAL(); |
| 4826 |
break; |
break; |
| 4827 |
} |
} |
| 4828 |
GETCHARLEN(c, eptr, len); |
GETCHARLENTEST(c, eptr, len); |
| 4829 |
prop_script = UCD_SCRIPT(c); |
prop_script = UCD_SCRIPT(c); |
| 4830 |
if ((prop_script == prop_value) == prop_fail_result) |
if ((prop_script == prop_value) == prop_fail_result) |
| 4831 |
break; |
break; |
| 4832 |
eptr+= len; |
eptr+= len; |
| 4833 |
} |
} |
| 4834 |
break; |
break; |
| 4835 |
|
|
| 4836 |
|
case PT_ALNUM: |
| 4837 |
|
for (i = min; i < max; i++) |
| 4838 |
|
{ |
| 4839 |
|
int len = 1; |
| 4840 |
|
if (eptr >= md->end_subject) |
| 4841 |
|
{ |
| 4842 |
|
SCHECK_PARTIAL(); |
| 4843 |
|
break; |
| 4844 |
|
} |
| 4845 |
|
GETCHARLENTEST(c, eptr, len); |
| 4846 |
|
prop_category = UCD_CATEGORY(c); |
| 4847 |
|
if ((prop_category == ucp_L || prop_category == ucp_N) |
| 4848 |
|
== prop_fail_result) |
| 4849 |
|
break; |
| 4850 |
|
eptr+= len; |
| 4851 |
|
} |
| 4852 |
|
break; |
| 4853 |
|
|
| 4854 |
|
case PT_SPACE: /* Perl space */ |
| 4855 |
|
for (i = min; i < max; i++) |
| 4856 |
|
{ |
| 4857 |
|
int len = 1; |
| 4858 |
|
if (eptr >= md->end_subject) |
| 4859 |
|
{ |
| 4860 |
|
SCHECK_PARTIAL(); |
| 4861 |
|
break; |
| 4862 |
|
} |
| 4863 |
|
GETCHARLENTEST(c, eptr, len); |
| 4864 |
|
prop_category = UCD_CATEGORY(c); |
| 4865 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 4866 |
|
c == CHAR_FF || c == CHAR_CR) |
| 4867 |
|
== prop_fail_result) |
| 4868 |
|
break; |
| 4869 |
|
eptr+= len; |
| 4870 |
|
} |
| 4871 |
|
break; |
| 4872 |
|
|
| 4873 |
|
case PT_PXSPACE: /* POSIX space */ |
| 4874 |
|
for (i = min; i < max; i++) |
| 4875 |
|
{ |
| 4876 |
|
int len = 1; |
| 4877 |
|
if (eptr >= md->end_subject) |
| 4878 |
|
{ |
| 4879 |
|
SCHECK_PARTIAL(); |
| 4880 |
|
break; |
| 4881 |
|
} |
| 4882 |
|
GETCHARLENTEST(c, eptr, len); |
| 4883 |
|
prop_category = UCD_CATEGORY(c); |
| 4884 |
|
if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL || |
| 4885 |
|
c == CHAR_VT || c == CHAR_FF || c == CHAR_CR) |
| 4886 |
|
== prop_fail_result) |
| 4887 |
|
break; |
| 4888 |
|
eptr+= len; |
| 4889 |
|
} |
| 4890 |
|
break; |
| 4891 |
|
|
| 4892 |
|
case PT_WORD: |
| 4893 |
|
for (i = min; i < max; i++) |
| 4894 |
|
{ |
| 4895 |
|
int len = 1; |
| 4896 |
|
if (eptr >= md->end_subject) |
| 4897 |
|
{ |
| 4898 |
|
SCHECK_PARTIAL(); |
| 4899 |
|
break; |
| 4900 |
|
} |
| 4901 |
|
GETCHARLENTEST(c, eptr, len); |
| 4902 |
|
prop_category = UCD_CATEGORY(c); |
| 4903 |
|
if ((prop_category == ucp_L || prop_category == ucp_N || |
| 4904 |
|
c == CHAR_UNDERSCORE) == prop_fail_result) |
| 4905 |
|
break; |
| 4906 |
|
eptr+= len; |
| 4907 |
|
} |
| 4908 |
|
break; |
| 4909 |
|
|
| 4910 |
|
default: |
| 4911 |
|
RRETURN(PCRE_ERROR_INTERNAL); |
| 4912 |
} |
} |
| 4913 |
|
|
| 4914 |
/* eptr is now past the end of the maximum run */ |
/* eptr is now past the end of the maximum run */ |
| 5461 |
|
|
| 5462 |
/* 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 */ |
| 5463 |
|
|
| 5464 |
RRETURN(MATCH_NOMATCH); |
MRRETURN(MATCH_NOMATCH); |
| 5465 |
} |
} |
| 5466 |
/* Control never gets here */ |
/* Control never gets here */ |
| 5467 |
|
|
| 5494 |
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) |
| 5495 |
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) |
| 5496 |
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) |
| 5497 |
LBL(53) LBL(54) |
LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) |
| 5498 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 5499 |
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) |
| 5500 |
LBL(32) LBL(34) LBL(42) LBL(46) |
LBL(32) LBL(34) LBL(42) LBL(46) |
| 5501 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 5502 |
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) |
| 5503 |
|
LBL(59) LBL(60) LBL(61) LBL(62) |
| 5504 |
#endif /* SUPPORT_UCP */ |
#endif /* SUPPORT_UCP */ |
| 5505 |
#endif /* SUPPORT_UTF8 */ |
#endif /* SUPPORT_UTF8 */ |
| 5506 |
default: |
default: |
| 5634 |
if (re == NULL || subject == NULL || |
if (re == NULL || subject == NULL || |
| 5635 |
(offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL; |
(offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL; |
| 5636 |
if (offsetcount < 0) return PCRE_ERROR_BADCOUNT; |
if (offsetcount < 0) return PCRE_ERROR_BADCOUNT; |
| 5637 |
|
if (start_offset < 0 || start_offset > length) return PCRE_ERROR_BADOFFSET; |
| 5638 |
|
|
| 5639 |
/* This information is for finding all the numbers associated with a given |
/* This information is for finding all the numbers associated with a given |
| 5640 |
name, for condition testing. */ |
name, for condition testing. */ |
| 5705 |
|
|
| 5706 |
md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0; |
md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0; |
| 5707 |
utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0; |
utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0; |
| 5708 |
|
md->use_ucp = (re->options & PCRE_UCP) != 0; |
| 5709 |
md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0; |
md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0; |
| 5710 |
|
|
| 5711 |
md->notbol = (options & PCRE_NOTBOL) != 0; |
md->notbol = (options & PCRE_NOTBOL) != 0; |
| 5715 |
md->partial = ((options & PCRE_PARTIAL_HARD) != 0)? 2 : |
md->partial = ((options & PCRE_PARTIAL_HARD) != 0)? 2 : |
| 5716 |
((options & PCRE_PARTIAL_SOFT) != 0)? 1 : 0; |
((options & PCRE_PARTIAL_SOFT) != 0)? 1 : 0; |
| 5717 |
md->hitend = FALSE; |
md->hitend = FALSE; |
| 5718 |
|
md->mark = NULL; /* In case never set */ |
| 5719 |
|
|
| 5720 |
md->recursive = NULL; /* No recursion at top level */ |
md->recursive = NULL; /* No recursion at top level */ |
| 5721 |
|
|
| 5801 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 5802 |
if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) |
if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) |
| 5803 |
{ |
{ |
| 5804 |
if (_pcre_valid_utf8((USPTR)subject, length) >= 0) |
int tb; |
| 5805 |
return PCRE_ERROR_BADUTF8; |
if ((tb = _pcre_valid_utf8((USPTR)subject, length)) >= 0) |
| 5806 |
|
return (tb == length && md->partial > 1)? |
| 5807 |
|
PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8; |
| 5808 |
if (start_offset > 0 && start_offset < length) |
if (start_offset > 0 && start_offset < length) |
| 5809 |
{ |
{ |
| 5810 |
int tb = ((USPTR)subject)[start_offset]; |
tb = ((USPTR)subject)[start_offset] & 0xc0; |
| 5811 |
if (tb > 127) |
if (tb == 0x80) return PCRE_ERROR_BADUTF8_OFFSET; |
|
{ |
|
|
tb &= 0xc0; |
|
|
if (tb != 0 && tb != 0xc0) return PCRE_ERROR_BADUTF8_OFFSET; |
|
|
} |
|
| 5812 |
} |
} |
| 5813 |
} |
} |
| 5814 |
#endif |
#endif |
| 5936 |
/* There are some optimizations that avoid running the match if a known |
/* There are some optimizations that avoid running the match if a known |
| 5937 |
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. |
| 5938 |
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 |
| 5939 |
that all callouts do actually occur. */ |
that all callouts do actually occur. The option can be set in the regex by |
| 5940 |
|
(*NO_START_OPT) or passed in match-time options. */ |
| 5941 |
|
|
| 5942 |
if ((options & PCRE_NO_START_OPTIMIZE) == 0) |
if (((options | re->options) & PCRE_NO_START_OPTIMIZE) == 0) |
| 5943 |
{ |
{ |
| 5944 |
/* Advance to a unique first byte if there is one. */ |
/* Advance to a unique first byte if there is one. */ |
| 5945 |
|
|
| 5993 |
while (start_match < end_subject) |
while (start_match < end_subject) |
| 5994 |
{ |
{ |
| 5995 |
register unsigned int c = *start_match; |
register unsigned int c = *start_match; |
| 5996 |
if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; |
if ((start_bits[c/8] & (1 << (c&7))) == 0) |
| 5997 |
else break; |
{ |
| 5998 |
|
start_match++; |
| 5999 |
|
#ifdef SUPPORT_UTF8 |
| 6000 |
|
if (utf8) |
| 6001 |
|
while(start_match < end_subject && (*start_match & 0xc0) == 0x80) |
| 6002 |
|
start_match++; |
| 6003 |
|
#endif |
| 6004 |
|
} |
| 6005 |
|
else break; |
| 6006 |
} |
} |
| 6007 |
} |
} |
| 6008 |
} /* Starting optimizations */ |
} /* Starting optimizations */ |
| 6022 |
bytes to avoid spending too much time in this optimization. */ |
bytes to avoid spending too much time in this optimization. */ |
| 6023 |
|
|
| 6024 |
if (study != NULL && (study->flags & PCRE_STUDY_MINLEN) != 0 && |
if (study != NULL && (study->flags & PCRE_STUDY_MINLEN) != 0 && |
| 6025 |
end_subject - start_match < study->minlength) |
(pcre_uint32)(end_subject - start_match) < study->minlength) |
| 6026 |
{ |
{ |
| 6027 |
rc = MATCH_NOMATCH; |
rc = MATCH_NOMATCH; |
| 6028 |
break; |
break; |
| 6085 |
} |
} |
| 6086 |
} |
} |
| 6087 |
|
|
| 6088 |
#ifdef DEBUG /* Sigh. Some compilers never learn. */ |
#ifdef PCRE_DEBUG /* Sigh. Some compilers never learn. */ |
| 6089 |
printf(">>>> Match against: "); |
printf(">>>> Match against: "); |
| 6090 |
pchars(start_match, end_subject - start_match, TRUE, md); |
pchars(start_match, end_subject - start_match, TRUE, md); |
| 6091 |
printf("\n"); |
printf("\n"); |
| 6097 |
md->start_match_ptr = start_match; |
md->start_match_ptr = start_match; |
| 6098 |
md->start_used_ptr = start_match; |
md->start_used_ptr = start_match; |
| 6099 |
md->match_call_count = 0; |
md->match_call_count = 0; |
| 6100 |
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, |
| 6101 |
|
0, 0); |
| 6102 |
if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr; |
if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr; |
| 6103 |
|
|
| 6104 |
switch(rc) |
switch(rc) |
| 6105 |
{ |
{ |
| 6106 |
|
/* SKIP passes back the next starting point explicitly, but if it is the |
| 6107 |
|
same as the match we have just done, treat it as NOMATCH. */ |
| 6108 |
|
|
| 6109 |
|
case MATCH_SKIP: |
| 6110 |
|
if (md->start_match_ptr != start_match) |
| 6111 |
|
{ |
| 6112 |
|
new_start_match = md->start_match_ptr; |
| 6113 |
|
break; |
| 6114 |
|
} |
| 6115 |
|
/* Fall through */ |
| 6116 |
|
|
| 6117 |
|
/* If MATCH_SKIP_ARG reaches this level it means that a MARK that matched |
| 6118 |
|
the SKIP's arg was not found. We also treat this as NOMATCH. */ |
| 6119 |
|
|
| 6120 |
|
case MATCH_SKIP_ARG: |
| 6121 |
|
/* Fall through */ |
| 6122 |
|
|
| 6123 |
/* NOMATCH and PRUNE advance by one character. THEN at this level acts |
/* NOMATCH and PRUNE advance by one character. THEN at this level acts |
| 6124 |
exactly like PRUNE. */ |
exactly like PRUNE. */ |
| 6125 |
|
|
| 6134 |
#endif |
#endif |
| 6135 |
break; |
break; |
| 6136 |
|
|
|
/* SKIP passes back the next starting point explicitly. */ |
|
|
|
|
|
case MATCH_SKIP: |
|
|
new_start_match = md->start_match_ptr; |
|
|
break; |
|
|
|
|
| 6137 |
/* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */ |
/* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */ |
| 6138 |
|
|
| 6139 |
case MATCH_COMMIT: |
case MATCH_COMMIT: |
| 6179 |
md->nllen == 2)) |
md->nllen == 2)) |
| 6180 |
start_match++; |
start_match++; |
| 6181 |
|
|
| 6182 |
} /* End of for(;;) "bumpalong" loop */ |
md->mark = NULL; /* Reset for start of next match attempt */ |
| 6183 |
|
} /* End of for(;;) "bumpalong" loop */ |
| 6184 |
|
|
| 6185 |
/* ==========================================================================*/ |
/* ==========================================================================*/ |
| 6186 |
|
|
| 6204 |
|
|
| 6205 |
ENDLOOP: |
ENDLOOP: |
| 6206 |
|
|
| 6207 |
if (rc == MATCH_MATCH) |
if (rc == MATCH_MATCH || rc == MATCH_ACCEPT) |
| 6208 |
{ |
{ |
| 6209 |
if (using_temporary_offsets) |
if (using_temporary_offsets) |
| 6210 |
{ |
{ |
| 6230 |
|
|
| 6231 |
if (offsetcount < 2) rc = 0; else |
if (offsetcount < 2) rc = 0; else |
| 6232 |
{ |
{ |
| 6233 |
offsets[0] = md->start_match_ptr - md->start_subject; |
offsets[0] = (int)(md->start_match_ptr - md->start_subject); |
| 6234 |
offsets[1] = md->end_match_ptr - md->start_subject; |
offsets[1] = (int)(md->end_match_ptr - md->start_subject); |
| 6235 |
} |
} |
| 6236 |
|
|
| 6237 |
DPRINTF((">>>> returning %d\n", rc)); |
DPRINTF((">>>> returning %d\n", rc)); |
| 6238 |
return rc; |
goto RETURN_MARK; |
| 6239 |
} |
} |
| 6240 |
|
|
| 6241 |
/* 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 |
| 6247 |
(pcre_free)(md->offset_vector); |
(pcre_free)(md->offset_vector); |
| 6248 |
} |
} |
| 6249 |
|
|
| 6250 |
|
/* For anything other than nomatch or partial match, just return the code. */ |
| 6251 |
|
|
| 6252 |
if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL) |
if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL) |
| 6253 |
{ |
{ |
| 6254 |
DPRINTF((">>>> error: returning %d\n", rc)); |
DPRINTF((">>>> error: returning %d\n", rc)); |
| 6255 |
return rc; |
return rc; |
| 6256 |
} |
} |
| 6257 |
else if (start_partial != NULL) |
|
| 6258 |
|
/* Handle partial matches - disable any mark data */ |
| 6259 |
|
|
| 6260 |
|
if (start_partial != NULL) |
| 6261 |
{ |
{ |
| 6262 |
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n")); |
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n")); |
| 6263 |
|
md->mark = NULL; |
| 6264 |
if (offsetcount > 1) |
if (offsetcount > 1) |
| 6265 |
{ |
{ |
| 6266 |
offsets[0] = start_partial - (USPTR)subject; |
offsets[0] = (int)(start_partial - (USPTR)subject); |
| 6267 |
offsets[1] = end_subject - (USPTR)subject; |
offsets[1] = (int)(end_subject - (USPTR)subject); |
| 6268 |
} |
} |
| 6269 |
return PCRE_ERROR_PARTIAL; |
rc = PCRE_ERROR_PARTIAL; |
| 6270 |
} |
} |
| 6271 |
|
|
| 6272 |
|
/* This is the classic nomatch case */ |
| 6273 |
|
|
| 6274 |
else |
else |
| 6275 |
{ |
{ |
| 6276 |
DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n")); |
DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n")); |
| 6277 |
return PCRE_ERROR_NOMATCH; |
rc = PCRE_ERROR_NOMATCH; |
| 6278 |
} |
} |
| 6279 |
|
|
| 6280 |
|
/* Return the MARK data if it has been requested. */ |
| 6281 |
|
|
| 6282 |
|
RETURN_MARK: |
| 6283 |
|
|
| 6284 |
|
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0) |
| 6285 |
|
*(extra_data->mark) = (unsigned char *)(md->mark); |
| 6286 |
|
return rc; |
| 6287 |
} |
} |
| 6288 |
|
|
| 6289 |
/* End of pcre_exec.c */ |
/* End of pcre_exec.c */ |