/[pcre]/code/branches/pcre16/pcre_compile.c
ViewVC logotype

Diff of /code/branches/pcre16/pcre_compile.c

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

revision 769 by zherczeg, Sun Nov 27 17:40:33 2011 UTC revision 770 by zherczeg, Mon Nov 28 20:39:30 2011 UTC
# Line 1764  for (;;) Line 1764  for (;;)
1764    
1765      /* Check a class for variable quantification */      /* Check a class for variable quantification */
1766    
1767  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || defined COMPILE_PCRE16
1768      case OP_XCLASS:      case OP_XCLASS:
1769      cc += GET(cc, 1) - 33;      cc += GET(cc, 1) - PRIV(OP_lengths)[OP_CLASS];
1770      /* Fall through */      /* Fall through */
1771  #endif  #endif
1772    
1773      case OP_CLASS:      case OP_CLASS:
1774      case OP_NCLASS:      case OP_NCLASS:
1775      cc += 33;      cc += PRIV(OP_lengths)[OP_CLASS];
1776    
1777      switch (*cc)      switch (*cc)
1778        {        {
# Line 2310  for (code = first_significant_code(code Line 2310  for (code = first_significant_code(code
2310    
2311      case OP_CLASS:      case OP_CLASS:
2312      case OP_NCLASS:      case OP_NCLASS:
2313      ccode = code + 33;      ccode = code + PRIV(OP_lengths)[OP_CLASS];
2314    
2315  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2316      CHECK_CLASS_REPEAT:      CHECK_CLASS_REPEAT:
# Line 3299  const pcre_uchar *nestptr = NULL; Line 3299  const pcre_uchar *nestptr = NULL;
3299  pcre_uchar *previous = NULL;  pcre_uchar *previous = NULL;
3300  pcre_uchar *previous_callout = NULL;  pcre_uchar *previous_callout = NULL;
3301  pcre_uchar *save_hwm = NULL;  pcre_uchar *save_hwm = NULL;
3302  pcre_uchar classbits[32];  pcre_uint8 classbits[32];
3303    
3304  /* We can fish out the UTF-8 setting once and for all into a BOOL, but we  /* We can fish out the UTF-8 setting once and for all into a BOOL, but we
3305  must not do this for other options (e.g. PCRE_EXTENDED) because they may change  must not do this for other options (e.g. PCRE_EXTENDED) because they may change
3306  dynamically as we process the pattern. */  dynamically as we process the pattern. */
3307    
3308  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
 BOOL class_utf8;  
3309  BOOL utf8 = (options & PCRE_UTF8) != 0;  BOOL utf8 = (options & PCRE_UTF8) != 0;
 pcre_uint8 *class_utf8data;  
 pcre_uint8 *class_utf8data_base;  
3310  pcre_uint8 utf8_char[6];  pcre_uint8 utf8_char[6];
3311  #else  #else
3312  BOOL utf8 = FALSE;  BOOL utf8 = FALSE;
3313  #endif  #endif
3314    
3315    /* Helper variables for OP_XCLASS opcode (for characters > 255). */
3316    
3317    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3318    BOOL xclass;
3319    pcre_uchar *class_uchardata;
3320    pcre_uchar *class_uchardata_base;
3321    #endif
3322    
3323  #ifdef PCRE_DEBUG  #ifdef PCRE_DEBUG
3324  if (lengthptr != NULL) DPRINTF((">> start branch\n"));  if (lengthptr != NULL) DPRINTF((">> start branch\n"));
3325  #endif  #endif
# Line 3620  for (;; ptr++) Line 3625  for (;; ptr++)
3625          {          {
3626          if (ptr[1] == CHAR_E)          if (ptr[1] == CHAR_E)
3627            ptr++;            ptr++;
3628          else if (STRNCMP_UC_C8(ptr + 1,          else if (STRNCMP_UC_C8(ptr + 1, STR_Q STR_BACKSLASH STR_E, 3) == 0)
                           STR_Q STR_BACKSLASH STR_E, 3) == 0)  
3629            ptr += 3;            ptr += 3;
3630          else          else
3631            break;            break;
# Line 3665  for (;; ptr++) Line 3669  for (;; ptr++)
3669    
3670      memset(classbits, 0, 32 * sizeof(pcre_uint8));      memset(classbits, 0, 32 * sizeof(pcre_uint8));
3671    
3672  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3673      class_utf8 = FALSE;                       /* No chars >= 256 */      xclass = FALSE;                           /* No chars >= 256 */
3674      class_utf8data = code + LINK_SIZE + 2;    /* For UTF-8 items */      class_uchardata = code + LINK_SIZE + 2;   /* For UTF-8 items */
3675      class_utf8data_base = class_utf8data;     /* For resetting in pass 1 */      class_uchardata_base = class_uchardata;   /* For resetting in pass 1 */
3676  #endif  #endif
3677    
3678      /* Process characters until ] is reached. By writing this as a "do" it      /* Process characters until ] is reached. By writing this as a "do" it
# Line 3684  for (;; ptr++) Line 3688  for (;; ptr++)
3688          {                           /* Braces are required because the */          {                           /* Braces are required because the */
3689          GETCHARLEN(c, ptr, ptr);    /* macro generates multiple statements */          GETCHARLEN(c, ptr, ptr);    /* macro generates multiple statements */
3690          }          }
3691    #endif
3692    
3693        /* In the pre-compile phase, accumulate the length of any UTF-8 extra  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3694          /* In the pre-compile phase, accumulate the length of any extra
3695        data and reset the pointer. This is so that very large classes that        data and reset the pointer. This is so that very large classes that
3696        contain a zillion UTF-8 characters no longer overwrite the work space        contain a zillion > 255 characters no longer overwrite the work space
3697        (which is on the stack). */        (which is on the stack). */
3698    
3699        if (lengthptr != NULL)        if (lengthptr != NULL)
3700          {          {
3701          *lengthptr += class_utf8data - class_utf8data_base;          *lengthptr += class_uchardata - class_uchardata_base;
3702          class_utf8data = class_utf8data_base;          class_uchardata = class_uchardata_base;
3703          }          }
   
3704  #endif  #endif
3705    
3706        /* Inside \Q...\E everything is literal except \E */        /* Inside \Q...\E everything is literal except \E */
# Line 3896  for (;; ptr++) Line 3901  for (;; ptr++)
3901              SETBIT(classbits, 0x09); /* VT */              SETBIT(classbits, 0x09); /* VT */
3902              SETBIT(classbits, 0x20); /* SPACE */              SETBIT(classbits, 0x20); /* SPACE */
3903              SETBIT(classbits, 0xa0); /* NSBP */              SETBIT(classbits, 0xa0); /* NSBP */
3904  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3905              if (utf8)              if (utf8)
3906                {                {
3907                class_utf8 = TRUE;                xclass = TRUE;
3908                *class_utf8data++ = XCL_SINGLE;                *class_uchardata++ = XCL_SINGLE;
3909                class_utf8data += PRIV(ord2utf8)(0x1680, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x1680, class_uchardata);
3910                *class_utf8data++ = XCL_SINGLE;                *class_uchardata++ = XCL_SINGLE;
3911                class_utf8data += PRIV(ord2utf8)(0x180e, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x180e, class_uchardata);
3912                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
3913                class_utf8data += PRIV(ord2utf8)(0x2000, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x2000, class_uchardata);
3914                class_utf8data += PRIV(ord2utf8)(0x200A, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x200A, class_uchardata);
3915                *class_utf8data++ = XCL_SINGLE;                *class_uchardata++ = XCL_SINGLE;
3916                class_utf8data += PRIV(ord2utf8)(0x202f, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x202f, class_uchardata);
3917                *class_utf8data++ = XCL_SINGLE;                *class_uchardata++ = XCL_SINGLE;
3918                class_utf8data += PRIV(ord2utf8)(0x205f, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x205f, class_uchardata);
3919                *class_utf8data++ = XCL_SINGLE;                *class_uchardata++ = XCL_SINGLE;
3920                class_utf8data += PRIV(ord2utf8)(0x3000, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x3000, class_uchardata);
3921                }                }
3922  #endif  #endif
3923              continue;              continue;
# Line 3931  for (;; ptr++) Line 3936  for (;; ptr++)
3936                classbits[c] |= x;                classbits[c] |= x;
3937                }                }
3938    
3939  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3940              if (utf8)              if (utf8)
3941                {                {
3942                class_utf8 = TRUE;                xclass = TRUE;
3943                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
3944                class_utf8data += PRIV(ord2utf8)(0x0100, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x0100, class_uchardata);
3945                class_utf8data += PRIV(ord2utf8)(0x167f, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x167f, class_uchardata);
3946                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
3947                class_utf8data += PRIV(ord2utf8)(0x1681, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x1681, class_uchardata);
3948                class_utf8data += PRIV(ord2utf8)(0x180d, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x180d, class_uchardata);
3949                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
3950                class_utf8data += PRIV(ord2utf8)(0x180f, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x180f, class_uchardata);
3951                class_utf8data += PRIV(ord2utf8)(0x1fff, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x1fff, class_uchardata);
3952                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
3953                class_utf8data += PRIV(ord2utf8)(0x200B, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x200B, class_uchardata);
3954                class_utf8data += PRIV(ord2utf8)(0x202e, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x202e, class_uchardata);
3955                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
3956                class_utf8data += PRIV(ord2utf8)(0x2030, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x2030, class_uchardata);
3957                class_utf8data += PRIV(ord2utf8)(0x205e, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x205e, class_uchardata);
3958                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
3959                class_utf8data += PRIV(ord2utf8)(0x2060, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x2060, class_uchardata);
3960                class_utf8data += PRIV(ord2utf8)(0x2fff, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x2fff, class_uchardata);
3961                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
3962                class_utf8data += PRIV(ord2utf8)(0x3001, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x3001, class_uchardata);
3963                class_utf8data += PRIV(ord2utf8)(0x7fffffff, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x7fffffff, class_uchardata);
3964                }                }
3965  #endif  #endif
3966              continue;              continue;
# Line 3966  for (;; ptr++) Line 3971  for (;; ptr++)
3971              SETBIT(classbits, 0x0c); /* FF */              SETBIT(classbits, 0x0c); /* FF */
3972              SETBIT(classbits, 0x0d); /* CR */              SETBIT(classbits, 0x0d); /* CR */
3973              SETBIT(classbits, 0x85); /* NEL */              SETBIT(classbits, 0x85); /* NEL */
3974  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3975              if (utf8)              if (utf8)
3976                {                {
3977                class_utf8 = TRUE;                xclass = TRUE;
3978                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
3979                class_utf8data += PRIV(ord2utf8)(0x2028, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x2028, class_uchardata);
3980                class_utf8data += PRIV(ord2utf8)(0x2029, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x2029, class_uchardata);
3981                }                }
3982  #endif  #endif
3983              continue;              continue;
# Line 3994  for (;; ptr++) Line 3999  for (;; ptr++)
3999                classbits[c] |= x;                classbits[c] |= x;
4000                }                }
4001    
4002  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
4003              if (utf8)              if (utf8)
4004                {                {
4005                class_utf8 = TRUE;                xclass = TRUE;
4006                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
4007                class_utf8data += PRIV(ord2utf8)(0x0100, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x0100, class_uchardata);
4008                class_utf8data += PRIV(ord2utf8)(0x2027, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x2027, class_uchardata);
4009                *class_utf8data++ = XCL_RANGE;                *class_uchardata++ = XCL_RANGE;
4010                class_utf8data += PRIV(ord2utf8)(0x2029, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x2029, class_uchardata);
4011                class_utf8data += PRIV(ord2utf8)(0x7fffffff, class_utf8data);                class_uchardata += PRIV(ord2utf8)(0x7fffffff, class_uchardata);
4012                }                }
4013  #endif  #endif
4014              continue;              continue;
# Line 4016  for (;; ptr++) Line 4021  for (;; ptr++)
4021                int pdata;                int pdata;
4022                int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);                int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);
4023                if (ptype < 0) goto FAILED;                if (ptype < 0) goto FAILED;
4024                class_utf8 = TRUE;                xclass = TRUE;
4025                *class_utf8data++ = ((-c == ESC_p) != negated)?                *class_uchardata++ = ((-c == ESC_p) != negated)?
4026                  XCL_PROP : XCL_NOTPROP;                  XCL_PROP : XCL_NOTPROP;
4027                *class_utf8data++ = ptype;                *class_uchardata++ = ptype;
4028                *class_utf8data++ = pdata;                *class_uchardata++ = pdata;
4029                class_charcount -= 2;   /* Not a < 256 character */                class_charcount -= 2;   /* Not a < 256 character */
4030                continue;                continue;
4031                }                }
# Line 4042  for (;; ptr++) Line 4047  for (;; ptr++)
4047            }            }
4048    
4049          /* Fall through if we have a single character (c >= 0). This may be          /* Fall through if we have a single character (c >= 0). This may be
4050          greater than 256 in UTF-8 mode. */          greater than 256 mode. */
4051    
4052          }   /* End of backslash handling */          }   /* End of backslash handling */
4053    
# Line 4140  for (;; ptr++) Line 4145  for (;; ptr++)
4145          matching for characters > 127 is available only if UCP support is          matching for characters > 127 is available only if UCP support is
4146          available. */          available. */
4147    
4148  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
4149          if (utf8 && (d > 255 || ((options & PCRE_CASELESS) != 0 && d > 127)))          if (utf8 && (d > 255 || ((options & PCRE_CASELESS) != 0 && d > 127)))
4150    #endif
4151    #ifndef COMPILE_PCRE8
4152            if (d > 255)
4153    #endif
4154    #if defined SUPPORT_UTF || defined COMPILE_PCRE16
4155            {            {
4156            class_utf8 = TRUE;            xclass = TRUE;
4157    
4158            /* With UCP support, we can find the other case equivalents of            /* With UCP support, we can find the other case equivalents of
4159            the relevant characters. There may be several ranges. Optimize how            the relevant characters. There may be several ranges. Optimize how
# Line 4176  for (;; ptr++) Line 4186  for (;; ptr++)
4186    
4187                if (occ == ocd)                if (occ == ocd)
4188                  {                  {
4189                  *class_utf8data++ = XCL_SINGLE;                  *class_uchardata++ = XCL_SINGLE;
4190                  }                  }
4191                else                else
4192                  {                  {
4193                  *class_utf8data++ = XCL_RANGE;                  *class_uchardata++ = XCL_RANGE;
4194                  class_utf8data += PRIV(ord2utf8)(occ, class_utf8data);                  class_uchardata += PRIV(ord2utf8)(occ, class_uchardata);
4195                  }                  }
4196                class_utf8data += PRIV(ord2utf8)(ocd, class_utf8data);                class_uchardata += PRIV(ord2utf8)(ocd, class_uchardata);
4197                }                }
4198              }              }
4199  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
# Line 4191  for (;; ptr++) Line 4201  for (;; ptr++)
4201            /* Now record the original range, possibly modified for UCP caseless            /* Now record the original range, possibly modified for UCP caseless
4202            overlapping ranges. */            overlapping ranges. */
4203    
4204            *class_utf8data++ = XCL_RANGE;            *class_uchardata++ = XCL_RANGE;
4205            class_utf8data += PRIV(ord2utf8)(c, class_utf8data);  #ifdef SUPPORT_UTF
4206            class_utf8data += PRIV(ord2utf8)(d, class_utf8data);            class_uchardata += PRIV(ord2utf8)(c, class_uchardata);
4207              class_uchardata += PRIV(ord2utf8)(d, class_uchardata);
4208    #else
4209              *class_uchardata++ = c;
4210              *class_uchardata++ = d;
4211    #endif
4212    
4213            /* With UCP support, we are done. Without UCP support, there is no            /* With UCP support, we are done. Without UCP support, there is no
4214            caseless matching for UTF-8 characters > 127; we can use the bit map            caseless matching for UTF characters > 127; we can use the bit map
4215            for the smaller ones. */            for the smaller ones. As for 16 bit characters without UTF, we
4216              can still use  */
4217    
4218  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
4219            continue;    /* With next character in the class */            continue;    /* With next character in the class */
4220  #else  #else
4221    #ifdef SUPPORT_UTF
4222            if ((options & PCRE_CASELESS) == 0 || c > 127) continue;            if ((options & PCRE_CASELESS) == 0 || c > 127) continue;
   
4223            /* Adjust upper limit and fall through to set up the map */            /* Adjust upper limit and fall through to set up the map */
   
4224            d = 127;            d = 127;
4225    #else
4226              if (c > 255) continue;
4227              /* Adjust upper limit and fall through to set up the map */
4228              d = 255;
4229    #endif  /* SUPPORT_UTF */
4230  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
4231            }            }
4232  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF8 || COMPILE_PCRE16 */
4233    
4234          /* We use the bit map for all cases when not in UTF-8 mode; else          /* We use the bit map for 8 bit mode, or when the characters fall
4235          ranges that lie entirely within 0-127 when there is UCP support; else          partially or entirely to [0-255] ([0-127] for UCP) ranges. */
         for partial ranges without UCP support. */  
