/[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 1045 by ph10, Sun Sep 23 16:50:00 2012 UTC revision 1056 by chpe, Tue Oct 16 15:53:41 2012 UTC
# Line 53  supporting internal functions that are n Line 53  supporting internal functions that are n
53  #include "pcre_internal.h"  #include "pcre_internal.h"
54    
55    
56  /* When PCRE_DEBUG is defined, we need the pcre(16)_printint() function, which  /* When PCRE_DEBUG is defined, we need the pcre(16|32)_printint() function, which
57  is also used by pcretest. PCRE_DEBUG is not defined when building a production  is also used by pcretest. PCRE_DEBUG is not defined when building a production
58  library. We do not need to select pcre16_printint.c specially, because the  library. We do not need to select pcre16_printint.c specially, because the
59  COMPILE_PCREx macro will already be appropriately set. */  COMPILE_PCREx macro will already be appropriately set. */
# Line 123  overrun before it actually does run off Line 123  overrun before it actually does run off
123    
124  #define REQ_CASELESS   0x10000000l      /* Indicates caselessness */  #define REQ_CASELESS   0x10000000l      /* Indicates caselessness */
125  #define REQ_VARY       0x20000000l      /* Reqchar followed non-literal item */  #define REQ_VARY       0x20000000l      /* Reqchar followed non-literal item */
126    #define REQ_MASK       (REQ_CASELESS | REQ_VARY)
127    
128  /* Repeated character flags. */  /* Repeated character flags. */
129    
# Line 503  static const char error_texts[] = Line 504  static const char error_texts[] =
504    /* 75 */    /* 75 */
505    "name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)\0"    "name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)\0"
506    "character value in \\u.... sequence is too large\0"    "character value in \\u.... sequence is too large\0"
507      "invalid UTF-32 string\0"
508    ;    ;
509    
510  /* Table to identify digits and hex digits. This is used when compiling  /* Table to identify digits and hex digits. This is used when compiling
# Line 838  else Line 840  else
840  #endif  #endif
841            }            }
842    
843  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
844          if (c > (utf ? 0x10ffff : 0xff))          if (c > (utf ? 0x10ffff : 0xff))
845  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
846          if (c > (utf ? 0x10ffff : 0xffff))          if (c > (utf ? 0x10ffff : 0xffff))
847  #endif  #elif defined COMPILE_PCRE32
848            if (utf && c > 0x10ffff)
849  #endif  #endif
850            {            {
851            *errorcodeptr = ERR76;            *errorcodeptr = ERR76;
# Line 1069  else Line 1071  else
1071          c = (c << 4) + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));          c = (c << 4) + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
1072  #endif  #endif
1073    
1074  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
1075          if (c > (utf ? 0x10ffff : 0xff)) { c = -1; break; }          if (c > (utf ? 0x10ffff : 0xff)) { c = -1; break; }
1076  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
1077          if (c > (utf ? 0x10ffff : 0xffff)) { c = -1; break; }          if (c > (utf ? 0x10ffff : 0xffff)) { c = -1; break; }
1078  #endif  #elif defined COMPILE_PCRE32
1079            if (utf && c > 0x10ffff) { c = -1; break; }
1080  #endif  #endif
1081          }          }
1082    
# Line 1367  Arguments: Line 1369  Arguments:
1369    name         name to seek, or NULL if seeking a numbered subpattern    name         name to seek, or NULL if seeking a numbered subpattern
1370    lorn         name length, or subpattern number if name is NULL    lorn         name length, or subpattern number if name is NULL
1371    xmode        TRUE if we are in /x mode    xmode        TRUE if we are in /x mode
1372    utf          TRUE if we are in UTF-8 / UTF-16 mode    utf          TRUE if we are in UTF-8 / UTF-16 / UTF-32 mode
1373    count        pointer to the current capturing subpattern number (updated)    count        pointer to the current capturing subpattern number (updated)
1374    
1375  Returns:       the number of the named subpattern, or -1 if not found  Returns:       the number of the named subpattern, or -1 if not found
# Line 1601  Arguments: Line 1603  Arguments:
1603    name         name to seek, or NULL if seeking a numbered subpattern    name         name to seek, or NULL if seeking a numbered subpattern
1604    lorn         name length, or subpattern number if name is NULL    lorn         name length, or subpattern number if name is NULL
1605    xmode        TRUE if we are in /x mode    xmode        TRUE if we are in /x mode
1606    utf          TRUE if we are in UTF-8 / UTF-16 mode    utf          TRUE if we are in UTF-8 / UTF-16 / UTF-32 mode
1607    
1608  Returns:       the number of the found subpattern, or -1 if not found  Returns:       the number of the found subpattern, or -1 if not found
1609  */  */
# Line 1704  and doing the check at the end; a flag s Line 1706  and doing the check at the end; a flag s
1706    
1707  Arguments:  Arguments:
1708    code     points to the start of the pattern (the bracket)    code     points to the start of the pattern (the bracket)
1709    utf      TRUE in UTF-8 / UTF-16 mode    utf      TRUE in UTF-8 / UTF-16 / UTF-32 mode
1710    atend    TRUE if called when the pattern is complete    atend    TRUE if called when the pattern is complete
1711    cd       the "compile data" structure    cd       the "compile data" structure
1712    
# Line 1838  for (;;) Line 1840  for (;;)
1840      case OP_NOTI:      case OP_NOTI:
1841      branchlength++;      branchlength++;
1842      cc += 2;      cc += 2;
1843  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
1844      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1845  #endif  #endif
1846      break;      break;
# Line 1852  for (;;) Line 1854  for (;;)
1854      case OP_NOTEXACTI:      case OP_NOTEXACTI:
1855      branchlength += GET2(cc,1);      branchlength += GET2(cc,1);
1856      cc += 2 + IMM2_SIZE;      cc += 2 + IMM2_SIZE;
1857  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
1858      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1859  #endif  #endif
1860      break;      break;
1861    
1862      case OP_TYPEEXACT:      case OP_TYPEEXACT:
1863      branchlength += GET2(cc,1);      branchlength += GET2(cc,1);
1864      if (cc[1 + IMM2_SIZE] == OP_PROP || cc[1 + IMM2_SIZE] == OP_NOTPROP) cc += 2;      if (cc[1 + IMM2_SIZE] == OP_PROP || cc[1 + IMM2_SIZE] == OP_NOTPROP)
1865          cc += 2;
1866      cc += 1 + IMM2_SIZE + 1;      cc += 1 + IMM2_SIZE + 1;
1867      break;      break;
1868    
# Line 1894  for (;;) Line 1897  for (;;)
1897    
1898      /* Check a class for variable quantification */      /* Check a class for variable quantification */
1899    
1900  #if defined SUPPORT_UTF || defined COMPILE_PCRE16  #if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
1901      case OP_XCLASS:      case OP_XCLASS:
1902      cc += GET(cc, 1) - PRIV(OP_lengths)[OP_CLASS];      cc += GET(cc, 1) - PRIV(OP_lengths)[OP_CLASS];
1903      /* Fall through */      /* Fall through */
# Line 2033  length. Line 2036  length.
2036    
2037  Arguments:  Arguments:
2038    code        points to start of expression    code        points to start of expression
2039    utf         TRUE in UTF-8 / UTF-16 mode    utf         TRUE in UTF-8 / UTF-16 / UTF-32 mode
2040    number      the required bracket number or negative to find a lookbehind    number      the required bracket number or negative to find a lookbehind
2041    
2042  Returns:      pointer to the opcode for the bracket, or NULL if not found  Returns:      pointer to the opcode for the bracket, or NULL if not found
# Line 2097  for (;;) Line 2100  for (;;)
2100        case OP_TYPEMINUPTO:        case OP_TYPEMINUPTO:
2101        case OP_TYPEEXACT:        case OP_TYPEEXACT:
2102        case OP_TYPEPOSUPTO:        case OP_TYPEPOSUPTO:
2103        if (code[1 + IMM2_SIZE] == OP_PROP        if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP)
2104          || code[1 + IMM2_SIZE] == OP_NOTPROP) code += 2;          code += 2;
2105        break;        break;
2106    
2107        case OP_MARK:        case OP_MARK:
# Line 2120  for (;;) Line 2123  for (;;)
2123    a multi-byte character. The length in the table is a minimum, so we have to    a multi-byte character. The length in the table is a minimum, so we have to
2124    arrange to skip the extra bytes. */    arrange to skip the extra bytes. */
2125    
2126  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2127      if (utf) switch(c)      if (utf) switch(c)
2128        {        {
2129        case OP_CHAR:        case OP_CHAR:
# Line 2172  instance of OP_RECURSE. Line 2175  instance of OP_RECURSE.
2175    
2176  Arguments:  Arguments:
2177    code        points to start of expression    code        points to start of expression
2178    utf         TRUE in UTF-8 / UTF-16 mode    utf         TRUE in UTF-8 / UTF-16 / UTF-32 mode
2179    
2180  Returns:      pointer to the opcode for OP_RECURSE, or NULL if not found  Returns:      pointer to the opcode for OP_RECURSE, or NULL if not found
2181  */  */
# Line 2217  for (;;) Line 2220  for (;;)
2220        case OP_TYPEUPTO:        case OP_TYPEUPTO:
2221        case OP_TYPEMINUPTO:        case OP_TYPEMINUPTO:
2222        case OP_TYPEEXACT:        case OP_TYPEEXACT:
2223        if (code[1 + IMM2_SIZE] == OP_PROP        if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP)
2224          || code[1 + IMM2_SIZE] == OP_NOTPROP) code += 2;          code += 2;
2225        break;        break;
2226    
2227        case OP_MARK:        case OP_MARK:
# Line 2240  for (;;) Line 2243  for (;;)
2243      by a multi-byte character. The length in the table is a minimum, so we have      by a multi-byte character. The length in the table is a minimum, so we have
2244      to arrange to skip the extra bytes. */      to arrange to skip the extra bytes. */
2245    
2246  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2247      if (utf) switch(c)      if (utf) switch(c)
2248        {        {
2249        case OP_CHAR:        case OP_CHAR:
# Line 2326  bracket whose current branch will alread Line 2329  bracket whose current branch will alread
2329  Arguments:  Arguments:
2330    code        points to start of search    code        points to start of search
2331    endcode     points to where to stop    endcode     points to where to stop
2332    utf         TRUE if in UTF-8 / UTF-16 mode    utf         TRUE if in UTF-8 / UTF-16 / UTF-32 mode
2333    cd          contains pointers to tables etc.    cd          contains pointers to tables etc.
2334    
2335  Returns:      TRUE if what is matched could be empty  Returns:      TRUE if what is matched could be empty
# Line 2543  for (code = first_significant_code(code Line 2546  for (code = first_significant_code(code
2546      case OP_TYPEUPTO:      case OP_TYPEUPTO:
2547      case OP_TYPEMINUPTO:      case OP_TYPEMINUPTO:
2548      case OP_TYPEPOSUPTO:      case OP_TYPEPOSUPTO:
2549      if (code[1 + IMM2_SIZE] == OP_PROP      if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP)
2550        || code[1 + IMM2_SIZE] == OP_NOTPROP) code += 2;        code += 2;
2551      break;      break;
2552    
2553      /* End of branch */      /* End of branch */
# Line 2559  for (code = first_significant_code(code Line 2562  for (code = first_significant_code(code
2562      /* In UTF-8 mode, STAR, MINSTAR, POSSTAR, QUERY, MINQUERY, POSQUERY, UPTO,      /* In UTF-8 mode, STAR, MINSTAR, POSSTAR, QUERY, MINQUERY, POSQUERY, UPTO,
2563      MINUPTO, and POSUPTO may be followed by a multibyte character */      MINUPTO, and POSUPTO may be followed by a multibyte character */
2564    
2565  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2566      case OP_STAR:      case OP_STAR:
2567      case OP_STARI:      case OP_STARI:
2568      case OP_MINSTAR:      case OP_MINSTAR:
# Line 2625  Arguments: Line 2628  Arguments:
2628    code        points to start of the recursion    code        points to start of the recursion
2629    endcode     points to where to stop (current RECURSE item)    endcode     points to where to stop (current RECURSE item)
2630    bcptr       points to the chain of current (unclosed) branch starts    bcptr       points to the chain of current (unclosed) branch starts
2631    utf         TRUE if in UTF-8 / UTF-16 mode    utf         TRUE if in UTF-8 / UTF-16 / UTF-32 mode
2632    cd          pointers to tables etc    cd          pointers to tables etc
2633    
2634  Returns:      TRUE if what is matched could be empty  Returns:      TRUE if what is matched could be empty
# Line 2772  value in the reference (which is a group Line 2775  value in the reference (which is a group
2775  Arguments:  Arguments:
2776    group      points to the start of the group    group      points to the start of the group
2777    adjust     the amount by which the group is to be moved    adjust     the amount by which the group is to be moved
2778    utf        TRUE in UTF-8 / UTF-16 mode    utf        TRUE in UTF-8 / UTF-16 / UTF-32 mode
2779    cd         contains pointers to tables etc.    cd         contains pointers to tables etc.
2780    save_hwm   the hwm forward reference pointer at the start of the group    save_hwm   the hwm forward reference pointer at the start of the group
2781    
# Line 2951  Returns:       TRUE if auto-possessifyin Line 2954  Returns:       TRUE if auto-possessifyin
2954  static BOOL  static BOOL
2955  check_char_prop(int c, int ptype, int pdata, BOOL negated)  check_char_prop(int c, int ptype, int pdata, BOOL negated)
2956  {  {
2957    #ifdef SUPPORT_UCP
2958    const pcre_uint32 *p;
2959    #endif
2960    
2961  const ucd_record *prop = GET_UCD(c);  const ucd_record *prop = GET_UCD(c);
2962    
2963  switch(ptype)  switch(ptype)
2964    {    {
2965    case PT_LAMP:    case PT_LAMP:
# Line 2989  switch(ptype) Line 2997  switch(ptype)
2997    return (PRIV(ucp_gentype)[prop->chartype] == ucp_L ||    return (PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
2998            PRIV(ucp_gentype)[prop->chartype] == ucp_N ||            PRIV(ucp_gentype)[prop->chartype] == ucp_N ||
2999            c == CHAR_UNDERSCORE) == negated;            c == CHAR_UNDERSCORE) == negated;
3000    
3001    #ifdef SUPPORT_UCP
3002      case PT_CLIST:
3003      p = PRIV(ucd_caseless_sets) + prop->caseset;
3004      for (;;)
3005        {
3006        if ((unsigned int)c < *p) return !negated;
3007        if ((unsigned int)c == *p++) return negated;
3008        }
3009      break;  /* Control never reaches here */
3010    #endif
3011    }    }
3012    
3013  return FALSE;  return FALSE;
3014  }  }
3015  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
# Line 3006  sense to automatically possessify the re Line 3026  sense to automatically possessify the re
3026    
3027  Arguments:  Arguments:
3028    previous      pointer to the repeated opcode    previous      pointer to the repeated opcode
3029    utf           TRUE in UTF-8 / UTF-16 mode    utf           TRUE in UTF-8 / UTF-16 / UTF-32 mode
3030    ptr           next character in pattern    ptr           next character in pattern
3031    options       options bits    options       options bits
3032    cd            contains pointers to tables etc.    cd            contains pointers to tables etc.
# Line 3018  static BOOL Line 3038  static BOOL
3038  check_auto_possessive(const pcre_uchar *previous, BOOL utf,  check_auto_possessive(const pcre_uchar *previous, BOOL utf,
3039    const pcre_uchar *ptr, int options, compile_data *cd)    const pcre_uchar *ptr, int options, compile_data *cd)
3040  {  {
3041  pcre_int32 c, next;  pcre_int32 c = NOTACHAR;
3042    pcre_int32 next;
3043  int op_code = *previous++;  int op_code = *previous++;
3044    
3045  /* Skip whitespace and comments in extended mode */  /* Skip whitespace and comments in extended mode */
# Line 3092  if (*ptr == CHAR_ASTERISK || *ptr == CHA Line 3113  if (*ptr == CHAR_ASTERISK || *ptr == CHA
3113    STRNCMP_UC_C8(ptr, STR_LEFT_CURLY_BRACKET STR_0 STR_COMMA, 3) == 0)    STRNCMP_UC_C8(ptr, STR_LEFT_CURLY_BRACKET STR_0 STR_COMMA, 3) == 0)
3114      return FALSE;      return FALSE;
3115    
3116  /* Now compare the next item with the previous opcode. First, handle cases when  /* If the previous item is a character, get its value. */
 the next item is a character. */  
3117    
3118  if (next >= 0) switch(op_code)  if (op_code == OP_CHAR || op_code == OP_CHARI ||
3119        op_code == OP_NOT || op_code == OP_NOTI)
3120    {    {
   case OP_CHAR:  
3121  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3122    GETCHARTEST(c, previous);    GETCHARTEST(c, previous);
3123  #else  #else
3124    c = *previous;    c = *previous;
3125  #endif  #endif
3126    return c != next;    }
3127    
3128    /* For CHARI (caseless character) we must check the other case. If we have  /* Now compare the next item with the previous opcode. First, handle cases when
3129    Unicode property support, we can use it to test the other case of  the next item is a character. */
   high-valued characters. */  
3130    
3131    case OP_CHARI:  if (next >= 0)
3132  #ifdef SUPPORT_UTF    {
3133    GETCHARTEST(c, previous);    /* For a caseless UTF match, the next character may have more than one other
3134  #else    case, which maps to the special PT_CLIST property. Check this first. */
3135    c = *previous;  
 #endif  
   if (c == next) return FALSE;  
 #ifdef SUPPORT_UTF  
   if (utf)  
     {  
     unsigned int othercase;  
     if (next < 128) othercase = cd->fcc[next]; else  
3136  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3137      othercase = UCD_OTHERCASE((unsigned int)next);    if (utf && (unsigned int)c != NOTACHAR && (options & PCRE_CASELESS) != 0)
3138  #else      {
3139      othercase = NOTACHAR;      int ocs = UCD_CASESET(next);
3140  #endif      if (ocs > 0) return check_char_prop(c, PT_CLIST, ocs, op_code >= OP_NOT);
     return (unsigned int)c != othercase;  
3141      }      }
   else  
 #endif  /* SUPPORT_UTF */  
   return (c != TABLE_GET((unsigned int)next, cd->fcc, next));  /* Non-UTF-8 mode */  
   
   case OP_NOT:  
 #ifdef SUPPORT_UTF  
   GETCHARTEST(c, previous);  
 #else  
   c = *previous;  
3142  #endif  #endif
   return c == next;  
3143    
3144    case OP_NOTI:    switch(op_code)
3145        {
3146        case OP_CHAR:
3147        return c != next;
3148    
3149        /* For CHARI (caseless character) we must check the other case. If we have
3150        Unicode property support, we can use it to test the other case of
3151        high-valued characters. We know that next can have only one other case,
3152        because multi-other-case characters are dealt with above. */
3153    
3154        case OP_CHARI:
3155        if (c == next) return FALSE;
3156  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3157    GETCHARTEST(c, previous);      if (utf)
3158          {
3159          unsigned int othercase;
3160          if (next < 128) othercase = cd->fcc[next]; else
3161    #ifdef SUPPORT_UCP
3162          othercase = UCD_OTHERCASE((unsigned int)next);
3163  #else  #else
3164    c = *previous;        othercase = NOTACHAR;
3165  #endif  #endif
3166    if (c == next) return TRUE;        return (unsigned int)c != othercase;
3167          }
3168        else
3169    #endif  /* SUPPORT_UTF */
3170        return (c != TABLE_GET((unsigned int)next, cd->fcc, next));  /* Not UTF */
3171    
3172        case OP_NOT:
3173        return c == next;
3174    
3175        case OP_NOTI:
3176        if (c == next) return TRUE;
3177  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3178    if (utf)      if (utf)
3179      {        {
3180      unsigned int othercase;        unsigned int othercase;
3181      if (next < 128) othercase = cd->fcc[next]; else        if (next < 128) othercase = cd->fcc[next]; else
3182  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3183      othercase = UCD_OTHERCASE((unsigned int)next);        othercase = UCD_OTHERCASE((unsigned int)next);
3184  #else  #else
3185      othercase = NOTACHAR;        othercase = NOTACHAR;
3186  #endif  #endif
3187      return (unsigned int)c == othercase;        return (unsigned int)c == othercase;
3188      }        }
3189    else      else
3190  #endif  /* SUPPORT_UTF */  #endif  /* SUPPORT_UTF */
3191    return (c == TABLE_GET((unsigned int)next, cd->fcc, next));  /* Non-UTF-8 mode */      return (c == TABLE_GET((unsigned int)next, cd->fcc, next));  /* Not UTF */
3192    
3193    /* Note that OP_DIGIT etc. are generated only when PCRE_UCP is *not* set.      /* Note that OP_DIGIT etc. are generated only when PCRE_UCP is *not* set.
3194    When it is set, \d etc. are converted into OP_(NOT_)PROP codes. */      When it is set, \d etc. are converted into OP_(NOT_)PROP codes. */
3195    
3196    case OP_DIGIT:      case OP_DIGIT:
3197    return next > 255 || (cd->ctypes[next] & ctype_digit) == 0;      return next > 255 || (cd->ctypes[next] & ctype_digit) == 0;
3198    
3199    case OP_NOT_DIGIT:      case OP_NOT_DIGIT:
3200    return next <= 255 && (cd->ctypes[next] & ctype_digit) != 0;      return next <= 255 && (cd->ctypes[next] & ctype_digit) != 0;
3201    
3202    case OP_WHITESPACE:      case OP_WHITESPACE:
3203    return next > 255 || (cd->ctypes[next] & ctype_space) == 0;      return next > 255 || (cd->ctypes[next] & ctype_space) == 0;
3204    
3205    case OP_NOT_WHITESPACE:      case OP_NOT_WHITESPACE:
3206    return next <= 255 && (cd->ctypes[next] & ctype_space) != 0;      return next <= 255 && (cd->ctypes[next] & ctype_space) != 0;
3207    
3208    case OP_WORDCHAR:      case OP_WORDCHAR:
3209    return next > 255 || (cd->ctypes[next] & ctype_word) == 0;      return next > 255 || (cd->ctypes[next] & ctype_word) == 0;
3210    
3211    case OP_NOT_WORDCHAR:      case OP_NOT_WORDCHAR:
3212    return next <= 255 && (cd->ctypes[next] & ctype_word) != 0;      return next <= 255 && (cd->ctypes[next] & ctype_word) != 0;
3213    
3214    case OP_HSPACE:      case OP_HSPACE:
3215    case OP_NOT_HSPACE:      case OP_NOT_HSPACE:
3216    switch(next)      switch(next)
3217      {        {
3218      HSPACE_CASES:        HSPACE_CASES:
3219      return op_code == OP_NOT_HSPACE;        return op_code == OP_NOT_HSPACE;
   
     default:  
     return op_code != OP_NOT_HSPACE;  
     }  
3220    
3221    case OP_ANYNL:        default:
3222    case OP_VSPACE:        return op_code != OP_NOT_HSPACE;
3223    case OP_NOT_VSPACE:        }
3224    switch(next)  
3225      {      case OP_ANYNL:
3226      VSPACE_CASES:      case OP_VSPACE:
3227      return op_code == OP_NOT_VSPACE;      case OP_NOT_VSPACE:
3228        switch(next)
3229      default:        {
3230      return op_code != OP_NOT_VSPACE;        VSPACE_CASES:
3231      }        return op_code == OP_NOT_VSPACE;
3232    
3233          default:
3234          return op_code != OP_NOT_VSPACE;
3235          }
3236    
3237  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3238    case OP_PROP:      case OP_PROP:
3239    return check_char_prop(next, previous[0], previous[1], FALSE);      return check_char_prop(next, previous[0], previous[1], FALSE);
3240    
3241    case OP_NOTPROP:      case OP_NOTPROP:
3242    return check_char_prop(next, previous[0], previous[1], TRUE);      return check_char_prop(next, previous[0], previous[1], TRUE);
3243  #endif  #endif
3244    
3245    default:      default:
3246    return FALSE;      return FALSE;
3247        }
3248    }    }
3249    
   
