379 |
/* Definition to allow mutual recursion */ |
/* Definition to allow mutual recursion */ |
380 |
|
|
381 |
static BOOL |
static BOOL |
382 |
compile_regex(int, int, uschar **, const uschar **, int *, BOOL, BOOL, int, |
compile_regex(int, int, uschar **, const uschar **, int *, BOOL, BOOL, int, |
383 |
int *, int *, branch_chain *, compile_data *, int *); |
int *, int *, branch_chain *, compile_data *, int *); |
384 |
|
|
385 |
|
|
1949 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
1950 |
return next <= 127 && (cd->ctypes[next] & ctype_word) != 0; |
return next <= 127 && (cd->ctypes[next] & ctype_word) != 0; |
1951 |
|
|
1952 |
|
case OP_HSPACE: |
1953 |
|
case OP_NOT_HSPACE: |
1954 |
|
switch(next) |
1955 |
|
{ |
1956 |
|
case 0x09: |
1957 |
|
case 0x20: |
1958 |
|
case 0xa0: |
1959 |
|
case 0x1680: |
1960 |
|
case 0x180e: |
1961 |
|
case 0x2000: |
1962 |
|
case 0x2001: |
1963 |
|
case 0x2002: |
1964 |
|
case 0x2003: |
1965 |
|
case 0x2004: |
1966 |
|
case 0x2005: |
1967 |
|
case 0x2006: |
1968 |
|
case 0x2007: |
1969 |
|
case 0x2008: |
1970 |
|
case 0x2009: |
1971 |
|
case 0x200A: |
1972 |
|
case 0x202f: |
1973 |
|
case 0x205f: |
1974 |
|
case 0x3000: |
1975 |
|
return op_code != OP_HSPACE; |
1976 |
|
default: |
1977 |
|
return op_code == OP_HSPACE; |
1978 |
|
} |
1979 |
|
|
1980 |
|
case OP_VSPACE: |
1981 |
|
case OP_NOT_VSPACE: |
1982 |
|
switch(next) |
1983 |
|
{ |
1984 |
|
case 0x0a: |
1985 |
|
case 0x0b: |
1986 |
|
case 0x0c: |
1987 |
|
case 0x0d: |
1988 |
|
case 0x85: |
1989 |
|
case 0x2028: |
1990 |
|
case 0x2029: |
1991 |
|
return op_code != OP_VSPACE; |
1992 |
|
default: |
1993 |
|
return op_code == OP_VSPACE; |
1994 |
|
} |
1995 |
|
|
1996 |
default: |
default: |
1997 |
return FALSE; |
return FALSE; |
1998 |
} |
} |
2026 |
|
|
2027 |
case ESC_W: |
case ESC_W: |
2028 |
return item <= 127 && (cd->ctypes[item] & ctype_word) != 0; |
return item <= 127 && (cd->ctypes[item] & ctype_word) != 0; |
2029 |
|
|
2030 |
|
case ESC_h: |
2031 |
|
case ESC_H: |
2032 |
|
switch(item) |
2033 |
|
{ |
2034 |
|
case 0x09: |
2035 |
|
case 0x20: |
2036 |
|
case 0xa0: |
2037 |
|
case 0x1680: |
2038 |
|
case 0x180e: |
2039 |
|
case 0x2000: |
2040 |
|
case 0x2001: |
2041 |
|
case 0x2002: |
2042 |
|
case 0x2003: |
2043 |
|
case 0x2004: |
2044 |
|
case 0x2005: |
2045 |
|
case 0x2006: |
2046 |
|
case 0x2007: |
2047 |
|
case 0x2008: |
2048 |
|
case 0x2009: |
2049 |
|
case 0x200A: |
2050 |
|
case 0x202f: |
2051 |
|
case 0x205f: |
2052 |
|
case 0x3000: |
2053 |
|
return -next != ESC_h; |
2054 |
|
default: |
2055 |
|
return -next == ESC_h; |
2056 |
|
} |
2057 |
|
|
2058 |
|
case ESC_v: |
2059 |
|
case ESC_V: |
2060 |
|
switch(item) |
2061 |
|
{ |
2062 |
|
case 0x0a: |
2063 |
|
case 0x0b: |
2064 |
|
case 0x0c: |
2065 |
|
case 0x0d: |
2066 |
|
case 0x85: |
2067 |
|
case 0x2028: |
2068 |
|
case 0x2029: |
2069 |
|
return -next != ESC_v; |
2070 |
|
default: |
2071 |
|
return -next == ESC_v; |
2072 |
|
} |
2073 |
|
|
2074 |
default: |
default: |
2075 |
return FALSE; |
return FALSE; |
2076 |
} |
} |
2077 |
|
|
2078 |
case OP_DIGIT: |
case OP_DIGIT: |
2079 |
return next == -ESC_D || next == -ESC_s || next == -ESC_W; |
return next == -ESC_D || next == -ESC_s || next == -ESC_W || |
2080 |
|
next == -ESC_h || next == -ESC_v; |
2081 |
|
|
2082 |
case OP_NOT_DIGIT: |
case OP_NOT_DIGIT: |
2083 |
return next == -ESC_d; |
return next == -ESC_d; |
2086 |
return next == -ESC_S || next == -ESC_d || next == -ESC_w; |
return next == -ESC_S || next == -ESC_d || next == -ESC_w; |
2087 |
|
|
2088 |
case OP_NOT_WHITESPACE: |
case OP_NOT_WHITESPACE: |
2089 |
return next == -ESC_s; |
return next == -ESC_s || next == -ESC_h || next == -ESC_v; |
2090 |
|
|
2091 |
|
case OP_HSPACE: |
2092 |
|
return next == -ESC_S || next == -ESC_H || next == -ESC_d || next == -ESC_w; |
2093 |
|
|
2094 |
|
case OP_NOT_HSPACE: |
2095 |
|
return next == -ESC_h; |
2096 |
|
|
2097 |
|
/* Can't have \S in here because VT matches \S (Perl anomaly) */ |
2098 |
|
case OP_VSPACE: |
2099 |
|
return next == -ESC_V || next == -ESC_d || next == -ESC_w; |
2100 |
|
|
2101 |
|
case OP_NOT_VSPACE: |
2102 |
|
return next == -ESC_v; |
2103 |
|
|
2104 |
case OP_WORDCHAR: |
case OP_WORDCHAR: |
2105 |
return next == -ESC_W || next == -ESC_s; |
return next == -ESC_W || next == -ESC_s || next == -ESC_h || next == -ESC_v; |
2106 |
|
|
2107 |
case OP_NOT_WORDCHAR: |
case OP_NOT_WORDCHAR: |
2108 |
return next == -ESC_w || next == -ESC_d; |
return next == -ESC_w || next == -ESC_d; |
2109 |
|
|
2110 |
default: |
default: |
2111 |
return FALSE; |
return FALSE; |
2112 |
} |
} |
2217 |
BOOL possessive_quantifier; |
BOOL possessive_quantifier; |
2218 |
BOOL is_quantifier; |
BOOL is_quantifier; |
2219 |
BOOL is_recurse; |
BOOL is_recurse; |
2220 |
BOOL reset_bracount; |
BOOL reset_bracount; |
2221 |
int class_charcount; |
int class_charcount; |
2222 |
int class_lastchar; |
int class_lastchar; |
2223 |
int newoptions; |
int newoptions; |
2637 |
|
|
2638 |
case ESC_E: /* Perl ignores an orphan \E */ |
case ESC_E: /* Perl ignores an orphan \E */ |
2639 |
continue; |
continue; |
2640 |
|
|
2641 |
default: /* Not recognized; fall through */ |
default: /* Not recognized; fall through */ |
2642 |
break; /* Need "default" setting to stop compiler warning. */ |
break; /* Need "default" setting to stop compiler warning. */ |
2643 |
} |
} |
2646 |
|
|
2647 |
else if (c == -ESC_d || c == -ESC_D || c == -ESC_w || |
else if (c == -ESC_d || c == -ESC_D || c == -ESC_w || |
2648 |
c == -ESC_W || c == -ESC_s || c == -ESC_S) continue; |
c == -ESC_W || c == -ESC_s || c == -ESC_S) continue; |
2649 |
|
|
2650 |
/* We need to deal with \H, \h, \V, and \v in both phases because |
/* We need to deal with \H, \h, \V, and \v in both phases because |
2651 |
they use extra memory. */ |
they use extra memory. */ |
2652 |
|
|
2653 |
if (-c == ESC_h) |
if (-c == ESC_h) |
2654 |
{ |
{ |
2655 |
SETBIT(classbits, 0x09); /* VT */ |
SETBIT(classbits, 0x09); /* VT */ |
2656 |
SETBIT(classbits, 0x20); /* SPACE */ |
SETBIT(classbits, 0x20); /* SPACE */ |
2657 |
SETBIT(classbits, 0xa0); /* NSBP */ |
SETBIT(classbits, 0xa0); /* NSBP */ |
2658 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
2659 |
if (utf8) |
if (utf8) |
2660 |
{ |
{ |
2661 |
class_utf8 = TRUE; |
class_utf8 = TRUE; |
2662 |
*class_utf8data++ = XCL_SINGLE; |
*class_utf8data++ = XCL_SINGLE; |
2663 |
class_utf8data += _pcre_ord2utf8(0x1680, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x1680, class_utf8data); |
2664 |
*class_utf8data++ = XCL_SINGLE; |
*class_utf8data++ = XCL_SINGLE; |
2665 |
class_utf8data += _pcre_ord2utf8(0x180e, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x180e, class_utf8data); |
2666 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2667 |
class_utf8data += _pcre_ord2utf8(0x2000, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x2000, class_utf8data); |
2668 |
class_utf8data += _pcre_ord2utf8(0x200A, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x200A, class_utf8data); |
2669 |
*class_utf8data++ = XCL_SINGLE; |
*class_utf8data++ = XCL_SINGLE; |
2670 |
class_utf8data += _pcre_ord2utf8(0x202f, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x202f, class_utf8data); |
2671 |
*class_utf8data++ = XCL_SINGLE; |
*class_utf8data++ = XCL_SINGLE; |
2672 |
class_utf8data += _pcre_ord2utf8(0x205f, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x205f, class_utf8data); |
2673 |
*class_utf8data++ = XCL_SINGLE; |
*class_utf8data++ = XCL_SINGLE; |
2674 |
class_utf8data += _pcre_ord2utf8(0x3000, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x3000, class_utf8data); |
2675 |
} |
} |
2676 |
#endif |
#endif |
2677 |
continue; |
continue; |
2678 |
} |
} |
2679 |
|
|
2680 |
if (-c == ESC_H) |
if (-c == ESC_H) |
2681 |
{ |
{ |
2683 |
{ |
{ |
2684 |
int x = 0xff; |
int x = 0xff; |
2685 |
switch (c) |
switch (c) |
2686 |
{ |
{ |
2687 |
case 0x09/8: x ^= 1 << (0x09%8); break; |
case 0x09/8: x ^= 1 << (0x09%8); break; |
2688 |
case 0x20/8: x ^= 1 << (0x20%8); break; |
case 0x20/8: x ^= 1 << (0x20%8); break; |
2689 |
case 0xa0/8: x ^= 1 << (0xa0%8); break; |
case 0xa0/8: x ^= 1 << (0xa0%8); break; |
2690 |
default: break; |
default: break; |
2691 |
} |
} |
2692 |
classbits[c] |= x; |
classbits[c] |= x; |
2693 |
} |
} |
2694 |
|
|
2695 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
2696 |
if (utf8) |
if (utf8) |
2697 |
{ |
{ |
2698 |
class_utf8 = TRUE; |
class_utf8 = TRUE; |
2699 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2700 |
class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data); |
2701 |
class_utf8data += _pcre_ord2utf8(0x167f, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x167f, class_utf8data); |
2702 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2703 |
class_utf8data += _pcre_ord2utf8(0x1681, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x1681, class_utf8data); |
2704 |
class_utf8data += _pcre_ord2utf8(0x180d, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x180d, class_utf8data); |
2705 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2706 |
class_utf8data += _pcre_ord2utf8(0x180f, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x180f, class_utf8data); |
2707 |
class_utf8data += _pcre_ord2utf8(0x1fff, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x1fff, class_utf8data); |
2708 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2709 |
class_utf8data += _pcre_ord2utf8(0x200B, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x200B, class_utf8data); |
2710 |
class_utf8data += _pcre_ord2utf8(0x202e, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x202e, class_utf8data); |
2711 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2712 |
class_utf8data += _pcre_ord2utf8(0x2030, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x2030, class_utf8data); |
2713 |
class_utf8data += _pcre_ord2utf8(0x205e, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x205e, class_utf8data); |
2714 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2715 |
class_utf8data += _pcre_ord2utf8(0x2060, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x2060, class_utf8data); |
2716 |
class_utf8data += _pcre_ord2utf8(0x2fff, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x2fff, class_utf8data); |
2717 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2718 |
class_utf8data += _pcre_ord2utf8(0x3001, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x3001, class_utf8data); |
2719 |
class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data); |
2720 |
} |
} |
2721 |
#endif |
#endif |
2722 |
continue; |
continue; |
2723 |
} |
} |
2724 |
|
|
2725 |
if (-c == ESC_v) |
if (-c == ESC_v) |
2726 |
{ |
{ |
2727 |
SETBIT(classbits, 0x0a); /* LF */ |
SETBIT(classbits, 0x0a); /* LF */ |
2728 |
SETBIT(classbits, 0x0b); /* VT */ |
SETBIT(classbits, 0x0b); /* VT */ |
2729 |
SETBIT(classbits, 0x0c); /* FF */ |
SETBIT(classbits, 0x0c); /* FF */ |
2730 |
SETBIT(classbits, 0x0d); /* CR */ |
SETBIT(classbits, 0x0d); /* CR */ |
2731 |
SETBIT(classbits, 0x85); /* NEL */ |
SETBIT(classbits, 0x85); /* NEL */ |
2732 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
2733 |
if (utf8) |
if (utf8) |
2734 |
{ |
{ |
2735 |
class_utf8 = TRUE; |
class_utf8 = TRUE; |
2736 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2737 |
class_utf8data += _pcre_ord2utf8(0x2028, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x2028, class_utf8data); |
2738 |
class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data); |
2739 |
} |
} |
2740 |
#endif |
#endif |
2741 |
continue; |
continue; |
2742 |
} |
} |
2743 |
|
|
2744 |
if (-c == ESC_V) |
if (-c == ESC_V) |
2745 |
{ |
{ |
2747 |
{ |
{ |
2748 |
int x = 0xff; |
int x = 0xff; |
2749 |
switch (c) |
switch (c) |
2750 |
{ |
{ |
2751 |
case 0x0a/8: x ^= 1 << (0x0a%8); |
case 0x0a/8: x ^= 1 << (0x0a%8); |
2752 |
x ^= 1 << (0x0b%8); |
x ^= 1 << (0x0b%8); |
2753 |
x ^= 1 << (0x0c%8); |
x ^= 1 << (0x0c%8); |
2754 |
x ^= 1 << (0x0d%8); |
x ^= 1 << (0x0d%8); |
2755 |
break; |
break; |
2756 |
case 0x85/8: x ^= 1 << (0x85%8); break; |
case 0x85/8: x ^= 1 << (0x85%8); break; |
2757 |
default: break; |
default: break; |
2758 |
} |
} |
2759 |
classbits[c] |= x; |
classbits[c] |= x; |
2760 |
} |
} |
2761 |
|
|
2762 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
2763 |
if (utf8) |
if (utf8) |
2764 |
{ |
{ |
2765 |
class_utf8 = TRUE; |
class_utf8 = TRUE; |
2766 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2767 |
class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data); |
2768 |
class_utf8data += _pcre_ord2utf8(0x2027, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x2027, class_utf8data); |
2769 |
*class_utf8data++ = XCL_RANGE; |
*class_utf8data++ = XCL_RANGE; |
2770 |
class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data); |
2771 |
class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data); |
class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data); |
2772 |
} |
} |
2773 |
#endif |
#endif |
2774 |
continue; |
continue; |
2775 |
} |
} |
2776 |
|
|
2777 |
/* We need to deal with \P and \p in both phases. */ |
/* We need to deal with \P and \p in both phases. */ |
2778 |
|
|
2914 |
unsigned int origd = d; |
unsigned int origd = d; |
2915 |
while (get_othercase_range(&cc, origd, &occ, &ocd)) |
while (get_othercase_range(&cc, origd, &occ, &ocd)) |
2916 |
{ |
{ |
2917 |
if (occ >= (unsigned int)c && |
if (occ >= (unsigned int)c && |
2918 |
ocd <= (unsigned int)d) |
ocd <= (unsigned int)d) |
2919 |
continue; /* Skip embedded ranges */ |
continue; /* Skip embedded ranges */ |
2920 |
|
|
2921 |
if (occ < (unsigned int)c && |
if (occ < (unsigned int)c && |
2922 |
ocd >= (unsigned int)c - 1) /* Extend the basic range */ |
ocd >= (unsigned int)c - 1) /* Extend the basic range */ |
2923 |
{ /* if there is overlap, */ |
{ /* if there is overlap, */ |
2924 |
c = occ; /* noting that if occ < c */ |
c = occ; /* noting that if occ < c */ |
2925 |
continue; /* we can't have ocd > d */ |
continue; /* we can't have ocd > d */ |
2926 |
} /* because a subrange is */ |
} /* because a subrange is */ |
2927 |
if (ocd > (unsigned int)d && |
if (ocd > (unsigned int)d && |
2928 |
occ <= (unsigned int)d + 1) /* always shorter than */ |
occ <= (unsigned int)d + 1) /* always shorter than */ |
2929 |
{ /* the basic range. */ |
{ /* the basic range. */ |
2930 |
d = ocd; |
d = ocd; |
3823 |
skipbytes = 0; |
skipbytes = 0; |
3824 |
bravalue = OP_CBRA; |
bravalue = OP_CBRA; |
3825 |
save_hwm = cd->hwm; |
save_hwm = cd->hwm; |
3826 |
reset_bracount = FALSE; |
reset_bracount = FALSE; |
3827 |
|
|
3828 |
if (*(++ptr) == '?') |
if (*(++ptr) == '?') |
3829 |
{ |
{ |
3848 |
/* ------------------------------------------------------------ */ |
/* ------------------------------------------------------------ */ |
3849 |
case '|': /* Reset capture count for each branch */ |
case '|': /* Reset capture count for each branch */ |
3850 |
reset_bracount = TRUE; |
reset_bracount = TRUE; |
3851 |
/* Fall through */ |
/* Fall through */ |
3852 |
|
|
3853 |
/* ------------------------------------------------------------ */ |
/* ------------------------------------------------------------ */ |
3854 |
case ':': /* Non-capturing bracket */ |
case ':': /* Non-capturing bracket */ |
4549 |
errorcodeptr, /* Where to put an error message */ |
errorcodeptr, /* Where to put an error message */ |
4550 |
(bravalue == OP_ASSERTBACK || |
(bravalue == OP_ASSERTBACK || |
4551 |
bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */ |
bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */ |
4552 |
reset_bracount, /* True if (?| group */ |
reset_bracount, /* True if (?| group */ |
4553 |
skipbytes, /* Skip over bracket number */ |
skipbytes, /* Skip over bracket number */ |
4554 |
&subfirstbyte, /* For possible first char */ |
&subfirstbyte, /* For possible first char */ |
4555 |
&subreqbyte, /* For possible last char */ |
&subreqbyte, /* For possible last char */ |
4909 |
ptrptr -> the address of the current pattern pointer |
ptrptr -> the address of the current pattern pointer |
4910 |
errorcodeptr -> pointer to error code variable |
errorcodeptr -> pointer to error code variable |
4911 |
lookbehind TRUE if this is a lookbehind assertion |
lookbehind TRUE if this is a lookbehind assertion |
4912 |
reset_bracount TRUE to reset the count for each branch |
reset_bracount TRUE to reset the count for each branch |
4913 |
skipbytes skip this many bytes at start (for brackets and OP_COND) |
skipbytes skip this many bytes at start (for brackets and OP_COND) |
4914 |
firstbyteptr place to put the first required character, or a negative number |
firstbyteptr place to put the first required character, or a negative number |
4915 |
reqbyteptr place to put the last required character, or a negative number |
reqbyteptr place to put the last required character, or a negative number |
4923 |
|
|
4924 |
static BOOL |
static BOOL |
4925 |
compile_regex(int options, int oldims, uschar **codeptr, const uschar **ptrptr, |
compile_regex(int options, int oldims, uschar **codeptr, const uschar **ptrptr, |
4926 |
int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes, |
int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes, |
4927 |
int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd, |
int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd, |
4928 |
int *lengthptr) |
int *lengthptr) |
4929 |
{ |
{ |
4930 |
const uschar *ptr = *ptrptr; |
const uschar *ptr = *ptrptr; |
4969 |
for (;;) |
for (;;) |
4970 |
{ |
{ |
4971 |
/* For a (?| group, reset the capturing bracket count so that each branch |
/* For a (?| group, reset the capturing bracket count so that each branch |
4972 |
uses the same numbers. */ |
uses the same numbers. */ |
4973 |
|
|
4974 |
if (reset_bracount) cd->bracount = orig_bracount; |
if (reset_bracount) cd->bracount = orig_bracount; |
4975 |
|
|
4976 |
/* Handle a change of ims options at the start of the branch */ |
/* Handle a change of ims options at the start of the branch */ |
4977 |
|
|
4978 |
if ((options & PCRE_IMS) != oldims) |
if ((options & PCRE_IMS) != oldims) |
5001 |
*ptrptr = ptr; |
*ptrptr = ptr; |
5002 |
return FALSE; |
return FALSE; |
5003 |
} |
} |
5004 |
|
|
5005 |
/* Keep the highest bracket count in case (?| was used and some branch |
/* Keep the highest bracket count in case (?| was used and some branch |
5006 |
has fewer than the rest. */ |
has fewer than the rest. */ |
5007 |
|
|
5008 |
if (cd->bracount > max_bracount) max_bracount = cd->bracount; |
if (cd->bracount > max_bracount) max_bracount = cd->bracount; |
5009 |
|
|
5010 |
/* In the real compile phase, there is some post-processing to be done. */ |
/* In the real compile phase, there is some post-processing to be done. */ |
5108 |
*code++ = oldims; |
*code++ = oldims; |
5109 |
length += 2; |
length += 2; |
5110 |
} |
} |
5111 |
|
|
5112 |
/* Retain the highest bracket number, in case resetting was used. */ |
/* Retain the highest bracket number, in case resetting was used. */ |
5113 |
|
|
5114 |
cd->bracount = max_bracount; |
cd->bracount = max_bracount; |
5115 |
|
|
5116 |
/* Set values to pass back */ |
/* Set values to pass back */ |
5587 |
code = cworkspace; |
code = cworkspace; |
5588 |
*code = OP_BRA; |
*code = OP_BRA; |
5589 |
(void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS, |
(void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS, |
5590 |
&code, &ptr, &errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, |
&code, &ptr, &errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, |
5591 |
&length); |
&length); |
5592 |
if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN; |
if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN; |
5593 |
|
|