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 }; |
259 |
|
|
260 |
/* 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 |
261 |
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 |
685 |
case OP_MARK: |
case OP_MARK: |
686 |
markptr = ecode + 2; |
markptr = ecode + 2; |
687 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
688 |
ims, eptrb, flags, RM51); |
ims, eptrb, flags, RM55); |
689 |
|
|
690 |
/* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an |
/* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an |
691 |
argument, and we must check whether that argument matches this MARK's |
argument, and we must check whether that argument matches this MARK's |
692 |
argument. It is passed back in md->start_match_ptr (an overloading of that |
argument. It is passed back in md->start_match_ptr (an overloading of that |
693 |
variable). If it does match, we reset that variable to the current subject |
variable). If it does match, we reset that variable to the current subject |
694 |
position and return MATCH_SKIP. Otherwise, pass back the return code |
position and return MATCH_SKIP. Otherwise, pass back the return code |
695 |
unaltered. */ |
unaltered. */ |
696 |
|
|
697 |
if (rrc == MATCH_SKIP_ARG && |
if (rrc == MATCH_SKIP_ARG && |
698 |
strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0) |
strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0) |
699 |
{ |
{ |
700 |
md->start_match_ptr = eptr; |
md->start_match_ptr = eptr; |
701 |
RRETURN(MATCH_SKIP); |
RRETURN(MATCH_SKIP); |
702 |
} |
} |
703 |
|
|
704 |
if (md->mark == NULL) md->mark = markptr; |
if (md->mark == NULL) md->mark = markptr; |
705 |
RRETURN(rrc); |
RRETURN(rrc); |
706 |
|
|
707 |
case OP_FAIL: |
case OP_FAIL: |
721 |
|
|
722 |
case OP_PRUNE_ARG: |
case OP_PRUNE_ARG: |
723 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
724 |
ims, eptrb, flags, RM51); |
ims, eptrb, flags, RM56); |
725 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
726 |
md->mark = ecode + 2; |
md->mark = ecode + 2; |
727 |
RRETURN(MATCH_PRUNE); |
RRETURN(MATCH_PRUNE); |
735 |
|
|
736 |
case OP_SKIP_ARG: |
case OP_SKIP_ARG: |
737 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
738 |
ims, eptrb, flags, RM53); |
ims, eptrb, flags, RM57); |
739 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
740 |
|
|
741 |
/* Pass back the current skip name by overloading md->start_match_ptr and |
/* Pass back the current skip name by overloading md->start_match_ptr and |
742 |
returning the special MATCH_SKIP_ARG return code. This will either be |
returning the special MATCH_SKIP_ARG return code. This will either be |
743 |
caught by a matching MARK, or get to the top, where it is treated the same |
caught by a matching MARK, or get to the top, where it is treated the same |
744 |
as PRUNE. */ |
as PRUNE. */ |
745 |
|
|
746 |
md->start_match_ptr = ecode + 2; |
md->start_match_ptr = ecode + 2; |
747 |
RRETURN(MATCH_SKIP_ARG); |
RRETURN(MATCH_SKIP_ARG); |
748 |
|
|
749 |
case OP_THEN: |
case OP_THEN: |
750 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
751 |
ims, eptrb, flags, RM54); |
ims, eptrb, flags, RM54); |
754 |
|
|
755 |
case OP_THEN_ARG: |
case OP_THEN_ARG: |
756 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md, |
757 |
ims, eptrb, flags, RM54); |
ims, eptrb, flags, RM58); |
758 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
759 |
md->mark = ecode + 2; |
md->mark = ecode + 2; |
760 |
RRETURN(MATCH_THEN); |
RRETURN(MATCH_THEN); |
852 |
|
|
853 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims, |
854 |
eptrb, flags, RM48); |
eptrb, flags, RM48); |
855 |
if (rrc == MATCH_NOMATCH) md->mark = markptr; |
if (rrc == MATCH_NOMATCH) md->mark = markptr; |
856 |
RRETURN(rrc); |
RRETURN(rrc); |
857 |
} |
} |
858 |
|
|
859 |
/* For non-final alternatives, continue the loop for a NOMATCH result; |
/* For non-final alternatives, continue the loop for a NOMATCH result; |
1158 |
md->end_match_ptr = eptr; /* Record where we ended */ |
md->end_match_ptr = eptr; /* Record where we ended */ |
1159 |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
md->end_offset_top = offset_top; /* and how many extracts were taken */ |
1160 |
md->start_match_ptr = mstart; /* and the start (\K can modify) */ |
md->start_match_ptr = mstart; /* and the start (\K can modify) */ |
1161 |
MRRETURN(((op == OP_END)? MATCH_MATCH : MATCH_ACCEPT)); |
|
1162 |
|
/* For some reason, the macros don't work properly if an expression is |
1163 |
|
given as the argument to MRRETURN when the heap is in use. */ |
1164 |
|
|
1165 |
|
rrc = (op == OP_END)? MATCH_MATCH : MATCH_ACCEPT; |
1166 |
|
MRRETURN(rrc); |
1167 |
|
|
1168 |
/* Change option settings */ |
/* Change option settings */ |
1169 |
|
|
5138 |
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) |
5139 |
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) |
5140 |
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) |
5141 |
LBL(53) LBL(54) |
LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) |
5142 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
5143 |
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) |
5144 |
LBL(32) LBL(34) LBL(42) LBL(46) |
LBL(32) LBL(34) LBL(42) LBL(46) |
5727 |
|
|
5728 |
/* OK, we can now run the match. If "hitend" is set afterwards, remember the |
/* OK, we can now run the match. If "hitend" is set afterwards, remember the |
5729 |
first starting point for which a partial match was found. */ |
first starting point for which a partial match was found. */ |
5730 |
|
|
5731 |
md->start_match_ptr = start_match; |
md->start_match_ptr = start_match; |
5732 |
md->start_used_ptr = start_match; |
md->start_used_ptr = start_match; |
5733 |
md->match_call_count = 0; |
md->match_call_count = 0; |
5737 |
|
|
5738 |
switch(rc) |
switch(rc) |
5739 |
{ |
{ |
5740 |
/* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches |
/* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches |
5741 |
this level it means that a MARK that matched the SKIP's arg was not found. |
this level it means that a MARK that matched the SKIP's arg was not found. |
5742 |
We treat this as NOMATCH. THEN at this level acts exactly like PRUNE. */ |
We treat this as NOMATCH. THEN at this level acts exactly like PRUNE. */ |
5743 |
|
|
5744 |
case MATCH_NOMATCH: |
case MATCH_NOMATCH: |
5745 |
case MATCH_PRUNE: |
case MATCH_PRUNE: |
5746 |
case MATCH_SKIP_ARG: |
case MATCH_SKIP_ARG: |
5747 |
case MATCH_THEN: |
case MATCH_THEN: |
5748 |
new_start_match = start_match + 1; |
new_start_match = start_match + 1; |
5749 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
5871 |
DPRINTF(("Freeing temporary memory\n")); |
DPRINTF(("Freeing temporary memory\n")); |
5872 |
(pcre_free)(md->offset_vector); |
(pcre_free)(md->offset_vector); |
5873 |
} |
} |
5874 |
|
|
5875 |
/* For anything other than nomatch or partial match, just return the code. */ |
/* For anything other than nomatch or partial match, just return the code. */ |
5876 |
|
|
5877 |
if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL) |
if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL) |
5878 |
{ |
{ |
5879 |
DPRINTF((">>>> error: returning %d\n", rc)); |
DPRINTF((">>>> error: returning %d\n", rc)); |
5880 |
return rc; |
return rc; |
5881 |
} |
} |
5882 |
|
|
5883 |
/* Handle partial matches - disable any mark data */ |
/* Handle partial matches - disable any mark data */ |
5884 |
|
|
5885 |
if (start_partial != NULL) |
if (start_partial != NULL) |
5886 |
{ |
{ |
5887 |
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n")); |
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n")); |
5888 |
md->mark = NULL; |
md->mark = NULL; |
5889 |
if (offsetcount > 1) |
if (offsetcount > 1) |
5890 |
{ |
{ |
5891 |
offsets[0] = start_partial - (USPTR)subject; |
offsets[0] = start_partial - (USPTR)subject; |
5893 |
} |
} |
5894 |
rc = PCRE_ERROR_PARTIAL; |
rc = PCRE_ERROR_PARTIAL; |
5895 |
} |
} |
5896 |
|
|
5897 |
/* This is the classic nomatch case */ |
/* This is the classic nomatch case */ |
5898 |
|
|
5899 |
else |
else |
5900 |
{ |
{ |
5901 |
DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n")); |
DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n")); |
5902 |
rc = PCRE_ERROR_NOMATCH; |
rc = PCRE_ERROR_NOMATCH; |
5903 |
} |
} |
5904 |
|
|
5905 |
/* Return the MARK data if it has been requested. */ |
/* Return the MARK data if it has been requested. */ |
5906 |
|
|
5907 |
RETURN_MARK: |
RETURN_MARK: |
5908 |
|
|
5909 |
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0) |
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0) |
5910 |
*(extra_data->mark) = (unsigned char *)(md->mark); |
*(extra_data->mark) = (unsigned char *)(md->mark); |
5911 |
return rc; |
return rc; |
5912 |
} |
} |
5913 |
|
|
5914 |
/* End of pcre_exec.c */ |
/* End of pcre_exec.c */ |