/[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 927 by ph10, Wed Feb 22 15:15:08 2012 UTC revision 962 by ph10, Fri Apr 20 17:28:23 2012 UTC
# Line 3132  if (next >= 0) switch(op_code) Line 3132  if (next >= 0) switch(op_code)
3132    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. */
3133    
3134    case OP_DIGIT:    case OP_DIGIT:
3135    return next > 127 || (cd->ctypes[next] & ctype_digit) == 0;    return next > 255 || (cd->ctypes[next] & ctype_digit) == 0;
3136    
3137    case OP_NOT_DIGIT:    case OP_NOT_DIGIT:
3138    return next <= 127 && (cd->ctypes[next] & ctype_digit) != 0;    return next <= 255 && (cd->ctypes[next] & ctype_digit) != 0;
3139    
3140    case OP_WHITESPACE:    case OP_WHITESPACE:
3141    return next > 127 || (cd->ctypes[next] & ctype_space) == 0;    return next > 255 || (cd->ctypes[next] & ctype_space) == 0;
3142    
3143    case OP_NOT_WHITESPACE:    case OP_NOT_WHITESPACE:
3144    return next <= 127 && (cd->ctypes[next] & ctype_space) != 0;    return next <= 255 && (cd->ctypes[next] & ctype_space) != 0;
3145    
3146    case OP_WORDCHAR:    case OP_WORDCHAR:
3147    return next > 127 || (cd->ctypes[next] & ctype_word) == 0;    return next > 255 || (cd->ctypes[next] & ctype_word) == 0;
3148    
3149    case OP_NOT_WORDCHAR:    case OP_NOT_WORDCHAR:
3150    return next <= 127 && (cd->ctypes[next] & ctype_word) != 0;    return next <= 255 && (cd->ctypes[next] & ctype_word) != 0;
3151    
3152    case OP_HSPACE:    case OP_HSPACE:
3153    case OP_NOT_HSPACE:    case OP_NOT_HSPACE:
# Line 3225  switch(op_code) Line 3225  switch(op_code)
3225    switch(-next)    switch(-next)
3226      {      {
3227      case ESC_d:      case ESC_d:
3228      return c > 127 || (cd->ctypes[c] & ctype_digit) == 0;      return c > 255 || (cd->ctypes[c] & ctype_digit) == 0;
3229    
3230      case ESC_D:      case ESC_D:
3231      return c <= 127 && (cd->ctypes[c] & ctype_digit) != 0;      return c <= 255 && (cd->ctypes[c] & ctype_digit) != 0;
3232    
3233      case ESC_s:      case ESC_s:
3234      return c > 127 || (cd->ctypes[c] & ctype_space) == 0;      return c > 255 || (cd->ctypes[c] & ctype_space) == 0;
3235    
3236      case ESC_S:      case ESC_S:
3237      return c <= 127 && (cd->ctypes[c] & ctype_space) != 0;      return c <= 255 && (cd->ctypes[c] & ctype_space) != 0;
3238    
3239      case ESC_w:      case ESC_w:
3240      return c > 127 || (cd->ctypes[c] & ctype_word) == 0;      return c > 255 || (cd->ctypes[c] & ctype_word) == 0;
3241    
3242      case ESC_W:      case ESC_W:
3243      return c <= 127 && (cd->ctypes[c] & ctype_word) != 0;      return c <= 255 && (cd->ctypes[c] & ctype_word) != 0;
3244    
3245      case ESC_h:      case ESC_h:
3246      case ESC_H:      case ESC_H:
# Line 3349  switch(op_code) Line 3349  switch(op_code)
3349    return next == -ESC_d;    return next == -ESC_d;
3350    
3351    case OP_WHITESPACE:    case OP_WHITESPACE:
3352    return next == -ESC_S || next == -ESC_d || next == -ESC_w || next == -ESC_R;    return next == -ESC_S || next == -ESC_d || next == -ESC_w;
3353    
3354    case OP_NOT_WHITESPACE:    case OP_NOT_WHITESPACE:
3355    return next == -ESC_s || next == -ESC_h || next == -ESC_v;    return next == -ESC_s || next == -ESC_h || next == -ESC_v || next == -ESC_R;
3356    
3357    case OP_HSPACE:    case OP_HSPACE:
3358    return next == -ESC_S || next == -ESC_H || next == -ESC_d ||    return next == -ESC_S || next == -ESC_H || next == -ESC_d ||
# Line 6852  for (;; ptr++) Line 6852  for (;; ptr++)
6852        /* For the rest (including \X when Unicode properties are supported), we        /* For the rest (including \X when Unicode properties are supported), we
6853        can obtain the OP value by negating the escape value in the default        can obtain the OP value by negating the escape value in the default
6854        situation when PCRE_UCP is not set. When it *is* set, we substitute        situation when PCRE_UCP is not set. When it *is* set, we substitute
6855        Unicode property tests. */        Unicode property tests. Note that \b and \B do a one-character
6856          lookbehind. */
6857    
6858        else        else
6859          {          {
6860            if ((-c == ESC_b || -c == ESC_B) && cd->max_lookbehind == 0)
6861              cd->max_lookbehind = 1;
6862  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
6863          if (-c >= ESC_DU && -c <= ESC_wu)          if (-c >= ESC_DU && -c <= ESC_wu)
6864            {            {
# Line 7163  for (;;) Line 7166  for (;;)
7166          *ptrptr = ptr;          *ptrptr = ptr;
7167          return FALSE;          return FALSE;
7168          }          }
7169        else { PUT(reverse_count, 0, fixed_length); }        else
7170            {
7171            if (fixed_length > cd->max_lookbehind)
7172              cd->max_lookbehind = fixed_length;
7173            PUT(reverse_count, 0, fixed_length);
7174            }
7175        }        }
7176      }      }
7177    
# Line 7833  cd->start_pattern = (const pcre_uchar *) Line 7841  cd->start_pattern = (const pcre_uchar *)
7841  cd->end_pattern = (const pcre_uchar *)(pattern + STRLEN_UC((const pcre_uchar *)pattern));  cd->end_pattern = (const pcre_uchar *)(pattern + STRLEN_UC((const pcre_uchar *)pattern));
7842  cd->req_varyopt = 0;  cd->req_varyopt = 0;
7843  cd->assert_depth = 0;  cd->assert_depth = 0;
7844    cd->max_lookbehind = 0;
7845  cd->external_options = options;  cd->external_options = options;
7846  cd->external_flags = 0;  cd->external_flags = 0;
7847  cd->open_caps = NULL;  cd->open_caps = NULL;
# Line 7883  re->magic_number = MAGIC_NUMBER; Line 7892  re->magic_number = MAGIC_NUMBER;
7892  re->size = (int)size;  re->size = (int)size;
7893  re->options = cd->external_options;  re->options = cd->external_options;
7894  re->flags = cd->external_flags;  re->flags = cd->external_flags;
 re->dummy1 = 0;  
7895  re->first_char = 0;  re->first_char = 0;
7896  re->req_char = 0;  re->req_char = 0;
7897  re->name_table_offset = sizeof(REAL_PCRE) / sizeof(pcre_uchar);  re->name_table_offset = sizeof(REAL_PCRE) / sizeof(pcre_uchar);
# Line 7903  field; this time it's used for rememberi Line 7911  field; this time it's used for rememberi
7911  cd->final_bracount = cd->bracount;  /* Save for checking forward references */  cd->final_bracount = cd->bracount;  /* Save for checking forward references */
7912  cd->assert_depth = 0;  cd->assert_depth = 0;
7913  cd->bracount = 0;  cd->bracount = 0;
7914    cd->max_lookbehind = 0;
7915  cd->names_found = 0;  cd->names_found = 0;
7916  cd->name_table = (pcre_uchar *)re + re->name_table_offset;  cd->name_table = (pcre_uchar *)re + re->name_table_offset;
7917  codestart = cd->name_table + re->name_entry_size * re->name_count;  codestart = cd->name_table + re->name_entry_size * re->name_count;
# Line 7924  code = (pcre_uchar *)codestart; Line 7933  code = (pcre_uchar *)codestart;
7933    &firstchar, &reqchar, NULL, cd, NULL);    &firstchar, &reqchar, NULL, cd, NULL);
7934  re->top_bracket = cd->bracount;  re->top_bracket = cd->bracount;
7935  re->top_backref = cd->top_backref;  re->top_backref = cd->top_backref;
7936    re->max_lookbehind = cd->max_lookbehind;
7937  re->flags = cd->external_flags | PCRE_MODE;  re->flags = cd->external_flags | PCRE_MODE;
7938    
7939  if (cd->had_accept) reqchar = REQ_NONE;   /* Must disable after (*ACCEPT) */  if (cd->had_accept) reqchar = REQ_NONE;   /* Must disable after (*ACCEPT) */
# Line 8011  if (cd->check_lookbehind) Line 8021  if (cd->check_lookbehind)
8021                      (fixed_length == -4)? ERR70 : ERR25;                      (fixed_length == -4)? ERR70 : ERR25;
8022          break;          break;
8023          }          }
8024          if (fixed_length > cd->max_lookbehind) cd->max_lookbehind = fixed_length;
8025        PUT(cc, 1, fixed_length);        PUT(cc, 1, fixed_length);
8026        }        }
8027      cc += 1 + LINK_SIZE;      cc += 1 + LINK_SIZE;

Legend:
Removed from v.927  
changed lines
  Added in v.962

  ViewVC Help
Powered by ViewVC 1.1.5