3250  /* Handle the case when the next item is \d, \s, etc. Note that when PCRE_UCP  /* Handle the case when the next item is \d, \s, etc. Note that when PCRE_UCP
3251  is set, \d turns into ESC_du rather than ESC_d, etc., so ESC_d etc. are  is set, \d turns into ESC_du rather than ESC_d, etc., so ESC_d etc. are
3252  generated only when PCRE_UCP is *not* set, that is, when only ASCII  generated only when PCRE_UCP is *not* set, that is, when only ASCII
# Line 3230  switch(op_code) Line 3257  switch(op_code)
3257    {    {
3258    case OP_CHAR:    case OP_CHAR:
3259    case OP_CHARI:    case OP_CHARI:
 #ifdef SUPPORT_UTF  
   GETCHARTEST(c, previous);  
 #else  
   c = *previous;  
 #endif  
3260    switch(-next)    switch(-next)
3261      {      {
3262      case ESC_d:      case ESC_d:
# Line 3261  switch(op_code) Line 3283  switch(op_code)
3283        {        {
3284        HSPACE_CASES:        HSPACE_CASES:
3285        return -next != ESC_h;        return -next != ESC_h;
3286    
3287        default:        default:
3288        return -next == ESC_h;        return -next == ESC_h;
3289        }        }
# Line 3272  switch(op_code) Line 3294  switch(op_code)
3294        {        {
3295        VSPACE_CASES:        VSPACE_CASES:
3296        return -next != ESC_v;        return -next != ESC_v;
3297    
3298        default:        default:
3299        return -next == ESC_v;        return -next == ESC_v;
3300        }        }
# Line 3399  Returns:        the number of < 256 char Line 3421  Returns:        the number of < 256 char
3421    
3422  static int  static int
3423  add_to_class(pcre_uint8 *classbits, pcre_uchar **uchardptr, int options,  add_to_class(pcre_uint8 *classbits, pcre_uchar **uchardptr, int options,
3424    compile_data *cd, unsigned int start, unsigned int end)    compile_data *cd, pcre_uint32 start, pcre_uint32 end)
3425  {  {
3426  unsigned int c;  pcre_uint32 c;
3427  int n8 = 0;  int n8 = 0;
3428    
3429  /* If caseless matching is required, scan the range and process alternate  /* If caseless matching is required, scan the range and process alternate
# Line 3415  if ((options & PCRE_CASELESS) != 0) Line 3437  if ((options & PCRE_CASELESS) != 0)
3437    if ((options & PCRE_UTF8) != 0)    if ((options & PCRE_UTF8) != 0)
3438      {      {
3439      int rc;      int rc;
3440      unsigned int oc, od;      pcre_uint32 oc, od;
3441    
3442      options &= ~PCRE_CASELESS;   /* Remove for recursive calls */      options &= ~PCRE_CASELESS;   /* Remove for recursive calls */
3443      c = start;      c = start;
# Line 3456  if ((options & PCRE_CASELESS) != 0) Line 3478  if ((options & PCRE_CASELESS) != 0)
3478  length - this means that the same lists of (e.g.) horizontal spaces can be used  length - this means that the same lists of (e.g.) horizontal spaces can be used
3479  in all cases. */  in all cases. */
3480    
3481  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
3482  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3483    if ((options & PCRE_UTF8) == 0)    if ((options & PCRE_UTF8) == 0)
3484  #endif  #endif
3485    if (end > 0xff) end = 0xff;    if (end > 0xff) end = 0xff;
 #endif  
