/[pcre]/code/tags/pcre-8.33/pcre_compile.c
ViewVC logotype

Diff of /code/tags/pcre-8.33/pcre_compile.c

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

revision 1046 by ph10, Tue Sep 25 16:27:58 2012 UTC revision 1047 by zherczeg, Fri Sep 28 15:06:38 2012 UTC
# Line 2996  switch(ptype) Line 2996  switch(ptype)
2996            PRIV(ucp_gentype)[prop->chartype] == ucp_N ||            PRIV(ucp_gentype)[prop->chartype] == ucp_N ||
2997            c == CHAR_UNDERSCORE) == negated;            c == CHAR_UNDERSCORE) == negated;
2998    
2999  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3000    case PT_CLIST:    case PT_CLIST:
3001    p = PRIV(ucd_caseless_sets) + prop->caseset;    p = PRIV(ucd_caseless_sets) + prop->caseset;
3002    for (;;)    for (;;)
3003      {      {
3004      if ((unsigned int)c < *p) return !negated;      if ((unsigned int)c < *p) return !negated;
3005      if ((unsigned int)c == *p++) return negated;      if ((unsigned int)c == *p++) return negated;
3006      }      }
3007    break;  /* Control never reaches here */    break;  /* Control never reaches here */
3008  #endif  #endif
3009    }    }
3010    
3011  return FALSE;  return FALSE;
3012  }  }
3013  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
# Line 3109  if ((options & PCRE_EXTENDED) != 0) Line 3109  if ((options & PCRE_EXTENDED) != 0)
3109  if (*ptr == CHAR_ASTERISK || *ptr == CHAR_QUESTION_MARK ||  if (*ptr == CHAR_ASTERISK || *ptr == CHAR_QUESTION_MARK ||
3110    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)
3111      return FALSE;      return FALSE;
3112    
3113  /* If the previous item is a character, get its value. */  /* If the previous item is a character, get its value. */
3114    
3115  if (op_code == OP_CHAR || op_code == OP_CHARI ||  if (op_code == OP_CHAR || op_code == OP_CHARI ||
3116      op_code == OP_NOT || op_code == OP_NOTI)      op_code == OP_NOT || op_code == OP_NOTI)
3117    {    {
3118  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3119    GETCHARTEST(c, previous);    GETCHARTEST(c, previous);
3120  #else  #else
# Line 3133  if (next >= 0) Line 3133  if (next >= 0)
3133      {      {
3134      int ocs = UCD_CASESET(next);      int ocs = UCD_CASESET(next);
3135      if (ocs > 0) return check_char_prop(c, PT_CLIST, ocs, FALSE);      if (ocs > 0) return check_char_prop(c, PT_CLIST, ocs, FALSE);
3136      }      }
3137  #endif  #endif
3138    
3139    switch(op_code)    switch(op_code)
3140      {      {
3141      case OP_CHAR:      case OP_CHAR:
3142      return c != next;      return c != next;
3143    
3144      /* For CHARI (caseless character) we must check the other case. If we have      /* For CHARI (caseless character) we must check the other case. If we have
3145      Unicode property support, we can use it to test the other case of      Unicode property support, we can use it to test the other case of
3146      high-valued characters. We know that next can have only one other case,      high-valued characters. We know that next can have only one other case,
3147      because multi-other-case characters are dealt with above. */      because multi-other-case characters are dealt with above. */
3148    
3149      case OP_CHARI:      case OP_CHARI:
3150      if (c == next) return FALSE;      if (c == next) return FALSE;
3151  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
# Line 3184  if (next >= 0) Line 3184  if (next >= 0)
3184      else      else
3185  #endif  /* SUPPORT_UTF */  #endif  /* SUPPORT_UTF */
3186      return (c == TABLE_GET((unsigned int)next, cd->fcc, next));  /* Not UTF */      return (c == TABLE_GET((unsigned int)next, cd->fcc, next));  /* Not UTF */
3187    
3188      /* 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.
3189      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. */
3190    
3191      case OP_DIGIT:      case OP_DIGIT:
3192      return next > 255 || (cd->ctypes[next] & ctype_digit) == 0;      return next > 255 || (cd->ctypes[next] & ctype_digit) == 0;
3193    
3194      case OP_NOT_DIGIT:      case OP_NOT_DIGIT:
3195      return next <= 255 && (cd->ctypes[next] & ctype_digit) != 0;      return next <= 255 && (cd->ctypes[next] & ctype_digit) != 0;
3196    
3197      case OP_WHITESPACE:      case OP_WHITESPACE:
3198      return next > 255 || (cd->ctypes[next] & ctype_space) == 0;      return next > 255 || (cd->ctypes[next] & ctype_space) == 0;
3199    
3200      case OP_NOT_WHITESPACE:      case OP_NOT_WHITESPACE:
3201      return next <= 255 && (cd->ctypes[next] & ctype_space) != 0;      return next <= 255 && (cd->ctypes[next] & ctype_space) != 0;
3202    
3203      case OP_WORDCHAR:      case OP_WORDCHAR:
3204      return next > 255 || (cd->ctypes[next] & ctype_word) == 0;      return next > 255 || (cd->ctypes[next] & ctype_word) == 0;
3205    
3206      case OP_NOT_WORDCHAR:      case OP_NOT_WORDCHAR:
3207      return next <= 255 && (cd->ctypes[next] & ctype_word) != 0;      return next <= 255 && (cd->ctypes[next] & ctype_word) != 0;
3208    
3209      case OP_HSPACE:      case OP_HSPACE:
3210      case OP_NOT_HSPACE:      case OP_NOT_HSPACE:
3211      switch(next)      switch(next)
3212        {        {
3213        HSPACE_CASES:        HSPACE_CASES:
3214        return op_code == OP_NOT_HSPACE;        return op_code == OP_NOT_HSPACE;
3215    
3216        default:        default:
3217        return op_code != OP_NOT_HSPACE;        return op_code != OP_NOT_HSPACE;
3218        }        }
3219    
3220      case OP_ANYNL:      case OP_ANYNL:
3221      case OP_VSPACE:      case OP_VSPACE:
3222      case OP_NOT_VSPACE:      case OP_NOT_VSPACE:
# Line 3224  if (next >= 0) Line 3224  if (next >= 0)
3224        {        {
3225        VSPACE_CASES:        VSPACE_CASES:
3226        return op_code == OP_NOT_VSPACE;        return op_code == OP_NOT_VSPACE;
3227    
3228        default:        default:
3229        return op_code != OP_NOT_VSPACE;        return op_code != OP_NOT_VSPACE;
3230        }        }
3231    
3232  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3233      case OP_PROP:      case OP_PROP:
3234      return check_char_prop(next, previous[0], previous[1], FALSE);      return check_char_prop(next, previous[0], previous[1], FALSE);
3235    
3236      case OP_NOTPROP:      case OP_NOTPROP:
3237      return check_char_prop(next, previous[0], previous[1], TRUE);      return check_char_prop(next, previous[0], previous[1], TRUE);
3238  #endif  #endif
3239    
3240      default:      default:
3241      return FALSE;      return FALSE;
3242      }      }
3243    }    }
3244    
3245  /* 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
3246  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
# Line 3278  switch(op_code) Line 3278  switch(op_code)
3278        {        {
3279        HSPACE_CASES:        HSPACE_CASES:
3280        return -next != ESC_h;        return -next != ESC_h;
3281    
3282        default:        default:
3283        return -next == ESC_h;        return -next == ESC_h;
3284        }        }
# Line 3289  switch(op_code) Line 3289  switch(op_code)
3289        {        {
3290        VSPACE_CASES:        VSPACE_CASES:
3291        return -next != ESC_v;        return -next != ESC_v;
3292    
3293        default:        default:
3294        return -next == ESC_v;        return -next == ESC_v;
3295        }        }

Legend:
Removed from v.1046  
changed lines
  Added in v.1047

  ViewVC Help
Powered by ViewVC 1.1.5