/[pcre]/code/trunk/pcre_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_compile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 178 by ph10, Wed Jun 13 08:44:34 2007 UTC revision 200 by ph10, Wed Aug 1 09:10:40 2007 UTC
# Line 42  POSSIBILITY OF SUCH DAMAGE. Line 42  POSSIBILITY OF SUCH DAMAGE.
42  supporting internal functions that are not used by other modules. */  supporting internal functions that are not used by other modules. */
43    
44    
45    #ifdef HAVE_CONFIG_H
46    #include <config.h>
47    #endif
48    
49  #define NLBLOCK cd             /* Block containing newline information */  #define NLBLOCK cd             /* Block containing newline information */
50  #define PSSTART start_pattern  /* Field containing processed string start */  #define PSSTART start_pattern  /* Field containing processed string start */
51  #define PSEND   end_pattern    /* Field containing processed string end */  #define PSEND   end_pattern    /* Field containing processed string end */
52    
   
53  #include "pcre_internal.h"  #include "pcre_internal.h"
54    
55    
# Line 120  static const short int escapes[] = { Line 123  static const short int escapes[] = {
123  /*  B8 */     0,     0,      0,       0,      0,   ']',    '=',    '-',  /*  B8 */     0,     0,      0,       0,      0,   ']',    '=',    '-',
124  /*  C0 */   '{',-ESC_A, -ESC_B,  -ESC_C, -ESC_D,-ESC_E,      0, -ESC_G,  /*  C0 */   '{',-ESC_A, -ESC_B,  -ESC_C, -ESC_D,-ESC_E,      0, -ESC_G,
125  /*  C8 */-ESC_H,     0,      0,       0,      0,     0,      0,      0,  /*  C8 */-ESC_H,     0,      0,       0,      0,     0,      0,      0,
126  /*  D0 */   '}',     0,      0,       0,      0,     0,      0, -ESC_P,  /*  D0 */   '}',     0, -ESC_K,       0,      0,     0,      0, -ESC_P,
127  /*  D8 */-ESC_Q,-ESC_R,      0,       0,      0,     0,      0,      0,  /*  D8 */-ESC_Q,-ESC_R,      0,       0,      0,     0,      0,      0,
128  /*  E0 */  '\\',     0, -ESC_S,       0,      0,-ESC_V, -ESC_W, -ESC_X,  /*  E0 */  '\\',     0, -ESC_S,       0,      0,-ESC_V, -ESC_W, -ESC_X,
129  /*  E8 */     0,-ESC_Z,      0,       0,      0,     0,      0,      0,  /*  E8 */     0,-ESC_Z,      0,       0,      0,     0,      0,      0,
# Line 379  static const unsigned char ebcdic_charta Line 382  static const unsigned char ebcdic_charta
382  /* Definition to allow mutual recursion */  /* Definition to allow mutual recursion */
383    
384  static BOOL  static BOOL
385    compile_regex(int, int, uschar **, const uschar **, int *, BOOL, BOOL, int,    compile_regex(int, int, uschar **, const uschar **, int *, BOOL, BOOL, int,
386      int *, int *, branch_chain *, compile_data *, int *);      int *, int *, branch_chain *, compile_data *, int *);
387    
388    
# Line 701  if (c == '{') Line 704  if (c == '{')
704      *negptr = TRUE;      *negptr = TRUE;
705      ptr++;      ptr++;
706      }      }
707    for (i = 0; i < sizeof(name) - 1; i++)    for (i = 0; i < (int)sizeof(name) - 1; i++)
708      {      {
709      c = *(++ptr);      c = *(++ptr);
710      if (c == 0) goto ERROR_RETURN;      if (c == 0) goto ERROR_RETURN;
# Line 1949  if (next >= 0) switch(op_code) Line 1952  if (next >= 0) switch(op_code)
1952    case OP_NOT_WORDCHAR:    case OP_NOT_WORDCHAR:
1953    return next <= 127 && (cd->ctypes[next] & ctype_word) != 0;    return next <= 127 && (cd->ctypes[next] & ctype_word) != 0;
1954    
1955      case OP_HSPACE:
1956      case OP_NOT_HSPACE:
1957      switch(next)
1958        {
1959        case 0x09:
1960        case 0x20:
1961        case 0xa0:
1962        case 0x1680:
1963        case 0x180e:
1964        case 0x2000:
1965        case 0x2001:
1966        case 0x2002:
1967        case 0x2003:
1968        case 0x2004:
1969        case 0x2005:
1970        case 0x2006:
1971        case 0x2007:
1972        case 0x2008:
1973        case 0x2009:
1974        case 0x200A:
1975        case 0x202f:
1976        case 0x205f:
1977        case 0x3000:
1978        return op_code != OP_HSPACE;
1979        default:
1980        return op_code == OP_HSPACE;
1981        }
1982    
1983      case OP_VSPACE:
1984      case OP_NOT_VSPACE:
1985      switch(next)
1986        {
1987        case 0x0a:
1988        case 0x0b:
1989        case 0x0c:
1990        case 0x0d:
1991        case 0x85:
1992        case 0x2028:
1993        case 0x2029:
1994        return op_code != OP_VSPACE;
1995        default:
1996        return op_code == OP_VSPACE;
1997        }
1998    
1999    default:    default:
2000    return FALSE;    return FALSE;
2001    }    }
# Line 1983  switch(op_code) Line 2030  switch(op_code)
2030      case ESC_W:      case ESC_W:
2031      return item <= 127 && (cd->ctypes[item] & ctype_word) != 0;      return item <= 127 && (cd->ctypes[item] & ctype_word) != 0;
2032    
2033        case ESC_h:
2034        case ESC_H:
2035        switch(item)
2036          {
2037          case 0x09:
2038          case 0x20:
2039          case 0xa0:
2040          case 0x1680:
2041          case 0x180e:
2042          case 0x2000:
2043          case 0x2001:
2044          case 0x2002:
2045          case 0x2003:
2046          case 0x2004:
2047          case 0x2005:
2048          case 0x2006:
2049          case 0x2007:
2050          case 0x2008:
2051          case 0x2009:
2052          case 0x200A:
2053          case 0x202f:
2054          case 0x205f:
2055          case 0x3000:
2056          return -next != ESC_h;
2057          default:
2058          return -next == ESC_h;
2059          }
2060    
2061        case ESC_v:
2062        case ESC_V:
2063        switch(item)
2064          {
2065          case 0x0a:
2066          case 0x0b:
2067          case 0x0c:
2068          case 0x0d:
2069          case 0x85:
2070          case 0x2028:
2071          case 0x2029:
2072          return -next != ESC_v;
2073          default:
2074          return -next == ESC_v;
2075          }
2076    
2077      default:      default:
2078      return FALSE;      return FALSE;
2079      }      }
2080    
2081    case OP_DIGIT:    case OP_DIGIT:
2082    return next == -ESC_D || next == -ESC_s || next == -ESC_W;    return next == -ESC_D || next == -ESC_s || next == -ESC_W ||
2083             next == -ESC_h || next == -ESC_v;
2084    
2085    case OP_NOT_DIGIT:    case OP_NOT_DIGIT:
2086    return next == -ESC_d;    return next == -ESC_d;
# Line 1997  switch(op_code) Line 2089  switch(op_code)
2089    return next == -ESC_S || next == -ESC_d || next == -ESC_w;    return next == -ESC_S || next == -ESC_d || next == -ESC_w;
2090    
2091    case OP_NOT_WHITESPACE:    case OP_NOT_WHITESPACE:
2092    return next == -ESC_s;    return next == -ESC_s || next == -ESC_h || next == -ESC_v;
2093    
2094      case OP_HSPACE:
2095      return next == -ESC_S || next == -ESC_H || next == -ESC_d || next == -ESC_w;
2096    
2097      case OP_NOT_HSPACE:
2098      return next == -ESC_h;
2099    
2100      /* Can't have \S in here because VT matches \S (Perl anomaly) */
2101      case OP_VSPACE:
2102      return next == -ESC_V || next == -ESC_d || next == -ESC_w;
2103    
2104      case OP_NOT_VSPACE:
2105      return next == -ESC_v;
2106    
2107    case OP_WORDCHAR:    case OP_WORDCHAR:
2108    return next == -ESC_W || next == -ESC_s;    return next == -ESC_W || next == -ESC_s || next == -ESC_h || next == -ESC_v;
2109    
2110    case OP_NOT_WORDCHAR:    case OP_NOT_WORDCHAR:
2111    return next == -ESC_w || next == -ESC_d;    return next == -ESC_w || next == -ESC_d;
# Line 2115  for (;; ptr++) Line 2220  for (;; ptr++)
2220    BOOL possessive_quantifier;    BOOL possessive_quantifier;
2221    BOOL is_quantifier;    BOOL is_quantifier;
2222    BOOL is_recurse;    BOOL is_recurse;
2223    BOOL reset_bracount;    BOOL reset_bracount;
2224    int class_charcount;    int class_charcount;
2225    int class_lastchar;    int class_lastchar;
2226    int newoptions;    int newoptions;
# Line 2535  for (;; ptr++) Line 2640  for (;; ptr++)
2640    
2641              case ESC_E: /* Perl ignores an orphan \E */              case ESC_E: /* Perl ignores an orphan \E */
2642              continue;              continue;
2643    
2644              default:    /* Not recognized; fall through */              default:    /* Not recognized; fall through */
2645              break;      /* Need "default" setting to stop compiler warning. */              break;      /* Need "default" setting to stop compiler warning. */
2646              }              }
# Line 2544  for (;; ptr++) Line 2649  for (;; ptr++)
2649    
2650            else if (c == -ESC_d || c == -ESC_D || c == -ESC_w ||            else if (c == -ESC_d || c == -ESC_D || c == -ESC_w ||
2651                     c == -ESC_W || c == -ESC_s || c == -ESC_S) continue;                     c == -ESC_W || c == -ESC_s || c == -ESC_S) continue;
2652    
2653            /* 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
2654            they use extra memory. */            they use extra memory. */
2655    
2656            if (-c == ESC_h)            if (-c == ESC_h)
2657              {              {
2658              SETBIT(classbits, 0x09); /* VT */              SETBIT(classbits, 0x09); /* VT */
2659              SETBIT(classbits, 0x20); /* SPACE */              SETBIT(classbits, 0x20); /* SPACE */
2660              SETBIT(classbits, 0xa0); /* NSBP */              SETBIT(classbits, 0xa0); /* NSBP */
2661  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2662              if (utf8)              if (utf8)
2663                {                {
2664                class_utf8 = TRUE;                class_utf8 = TRUE;
2665                *class_utf8data++ = XCL_SINGLE;                *class_utf8data++ = XCL_SINGLE;
2666                class_utf8data += _pcre_ord2utf8(0x1680, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x1680, class_utf8data);
2667                *class_utf8data++ = XCL_SINGLE;                *class_utf8data++ = XCL_SINGLE;
2668                class_utf8data += _pcre_ord2utf8(0x180e, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x180e, class_utf8data);
2669                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2670                class_utf8data += _pcre_ord2utf8(0x2000, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x2000, class_utf8data);
2671                class_utf8data += _pcre_ord2utf8(0x200A, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x200A, class_utf8data);
2672                *class_utf8data++ = XCL_SINGLE;                *class_utf8data++ = XCL_SINGLE;
2673                class_utf8data += _pcre_ord2utf8(0x202f, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x202f, class_utf8data);
2674                *class_utf8data++ = XCL_SINGLE;                *class_utf8data++ = XCL_SINGLE;
2675                class_utf8data += _pcre_ord2utf8(0x205f, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x205f, class_utf8data);
2676                *class_utf8data++ = XCL_SINGLE;                *class_utf8data++ = XCL_SINGLE;
2677                class_utf8data += _pcre_ord2utf8(0x3000, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x3000, class_utf8data);
2678                }                }
2679  #endif  #endif
2680              continue;              continue;
2681              }              }
2682    
2683            if (-c == ESC_H)            if (-c == ESC_H)
2684              {              {
# Line 2581  for (;; ptr++) Line 2686  for (;; ptr++)
2686                {                {
2687                int x = 0xff;                int x = 0xff;
2688                switch (c)                switch (c)
2689                  {                  {
2690                  case 0x09/8: x ^= 1 << (0x09%8); break;                  case 0x09/8: x ^= 1 << (0x09%8); break;
2691                  case 0x20/8: x ^= 1 << (0x20%8); break;                  case 0x20/8: x ^= 1 << (0x20%8); break;
2692                  case 0xa0/8: x ^= 1 << (0xa0%8); break;                  case 0xa0/8: x ^= 1 << (0xa0%8); break;
2693                  default: break;                  default: break;
2694                  }                  }
2695                classbits[c] |= x;                classbits[c] |= x;
2696                }                }
2697    
2698  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2699              if (utf8)              if (utf8)
2700                {                {
2701                class_utf8 = TRUE;                class_utf8 = TRUE;
2702                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2703                class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data);
2704                class_utf8data += _pcre_ord2utf8(0x167f, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x167f, class_utf8data);
2705                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2706                class_utf8data += _pcre_ord2utf8(0x1681, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x1681, class_utf8data);
2707                class_utf8data += _pcre_ord2utf8(0x180d, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x180d, class_utf8data);
2708                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2709                class_utf8data += _pcre_ord2utf8(0x180f, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x180f, class_utf8data);
2710                class_utf8data += _pcre_ord2utf8(0x1fff, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x1fff, class_utf8data);
2711                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2712                class_utf8data += _pcre_ord2utf8(0x200B, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x200B, class_utf8data);
2713                class_utf8data += _pcre_ord2utf8(0x202e, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x202e, class_utf8data);
2714                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2715                class_utf8data += _pcre_ord2utf8(0x2030, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x2030, class_utf8data);
2716                class_utf8data += _pcre_ord2utf8(0x205e, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x205e, class_utf8data);
2717                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2718                class_utf8data += _pcre_ord2utf8(0x2060, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x2060, class_utf8data);
2719                class_utf8data += _pcre_ord2utf8(0x2fff, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x2fff, class_utf8data);
2720                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2721                class_utf8data += _pcre_ord2utf8(0x3001, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x3001, class_utf8data);
2722                class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data);
2723                }                }
2724  #endif  #endif
2725              continue;              continue;
2726              }              }
2727    
2728            if (-c == ESC_v)            if (-c == ESC_v)
2729              {              {
2730              SETBIT(classbits, 0x0a); /* LF */              SETBIT(classbits, 0x0a); /* LF */
2731              SETBIT(classbits, 0x0b); /* VT */              SETBIT(classbits, 0x0b); /* VT */
2732              SETBIT(classbits, 0x0c); /* FF */              SETBIT(classbits, 0x0c); /* FF */
2733              SETBIT(classbits, 0x0d); /* CR */              SETBIT(classbits, 0x0d); /* CR */
2734              SETBIT(classbits, 0x85); /* NEL */              SETBIT(classbits, 0x85); /* NEL */
2735  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2736              if (utf8)              if (utf8)
2737                {                {
2738                class_utf8 = TRUE;                class_utf8 = TRUE;
2739                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2740                class_utf8data += _pcre_ord2utf8(0x2028, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x2028, class_utf8data);
2741                class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data);
2742                }                }
2743  #endif  #endif
2744              continue;              continue;
2745              }              }
2746    
2747            if (-c == ESC_V)            if (-c == ESC_V)
2748              {              {
# Line 2645  for (;; ptr++) Line 2750  for (;; ptr++)
2750                {                {
2751                int x = 0xff;                int x = 0xff;
2752                switch (c)                switch (c)
2753                  {                  {
2754                  case 0x0a/8: x ^= 1 << (0x0a%8);                  case 0x0a/8: x ^= 1 << (0x0a%8);
2755                               x ^= 1 << (0x0b%8);                               x ^= 1 << (0x0b%8);
2756                               x ^= 1 << (0x0c%8);                               x ^= 1 << (0x0c%8);
2757                               x ^= 1 << (0x0d%8);                               x ^= 1 << (0x0d%8);
2758                               break;                               break;
2759                  case 0x85/8: x ^= 1 << (0x85%8); break;                  case 0x85/8: x ^= 1 << (0x85%8); break;
2760                  default: break;                  default: break;
2761                  }                  }
2762                classbits[c] |= x;                classbits[c] |= x;
2763                }                }
2764    
2765  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2766              if (utf8)              if (utf8)
2767                {                {
2768                class_utf8 = TRUE;                class_utf8 = TRUE;
2769                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2770                class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x0100, class_utf8data);
2771                class_utf8data += _pcre_ord2utf8(0x2027, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x2027, class_utf8data);
2772                *class_utf8data++ = XCL_RANGE;                *class_utf8data++ = XCL_RANGE;
2773                class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x2029, class_utf8data);
2774                class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data);                class_utf8data += _pcre_ord2utf8(0x7fffffff, class_utf8data);
2775                }                }
2776  #endif  #endif
2777              continue;              continue;
2778              }              }
2779    
2780            /* We need to deal with \P and \p in both phases. */            /* We need to deal with \P and \p in both phases. */
2781    
# Line 2812  for (;; ptr++) Line 2917  for (;; ptr++)
2917              unsigned int origd = d;              unsigned int origd = d;
2918              while (get_othercase_range(&cc, origd, &occ, &ocd))              while (get_othercase_range(&cc, origd, &occ, &ocd))
2919                {                {
2920                if (occ >= (unsigned int)c &&                if (occ >= (unsigned int)c &&
2921                    ocd <= (unsigned int)d)                    ocd <= (unsigned int)d)
2922                  continue;                          /* Skip embedded ranges */                  continue;                          /* Skip embedded ranges */
2923    
2924                if (occ < (unsigned int)c  &&                if (occ < (unsigned int)c  &&
2925                    ocd >= (unsigned int)c - 1)      /* Extend the basic range */                    ocd >= (unsigned int)c - 1)      /* Extend the basic range */
2926                  {                                  /* if there is overlap,   */                  {                                  /* if there is overlap,   */
2927                  c = occ;                           /* noting that if occ < c */                  c = occ;                           /* noting that if occ < c */
2928                  continue;                          /* we can't have ocd > d  */                  continue;                          /* we can't have ocd > d  */
2929                  }                                  /* because a subrange is  */                  }                                  /* because a subrange is  */
2930                if (ocd > (unsigned int)d &&                if (ocd > (unsigned int)d &&
2931                    occ <= (unsigned int)d + 1)      /* always shorter than    */                    occ <= (unsigned int)d + 1)      /* always shorter than    */
2932                  {                                  /* the basic range.       */                  {                                  /* the basic range.       */
2933                  d = ocd;                  d = ocd;
# Line 3721  for (;; ptr++) Line 3826  for (;; ptr++)
3826      skipbytes = 0;      skipbytes = 0;
3827      bravalue = OP_CBRA;      bravalue = OP_CBRA;
3828      save_hwm = cd->hwm;      save_hwm = cd->hwm;
3829      reset_bracount = FALSE;      reset_bracount = FALSE;
3830    
3831      if (*(++ptr) == '?')      if (*(++ptr) == '?')
3832        {        {
# Line 3746  for (;; ptr++) Line 3851  for (;; ptr++)
3851          /* ------------------------------------------------------------ */          /* ------------------------------------------------------------ */
3852          case '|':                 /* Reset capture count for each branch */          case '|':                 /* Reset capture count for each branch */
3853          reset_bracount = TRUE;          reset_bracount = TRUE;
3854          /* Fall through */          /* Fall through */
3855    
3856          /* ------------------------------------------------------------ */          /* ------------------------------------------------------------ */
3857          case ':':                 /* Non-capturing bracket */          case ':':                 /* Non-capturing bracket */
# Line 4447  for (;; ptr++) Line 4552  for (;; ptr++)
4552           errorcodeptr,                 /* Where to put an error message */           errorcodeptr,                 /* Where to put an error message */
4553           (bravalue == OP_ASSERTBACK ||           (bravalue == OP_ASSERTBACK ||
4554            bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */            bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */
4555           reset_bracount,               /* True if (?| group */           reset_bracount,               /* True if (?| group */
4556           skipbytes,                    /* Skip over bracket number */           skipbytes,                    /* Skip over bracket number */
4557           &subfirstbyte,                /* For possible first char */           &subfirstbyte,                /* For possible first char */
4558           &subreqbyte,                  /* For possible last char */           &subreqbyte,                  /* For possible last char */
# Line 4807  Arguments: Line 4912  Arguments:
4912    ptrptr         -> the address of the current pattern pointer    ptrptr         -> the address of the current pattern pointer
4913    errorcodeptr   -> pointer to error code variable    errorcodeptr   -> pointer to error code variable
4914    lookbehind     TRUE if this is a lookbehind assertion    lookbehind     TRUE if this is a lookbehind assertion
4915    reset_bracount TRUE to reset the count for each branch    reset_bracount TRUE to reset the count for each branch
4916    skipbytes      skip this many bytes at start (for brackets and OP_COND)    skipbytes      skip this many bytes at start (for brackets and OP_COND)
4917    firstbyteptr   place to put the first required character, or a negative number    firstbyteptr   place to put the first required character, or a negative number
4918    reqbyteptr     place to put the last required character, or a negative number    reqbyteptr     place to put the last required character, or a negative number
# Line 4821  Returns:         TRUE on success Line 4926  Returns:         TRUE on success
4926    
4927  static BOOL  static BOOL
4928  compile_regex(int options, int oldims, uschar **codeptr, const uschar **ptrptr,  compile_regex(int options, int oldims, uschar **codeptr, const uschar **ptrptr,
4929    int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes,    int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes,
4930    int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd,    int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd,
4931    int *lengthptr)    int *lengthptr)
4932  {  {
4933  const uschar *ptr = *ptrptr;  const uschar *ptr = *ptrptr;
# Line 4867  orig_bracount = max_bracount = cd->braco Line 4972  orig_bracount = max_bracount = cd->braco
4972  for (;;)  for (;;)
4973    {    {
4974    /* For a (?| group, reset the capturing bracket count so that each branch    /* For a (?| group, reset the capturing bracket count so that each branch
4975    uses the same numbers. */    uses the same numbers. */
4976    
4977    if (reset_bracount) cd->bracount = orig_bracount;    if (reset_bracount) cd->bracount = orig_bracount;
4978    
4979    /* Handle a change of ims options at the start of the branch */    /* Handle a change of ims options at the start of the branch */
4980    
4981    if ((options & PCRE_IMS) != oldims)    if ((options & PCRE_IMS) != oldims)
# Line 4899  for (;;) Line 5004  for (;;)
5004      *ptrptr = ptr;      *ptrptr = ptr;
5005      return FALSE;      return FALSE;
5006      }      }
5007    
5008    /* Keep the highest bracket count in case (?| was used and some branch    /* Keep the highest bracket count in case (?| was used and some branch
5009    has fewer than the rest. */    has fewer than the rest. */
5010    
5011    if (cd->bracount > max_bracount) max_bracount = cd->bracount;    if (cd->bracount > max_bracount) max_bracount = cd->bracount;
5012    
5013    /* 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. */
# Line 5006  for (;;) Line 5111  for (;;)
5111        *code++ = oldims;        *code++ = oldims;
5112        length += 2;        length += 2;
5113        }        }
5114    
5115      /* Retain the highest bracket number, in case resetting was used. */      /* Retain the highest bracket number, in case resetting was used. */
5116    
5117      cd->bracount = max_bracount;      cd->bracount = max_bracount;
5118    
5119      /* Set values to pass back */      /* Set values to pass back */
# Line 5485  outside can help speed up starting point Line 5590  outside can help speed up starting point
5590  code = cworkspace;  code = cworkspace;
5591  *code = OP_BRA;  *code = OP_BRA;
5592  (void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS,  (void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS,
5593    &code, &ptr, &errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd,    &code, &ptr, &errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd,
5594    &length);    &length);
5595  if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;  if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;
5596    

Legend:
Removed from v.178  
changed lines
  Added in v.200

  ViewVC Help
Powered by ViewVC 1.1.5