3486    
3487  #ifdef COMPILE_PCRE16  #elif defined COMPILE_PCRE16
3488  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3489    if ((options & PCRE_UTF16) == 0)    if ((options & PCRE_UTF16) == 0)
3490  #endif  #endif
3491    if (end > 0xffff) end = 0xffff;    if (end > 0xffff) end = 0xffff;
3492  #endif  
3493    #endif /* COMPILE_PCRE[8|16] */
3494    
3495  /* If all characters are less than 256, use the bit map. Otherwise use extra  /* If all characters are less than 256, use the bit map. Otherwise use extra
3496  data. */  data. */
# Line 3598  static int Line 3620  static int
3620  add_not_list_to_class(pcre_uint8 *classbits, pcre_uchar **uchardptr,  add_not_list_to_class(pcre_uint8 *classbits, pcre_uchar **uchardptr,
3621    int options, compile_data *cd, const pcre_uint32 *p)    int options, compile_data *cd, const pcre_uint32 *p)
3622  {  {
3623    BOOL utf = (options & PCRE_UTF8) != 0;
3624  int n8 = 0;  int n8 = 0;
3625  if (p[0] > 0)  if (p[0] > 0)
3626    n8 += add_to_class(classbits, uchardptr, options, cd, 0, p[0] - 1);    n8 += add_to_class(classbits, uchardptr, options, cd, 0, p[0] - 1);
3627  while (p[0] < NOTACHAR)  while (p[0] < NOTACHAR)
3628    {    {
3629    while (p[1] == p[0] + 1) p++;    while (p[1] == p[0] + 1) p++;
3630    n8 += add_to_class(classbits, uchardptr, options, cd, p[0] + 1,    n8 += add_to_class(classbits, uchardptr, options, cd, p[0] + 1,
3631      (p[1] == NOTACHAR)? 0x10ffff : p[1] - 1);      (p[1] == NOTACHAR) ? (utf ? 0x10ffffu : 0xffffffffu) : p[1] - 1);
3632    p++;    p++;
3633    }    }
3634  return n8;  return n8;
# Line 3676  must not do this for other options (e.g. Line 3699  must not do this for other options (e.g.
3699  dynamically as we process the pattern. */  dynamically as we process the pattern. */
3700    
3701  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3702  /* PCRE_UTF16 has the same value as PCRE_UTF8. */  /* PCRE_UTF(16|32) have the same value as PCRE_UTF8. */
3703  BOOL utf = (options & PCRE_UTF8) != 0;  BOOL utf = (options & PCRE_UTF8) != 0;
3704  pcre_uchar utf_chars[6];  pcre_uchar utf_chars[6];
3705  #else  #else
3706  BOOL utf = FALSE;  BOOL utf = FALSE;
3707  #endif  #endif
3708    
3709  /* Helper variables for OP_XCLASS opcode (for characters > 255). */  /* Helper variables for OP_XCLASS opcode (for characters > 255). We define
3710    class_uchardata always so that it can be passed to add_to_class() always,
3711    though it will not be used in non-UTF 8-bit cases. This avoids having to supply
3712    alternative calls for the different cases. */
3713    
3714    pcre_uchar *class_uchardata;
3715  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3716  BOOL xclass;  BOOL xclass;
 pcre_uchar *class_uchardata;  
3717  pcre_uchar *class_uchardata_base;  pcre_uchar *class_uchardata_base;
3718  #endif  #endif
3719    
# Line 4058  for (;; ptr++) Line 4084  for (;; ptr++)
4084        {        {
4085        const pcre_uchar *oldptr;        const pcre_uchar *oldptr;
4086    
4087  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
4088        if (utf && HAS_EXTRALEN(c))        if (utf && HAS_EXTRALEN(c))
4089          {                           /* Braces are required because the */          {                           /* Braces are required because the */
4090          GETCHARLEN(c, ptr, ptr);    /* macro generates multiple statements */          GETCHARLEN(c, ptr, ptr);    /* macro generates multiple statements */
# Line 4133  for (;; ptr++) Line 4159  for (;; ptr++)
4159          alpha. This relies on the fact that the class table starts with          alpha. This relies on the fact that the class table starts with
4160          alpha, lower, upper as the first 3 entries. */          alpha, lower, upper as the first 3 entries. */
4161    
4162          if ((options & PCRE_CASELESS) != 0 && posix_class <= 2)          if ((options & PCRE_CASELESS) != 0 && posix_class <= 2)
4163            posix_class = 0;            posix_class = 0;
4164    
4165          /* When PCRE_UCP is set, some of the POSIX classes are converted to          /* When PCRE_UCP is set, some of the POSIX classes are converted to
# Line 4476  for (;; ptr++) Line 4502  for (;; ptr++)
4502    
4503          if (negate_class)          if (negate_class)
4504            {            {
4505    #ifdef SUPPORT_UCP
4506                // FIXMEchpe pcreuint32?
4507              int d;
4508    #endif
4509            if (firstchar == REQ_UNSET) firstchar = REQ_NONE;            if (firstchar == REQ_UNSET) firstchar = REQ_NONE;
4510            zerofirstchar = firstchar;            zerofirstchar = firstchar;
4511            *code++ = ((options & PCRE_CASELESS) != 0)? OP_NOTI: OP_NOT;  
4512  #ifdef SUPPORT_UTF            /* For caseless UTF-8 mode when UCP support is available, check
4513            if (utf && c > MAX_VALUE_FOR_SINGLE_CHAR)            whether this character has more than one other case. If so, generate
4514              code += PRIV(ord2utf)(c, code);            a special OP_NOTPROP item instead of OP_NOTI. */
4515            else  
4516    #ifdef SUPPORT_UCP
4517              if (utf && (options & PCRE_CASELESS) != 0 &&
4518                  (d = UCD_CASESET(c)) != 0)
4519                {
4520                *code++ = OP_NOTPROP;
4521                *code++ = PT_CLIST;
4522                *code++ = d;
4523                }
4524              else
4525  #endif  #endif
4526              *code++ = c;            /* Char has only one other case, or UCP not available */
4527            goto NOT_CHAR;  
4528                {
4529                *code++ = ((options & PCRE_CASELESS) != 0)? OP_NOTI: OP_NOT;
4530    #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
4531                if (utf && c > MAX_VALUE_FOR_SINGLE_CHAR)
4532                  code += PRIV(ord2utf)(c, code);
4533                else
4534    #endif
4535                  *code++ = c;
4536                }
4537    
4538              /* We are finished with this character class */
4539    
4540              goto END_CLASS;
4541            }            }
4542    
4543          /* For a single, positive character, get the value into mcbuffer, and          /* For a single, positive character, get the value into mcbuffer, and
4544          then we can handle this with the normal one-character code. */          then we can handle this with the normal one-character code. */
4545    
4546  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
4547          if (utf && c > MAX_VALUE_FOR_SINGLE_CHAR)          if (utf && c > MAX_VALUE_FOR_SINGLE_CHAR)
4548            mclength = PRIV(ord2utf)(c, mcbuffer);            mclength = PRIV(ord2utf)(c, mcbuffer);
4549          else          else
# Line 4601  for (;; ptr++) Line 4653  for (;; ptr++)
4653        memcpy(code, classbits, 32);        memcpy(code, classbits, 32);
4654        }        }
4655      code += 32 / sizeof(pcre_uchar);      code += 32 / sizeof(pcre_uchar);
4656      NOT_CHAR:  
4657        END_CLASS:
4658      break;      break;
4659    
4660    
# Line 4725  for (;; ptr++) Line 4778  for (;; ptr++)
4778        hold the length of the character in bytes, plus UTF_LENGTH to flag that        hold the length of the character in bytes, plus UTF_LENGTH to flag that
4779        it's a length rather than a small character. */        it's a length rather than a small character. */
4780    
4781  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
4782        if (utf && NOT_FIRSTCHAR(code[-1]))        if (utf && NOT_FIRSTCHAR(code[-1]))
4783          {          {
4784          pcre_uchar *lastchar = code - 1;          pcre_uchar *lastchar = code - 1;
# Line 4861  for (;; ptr++) Line 4914  for (;; ptr++)
4914    
4915          if (repeat_max < 0)          if (repeat_max < 0)
4916            {            {
4917  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
4918            if (utf && (c & UTF_LENGTH) != 0)            if (utf && (c & UTF_LENGTH) != 0)
4919              {              {
4920              memcpy(code, utf_chars, IN_UCHARS(c & 7));              memcpy(code, utf_chars, IN_UCHARS(c & 7));
# Line 4886  for (;; ptr++) Line 4939  for (;; ptr++)
4939    
4940          else if (repeat_max != repeat_min)          else if (repeat_max != repeat_min)
4941            {            {
4942  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
4943            if (utf && (c & UTF_LENGTH) != 0)            if (utf && (c & UTF_LENGTH) != 0)
4944              {              {
4945              memcpy(code, utf_chars, IN_UCHARS(c & 7));              memcpy(code, utf_chars, IN_UCHARS(c & 7));
# Line 4916  for (;; ptr++) Line 4969  for (;; ptr++)
4969    
4970        /* The character or character type itself comes last in all cases. */        /* The character or character type itself comes last in all cases. */
4971    
4972  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
4973        if (utf && (c & UTF_LENGTH) != 0)        if (utf && (c & UTF_LENGTH) != 0)
4974          {          {
4975          memcpy(code, utf_chars, IN_UCHARS(c & 7));          memcpy(code, utf_chars, IN_UCHARS(c & 7));
# Line 5403  for (;; ptr++) Line 5456  for (;; ptr++)
5456        else if (*tempcode == OP_EXACT || *tempcode == OP_NOTEXACT)        else if (*tempcode == OP_EXACT || *tempcode == OP_NOTEXACT)
5457          {          {
5458          tempcode += PRIV(OP_lengths)[*tempcode];          tempcode += PRIV(OP_lengths)[*tempcode];
5459  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
5460          if (utf && HAS_EXTRALEN(tempcode[-1]))          if (utf && HAS_EXTRALEN(tempcode[-1]))
5461            tempcode += GET_EXTRALEN(tempcode[-1]);            tempcode += GET_EXTRALEN(tempcode[-1]);
5462  #endif  #endif
# Line 5501  for (;; ptr++) Line 5554  for (;; ptr++)
5554          arg = ++ptr;          arg = ++ptr;
5555          while (*ptr != 0 && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;          while (*ptr != 0 && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
5556          arglen = (int)(ptr - arg);          arglen = (int)(ptr - arg);
5557          if (arglen > (int)MAX_MARK)          if ((unsigned int)arglen > MAX_MARK)
5558            {            {
5559            *errorcodeptr = ERR75;            *errorcodeptr = ERR75;
5560            goto FAILED;            goto FAILED;
# Line 6803  for (;; ptr++) Line 6856  for (;; ptr++)
6856      a value > 127. We set its representation in the length/buffer, and then      a value > 127. We set its representation in the length/buffer, and then
6857      handle it as a data character. */      handle it as a data character. */
6858    
6859  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
6860      if (utf && c > MAX_VALUE_FOR_SINGLE_CHAR)      if (utf && c > MAX_VALUE_FOR_SINGLE_CHAR)
6861        mclength = PRIV(ord2utf)(c, mcbuffer);        mclength = PRIV(ord2utf)(c, mcbuffer);
6862      else      else
# Line 6826  for (;; ptr++) Line 6879  for (;; ptr++)
6879      mclength = 1;      mclength = 1;
6880      mcbuffer[0] = c;      mcbuffer[0] = c;
6881    
6882  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
6883      if (utf && HAS_EXTRALEN(c))      if (utf && HAS_EXTRALEN(c))
6884        ACROSSCHAR(TRUE, ptr[1], mcbuffer[mclength++] = *(++ptr));        ACROSSCHAR(TRUE, ptr[1], mcbuffer[mclength++] = *(++ptr));
6885  #endif  #endif
# Line 6836  for (;; ptr++) Line 6889  for (;; ptr++)
6889    
6890      ONE_CHAR:      ONE_CHAR:
6891      previous = code;      previous = code;
6892    
6893        /* For caseless UTF-8 mode when UCP support is available, check whether
6894        this character has more than one other case. If so, generate a special
6895        OP_PROP item instead of OP_CHARI. */
6896    
6897    #ifdef SUPPORT_UCP
6898        if (utf && (options & PCRE_CASELESS) != 0)
6899          {
6900          GETCHAR(c, mcbuffer);
6901          if ((c = UCD_CASESET(c)) != 0)
6902            {
6903            *code++ = OP_PROP;
6904            *code++ = PT_CLIST;
6905            *code++ = c;
6906            if (firstchar == REQ_UNSET) firstchar = zerofirstchar = REQ_NONE;
6907            break;
6908            }
6909          }
6910    #endif
6911    
6912        /* Caseful matches, or not one of the multicase characters. */
6913    
6914      *code++ = ((options & PCRE_CASELESS) != 0)? OP_CHARI : OP_CHAR;      *code++ = ((options & PCRE_CASELESS) != 0)? OP_CHARI : OP_CHAR;
6915      for (c = 0; c < mclength; c++) *code++ = mcbuffer[c];      for (c = 0; c < mclength; c++) *code++ = mcbuffer[c];
6916    
# Line 7535  Returns:        pointer to compiled data Line 7610  Returns:        pointer to compiled data
7610                  with errorptr and erroroffset set                  with errorptr and erroroffset set
7611  */  */
7612    
7613  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
7614  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION
7615  pcre_compile(const char *pattern, int options, const char **errorptr,  pcre_compile(const char *pattern, int options, const char **errorptr,
7616    int *erroroffset, const unsigned char *tables)    int *erroroffset, const unsigned char *tables)
7617  #else  #elif defined COMPILE_PCRE16
7618  PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION  PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION
7619  pcre16_compile(PCRE_SPTR16 pattern, int options, const char **errorptr,  pcre16_compile(PCRE_SPTR16 pattern, int options, const char **errorptr,
7620    int *erroroffset, const unsigned char *tables)    int *erroroffset, const unsigned char *tables)
7621    #elif defined COMPILE_PCRE32
7622    PCRE_EXP_DEFN pcre32 * PCRE_CALL_CONVENTION
7623    pcre32_compile(PCRE_SPTR32 pattern, int options, const char **errorptr,
7624      int *erroroffset, const unsigned char *tables)
7625  #endif  #endif
7626  {  {
7627  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
7628  return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables);  return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables);
7629  #else  #elif defined COMPILE_PCRE16
7630  return pcre16_compile2(pattern, options, NULL, errorptr, erroroffset, tables);  return pcre16_compile2(pattern, options, NULL, errorptr, erroroffset, tables);
7631    #elif defined COMPILE_PCRE32
7632    return pcre32_compile2(pattern, options, NULL, errorptr, erroroffset, tables);
7633  #endif  #endif
7634  }  }
7635    
7636    
7637  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
7638  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION
7639  pcre_compile2(const char *pattern, int options, int *errorcodeptr,  pcre_compile2(const char *pattern, int options, int *errorcodeptr,
7640    const char **errorptr, int *erroroffset, const unsigned char *tables)    const char **errorptr, int *erroroffset, const unsigned char *tables)
7641  #else  #elif defined COMPILE_PCRE16
7642  PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION  PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION
7643  pcre16_compile2(PCRE_SPTR16 pattern, int options, int *errorcodeptr,  pcre16_compile2(PCRE_SPTR16 pattern, int options, int *errorcodeptr,
7644    const char **errorptr, int *erroroffset, const unsigned char *tables)    const char **errorptr, int *erroroffset, const unsigned char *tables)
7645    #elif defined COMPILE_PCRE32
7646    PCRE_EXP_DEFN pcre32 * PCRE_CALL_CONVENTION
7647    pcre32_compile2(PCRE_SPTR32 pattern, int options, int *errorcodeptr,
7648      const char **errorptr, int *erroroffset, const unsigned char *tables)
7649  #endif  #endif
7650  {  {
7651  REAL_PCRE *re;  REAL_PCRE *re;
# Line 7646  while (ptr[skipatstart] == CHAR_LEFT_PAR Line 7731  while (ptr[skipatstart] == CHAR_LEFT_PAR
7731    if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UTF_RIGHTPAR, 6) == 0)    if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UTF_RIGHTPAR, 6) == 0)
7732      { skipatstart += 8; options |= PCRE_UTF16; continue; }      { skipatstart += 8; options |= PCRE_UTF16; continue; }
7733  #endif  #endif
7734    #ifdef COMPILE_PCRE32
7735      if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UTF_RIGHTPAR, 6) == 0)
7736        { skipatstart += 8; options |= PCRE_UTF32; continue; }
7737    #endif
7738    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UCP_RIGHTPAR, 4) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UCP_RIGHTPAR, 4) == 0)
7739      { skipatstart += 6; options |= PCRE_UCP; continue; }      { skipatstart += 6; options |= PCRE_UCP; continue; }
7740    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_NO_START_OPT_RIGHTPAR, 13) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_NO_START_OPT_RIGHTPAR, 13) == 0)
# Line 7674  while (ptr[skipatstart] == CHAR_LEFT_PAR Line 7763  while (ptr[skipatstart] == CHAR_LEFT_PAR
7763    else break;    else break;
7764    }    }
7765    
7766  /* PCRE_UTF16 has the same value as PCRE_UTF8. */  /* PCRE_UTF(16|32) have the same value as PCRE_UTF8. */
7767  utf = (options & PCRE_UTF8) != 0;  utf = (options & PCRE_UTF8) != 0;
7768    
7769  /* Can't support UTF unless PCRE has been compiled to include the code. The  /* Can't support UTF unless PCRE has been compiled to include the code. The
# Line 7686  not used here. */ Line 7775  not used here. */
7775  if (utf && (options & PCRE_NO_UTF8_CHECK) == 0 &&  if (utf && (options & PCRE_NO_UTF8_CHECK) == 0 &&
7776       (errorcode = PRIV(valid_utf)((PCRE_PUCHAR)pattern, -1, erroroffset)) != 0)       (errorcode = PRIV(valid_utf)((PCRE_PUCHAR)pattern, -1, erroroffset)) != 0)
7777    {    {
7778  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
7779    errorcode = ERR44;    errorcode = ERR44;
7780  #else  #elif defined COMPILE_PCRE16
7781    errorcode = ERR74;    errorcode = ERR74;
7782    #elif defined COMPILE_PCRE32
7783      errorcode = ERR77;
7784  #endif  #endif
7785    goto PCRE_EARLY_ERROR_RETURN2;    goto PCRE_EARLY_ERROR_RETURN2;
7786    }    }
# Line 7853  re->name_count = cd->names_found; Line 7944  re->name_count = cd->names_found;
7944  re->ref_count = 0;  re->ref_count = 0;
7945  re->tables = (tables == PRIV(default_tables))? NULL : tables;  re->tables = (tables == PRIV(default_tables))? NULL : tables;
7946  re->nullpad = NULL;  re->nullpad = NULL;
7947    #ifdef COMPILE_PCRE32
7948    re->dummy1 = re->dummy2 = 0;
7949    #endif
7950    
7951  /* The starting points of the name/number translation table and of the code are  /* The starting points of the name/number translation table and of the code are
7952  passed around in the compile data block. The start/end pattern and initial  passed around in the compile data block. The start/end pattern and initial
# Line 8015  if ((re->options & PCRE_ANCHORED) == 0) Line 8109  if ((re->options & PCRE_ANCHORED) == 0)
8109        firstchar = find_firstassertedchar(codestart, FALSE);        firstchar = find_firstassertedchar(codestart, FALSE);
8110      if (firstchar >= 0)   /* Remove caseless flag for non-caseable chars */      if (firstchar >= 0)   /* Remove caseless flag for non-caseable chars */
8111        {        {
8112  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8113        re->first_char = firstchar & 0xff;        re->first_char = firstchar & 0xff;
8114  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
8115        re->first_char = firstchar & 0xffff;        re->first_char = firstchar & 0xffff;
8116  #endif  #elif defined COMPILE_PCRE32
8117          re->first_char = firstchar & ~REQ_MASK;
8118  #endif  #endif
8119        if ((firstchar & REQ_CASELESS) != 0)        if ((firstchar & REQ_CASELESS) != 0)
8120          {          {
# Line 8057  bytes. */ Line 8151  bytes. */
8151  if (reqchar >= 0 &&  if (reqchar >= 0 &&
8152       ((re->options & PCRE_ANCHORED) == 0 || (reqchar & REQ_VARY) != 0))       ((re->options & PCRE_ANCHORED) == 0 || (reqchar & REQ_VARY) != 0))
8153    {    {
8154  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8155    re->req_char = reqchar & 0xff;    re->req_char = reqchar & 0xff;
8156  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
8157    re->req_char = reqchar & 0xffff;    re->req_char = reqchar & 0xffff;
8158  #endif  #elif defined COMPILE_PCRE32
8159      re->req_char = reqchar & ~REQ_MASK;
8160  #endif  #endif
8161    if ((reqchar & REQ_CASELESS) != 0)    if ((reqchar & REQ_CASELESS) != 0)
8162      {      {
# Line 8114  if ((re->flags & PCRE_REQCHSET) != 0) Line 8208  if ((re->flags & PCRE_REQCHSET) != 0)
8208      else printf("Req char = \\x%02x%s\n", ch, caseless);      else printf("Req char = \\x%02x%s\n", ch, caseless);
8209    }    }
8210    
8211  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8212  pcre_printint((pcre *)re, stdout, TRUE);  pcre_printint((pcre *)re, stdout, TRUE);
8213  #else  #elif defined COMPILE_PCRE16
8214  pcre16_printint((pcre *)re, stdout, TRUE);  pcre16_printint((pcre *)re, stdout, TRUE);
8215    #elif defined COMPILE_PCRE32
8216    pcre32_printint((pcre *)re, stdout, TRUE);
8217  #endif  #endif
8218    
8219  /* This check is done here in the debugging case so that the code that  /* This check is done here in the debugging case so that the code that
# Line 8133  if (code - codestart > length) Line 8229  if (code - codestart > length)
8229    }    }
8230  #endif   /* PCRE_DEBUG */  #endif   /* PCRE_DEBUG */
8231    
8232  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8233  return (pcre *)re;  return (pcre *)re;
8234  #else  #elif defined COMPILE_PCRE16
8235  return (pcre16 *)re;  return (pcre16 *)re;
8236    #elif defined COMPILE_PCRE32
8237    return (pcre32 *)re;
8238  #endif  #endif
8239  }  }
8240    

Legend:
Removed from v.1045  
changed lines
  Added in v.1056

  ViewVC Help
Powered by ViewVC 1.1.5