4236    
4237          class_charcount += d - c + 1;          class_charcount += d - c + 1;
4238          class_lastchar = d;          class_lastchar = d;
# Line 4242  for (;; ptr++) Line 4260  for (;; ptr++)
4260    
4261        /* Handle a character that cannot go in the bit map */        /* Handle a character that cannot go in the bit map */
4262    
4263  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
4264        if (utf8 && (c > 255 || ((options & PCRE_CASELESS) != 0 && c > 127)))        if (utf8 && (c > 255 || ((options & PCRE_CASELESS) != 0 && c > 127)))
4265    #endif
4266    #ifndef COMPILE_PCRE8
4267          if (c > 255)
4268    #endif
4269    #if defined SUPPORT_UTF || defined COMPILE_PCRE16
4270          {          {
4271          class_utf8 = TRUE;          xclass = TRUE;
4272          *class_utf8data++ = XCL_SINGLE;          *class_uchardata++ = XCL_SINGLE;
4273          class_utf8data += PRIV(ord2utf8)(c, class_utf8data);  #ifdef SUPPORT_UTF
4274            class_uchardata += PRIV(ord2utf8)(c, class_uchardata);
4275    #else
4276            *class_uchardata++ = c;
4277    #endif
4278    
4279  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
4280          if ((options & PCRE_CASELESS) != 0)          if ((options & PCRE_CASELESS) != 0)
# Line 4255  for (;; ptr++) Line 4282  for (;; ptr++)
4282            unsigned int othercase;            unsigned int othercase;
4283            if ((othercase = UCD_OTHERCASE(c)) != c)            if ((othercase = UCD_OTHERCASE(c)) != c)
4284              {              {
4285              *class_utf8data++ = XCL_SINGLE;              *class_uchardata++ = XCL_SINGLE;
4286              class_utf8data += PRIV(ord2utf8)(othercase, class_utf8data);              class_uchardata += PRIV(ord2utf8)(othercase, class_uchardata);
4287              }              }
4288            }            }
4289  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
# Line 4312  for (;; ptr++) Line 4339  for (;; ptr++)
4339      char if this item is first, whatever repeat count may follow. In the case      char if this item is first, whatever repeat count may follow. In the case
4340      of reqbyte, save the previous value for reinstating. */      of reqbyte, save the previous value for reinstating. */
4341    
4342  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
4343      if (class_charcount == 1 && !class_utf8 &&      if (class_charcount == 1 && !xclass &&
4344        (!utf8 || !negate_class || class_lastchar < 128))        (!utf8 || !negate_class || class_lastchar < 128))
4345  #else  #elif defined COMPILE_PCRE8
4346      if (class_charcount == 1)      if (class_charcount == 1)
4347    #else
4348        if (class_charcount == 1 && !xclass)
4349  #endif  #endif
4350        {        {
4351        zeroreqbyte = reqbyte;        zeroreqbyte = reqbyte;
# Line 4364  for (;; ptr++) Line 4393  for (;; ptr++)
4393      be listed) there are no characters < 256, we can omit the bitmap in the      be listed) there are no characters < 256, we can omit the bitmap in the
4394      actual compiled code. */      actual compiled code. */
4395    
4396  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
4397      if (class_utf8 && (!should_flip_negation || (options & PCRE_UCP) != 0))      if (xclass && (!should_flip_negation || (options & PCRE_UCP) != 0))
4398    #endif
4399    #ifndef COMPILE_PCRE8
4400        if (xclass && !should_flip_negation)
4401    #endif
4402    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
4403        {        {
4404        *class_utf8data++ = XCL_END;    /* Marks the end of extra data */        *class_uchardata++ = XCL_END;    /* Marks the end of extra data */
4405        *code++ = OP_XCLASS;        *code++ = OP_XCLASS;
4406        code += LINK_SIZE;        code += LINK_SIZE;
4407        *code = negate_class? XCL_NOT : 0;        *code = negate_class? XCL_NOT:0;
4408    
4409        /* If the map is required, move up the extra data to make room for it;        /* If the map is required, move up the extra data to make room for it;
4410        otherwise just move the code pointer to the end of the extra data. */        otherwise just move the code pointer to the end of the extra data. */
# Line 4378  for (;; ptr++) Line 4412  for (;; ptr++)
4412        if (class_charcount > 0)        if (class_charcount > 0)
4413          {          {
4414          *code++ |= XCL_MAP;          *code++ |= XCL_MAP;
4415          memmove(code + 32, code, class_utf8data - code);          memmove(code + (32 / sizeof(pcre_uchar)), code,
4416              IN_UCHARS(class_uchardata - code));
4417          memcpy(code, classbits, 32);          memcpy(code, classbits, 32);
4418          code = class_utf8data + 32;          code = class_uchardata + (32 / sizeof(pcre_uchar));
4419          }          }
4420        else code = class_utf8data;        else code = class_uchardata;
4421    
4422        /* Now fill in the complete length of the item */        /* Now fill in the complete length of the item */
4423    
# Line 4398  for (;; ptr++) Line 4433  for (;; ptr++)
4433      negating it if necessary. */      negating it if necessary. */
4434    
4435      *code++ = (negate_class == should_flip_negation) ? OP_CLASS : OP_NCLASS;      *code++ = (negate_class == should_flip_negation) ? OP_CLASS : OP_NCLASS;
4436      if (negate_class)      if (lengthptr == NULL)    /* Save time in the pre-compile phase */
       {  
       if (lengthptr == NULL)    /* Save time in the pre-compile phase */  
         for (c = 0; c < 32; c++) code[c] = ~classbits[c];  
       }  
     else  
4437        {        {
4438          if (negate_class)
4439            for (c = 0; c < 32; c++) classbits[c] = ~classbits[c];
4440        memcpy(code, classbits, 32);        memcpy(code, classbits, 32);
4441        }        }
4442      code += 32;      code += 32 / sizeof(pcre_uchar);
4443      break;      break;
4444    
4445    
# Line 4761  for (;; ptr++) Line 4793  for (;; ptr++)
4793    
4794      else if (*previous == OP_CLASS ||      else if (*previous == OP_CLASS ||
4795               *previous == OP_NCLASS ||               *previous == OP_NCLASS ||
4796  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF8 || !defined COMPILE_PCRE8
4797               *previous == OP_XCLASS ||               *previous == OP_XCLASS ||
4798  #endif  #endif
4799               *previous == OP_REF ||               *previous == OP_REF ||

Legend:
Removed from v.769  
changed lines
  Added in v.770

  ViewVC Help
Powered by ViewVC 1.1.5