/[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 512 by ph10, Tue Mar 30 11:11:52 2010 UTC revision 514 by ph10, Mon May 3 12:54:22 2010 UTC
# Line 124  static const short int escapes[] = { Line 124  static const short int escapes[] = {
124       -ESC_H,                  0,       -ESC_H,                  0,
125       0,                       -ESC_K,       0,                       -ESC_K,
126       0,                       0,       0,                       0,
127       0,                       0,       -ESC_N,                  0,
128       -ESC_P,                  -ESC_Q,       -ESC_P,                  -ESC_Q,
129       -ESC_R,                  -ESC_S,       -ESC_R,                  -ESC_S,
130       0,                       0,       0,                       0,
# Line 171  static const short int escapes[] = { Line 171  static const short int escapes[] = {
171  /*  B8 */     0,     0,      0,       0,      0,   ']',    '=',    '-',  /*  B8 */     0,     0,      0,       0,      0,   ']',    '=',    '-',
172  /*  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,
173  /*  C8 */-ESC_H,     0,      0,       0,      0,     0,      0,      0,  /*  C8 */-ESC_H,     0,      0,       0,      0,     0,      0,      0,
174  /*  D0 */   '}',     0, -ESC_K,       0,      0,     0,      0, -ESC_P,  /*  D0 */   '}',     0, -ESC_K,       0,      0,-ESC_N,      0, -ESC_P,
175  /*  D8 */-ESC_Q,-ESC_R,      0,       0,      0,     0,      0,      0,  /*  D8 */-ESC_Q,-ESC_R,      0,       0,      0,     0,      0,      0,
176  /*  E0 */  '\\',     0, -ESC_S,       0,      0,-ESC_V, -ESC_W, -ESC_X,  /*  E0 */  '\\',     0, -ESC_S,       0,      0,-ESC_V, -ESC_W, -ESC_X,
177  /*  E8 */     0,-ESC_Z,      0,       0,      0,     0,      0,      0,  /*  E8 */     0,-ESC_Z,      0,       0,      0,     0,      0,      0,
# Line 324  static const char error_texts[] = Line 324  static const char error_texts[] =
324    /* 35 */    /* 35 */
325    "invalid condition (?(0)\0"    "invalid condition (?(0)\0"
326    "\\C not allowed in lookbehind assertion\0"    "\\C not allowed in lookbehind assertion\0"
327    "PCRE does not support \\L, \\l, \\N, \\U, or \\u\0"    "PCRE does not support \\L, \\l, \\N{name}, \\U, or \\u\0"
328    "number after (?C is > 255\0"    "number after (?C is > 255\0"
329    "closing ) for (?C expected\0"    "closing ) for (?C expected\0"
330    /* 40 */    /* 40 */
# Line 593  else Line 593  else
593    
594      case CHAR_l:      case CHAR_l:
595      case CHAR_L:      case CHAR_L:
     case CHAR_N:  
596      case CHAR_u:      case CHAR_u:
597      case CHAR_U:      case CHAR_U:
598      *errorcodeptr = ERR37;      *errorcodeptr = ERR37;
# Line 830  else Line 829  else
829      break;      break;
830      }      }
831    }    }
832    
833    /* Perl supports \N{name} for character names, as well as plain \N for "not
834    newline". PCRE does not support \N{name}. */
835    
836    if (c == -ESC_N && ptr[1] == CHAR_LEFT_CURLY_BRACKET)
837      *errorcodeptr = ERR37;
838    
839  *ptrptr = ptr;  *ptrptr = ptr;
840  return c;  return c;
# Line 3204  for (;; ptr++) Line 3209  for (;; ptr++)
3209    
3210        /* Backslash may introduce a single character, or it may introduce one        /* Backslash may introduce a single character, or it may introduce one
3211        of the specials, which just set a flag. The sequence \b is a special        of the specials, which just set a flag. The sequence \b is a special
3212        case. Inside a class (and only there) it is treated as backspace.        case. Inside a class (and only there) it is treated as backspace. We
3213        Elsewhere it marks a word boundary. Other escapes have preset maps ready        assume that other escapes have more than one character in them, so set
3214        to 'or' into the one we are building. We assume they have more than one        class_charcount bigger than one. Unrecognized escapes fall through and
3215        character in them, so set class_charcount bigger than one. */        are either treated as literal characters (by default), or are faulted if
3216          PCRE_EXTRA is set. */
3217    
3218        if (c == CHAR_BACKSLASH)        if (c == CHAR_BACKSLASH)
3219          {          {
3220          c = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);          c = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);
3221          if (*errorcodeptr != 0) goto FAILED;          if (*errorcodeptr != 0) goto FAILED;
3222    
3223          if (-c == ESC_b) c = CHAR_BS;       /* \b is backspace in a class */          if (-c == ESC_b) c = CHAR_BS;    /* \b is backspace in a class */
         else if (-c == ESC_X) c = CHAR_X;   /* \X is literal X in a class */  
         else if (-c == ESC_R) c = CHAR_R;   /* \R is literal R in a class */  
3224          else if (-c == ESC_Q)            /* Handle start of quoted string */          else if (-c == ESC_Q)            /* Handle start of quoted string */
3225            {            {
3226            if (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E)            if (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E)
# Line 3501  for (;; ptr++) Line 3505  for (;; ptr++)
3505            d = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);            d = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);
3506            if (*errorcodeptr != 0) goto FAILED;            if (*errorcodeptr != 0) goto FAILED;
3507    
3508            /* \b is backspace; \X is literal X; \R is literal R; any other            /* \b is backspace; any other special means the '-' was literal */
           special means the '-' was literal */  
3509    
3510            if (d < 0)            if (d < 0)
3511              {              {
3512              if (d == -ESC_b) d = CHAR_BS;              if (d == -ESC_b) d = CHAR_BS; else
             else if (d == -ESC_X) d = CHAR_X;  
             else if (d == -ESC_R) d = CHAR_R; else  
3513                {                {
3514                ptr = oldptr;                ptr = oldptr;
3515                goto LONE_SINGLE_CHARACTER;  /* A few lines below */                goto LONE_SINGLE_CHARACTER;  /* A few lines below */

Legend:
Removed from v.512  
changed lines
  Added in v.514

  ViewVC Help
Powered by ViewVC 1.1.5