/[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 79 by nigel, Sat Feb 24 21:40:52 2007 UTC revision 91 by nigel, Sat Feb 24 21:41:34 2007 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2005 University of Cambridge             Copyright (c) 1997-2006 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 42  POSSIBILITY OF SUCH DAMAGE. Line 42  POSSIBILITY OF SUCH DAMAGE.
42  supporting internal functions that are not used by other modules. */  supporting internal functions that are not used by other modules. */
43    
44    
45    #define NLBLOCK cd            /* The block containing newline information */
46  #include "pcre_internal.h"  #include "pcre_internal.h"
47    
48    
49    /* When DEBUG is defined, we need the pcre_printint() function, which is also
50    used by pcretest. DEBUG is not defined when building a production library. */
51    
52    #ifdef DEBUG
53    #include "pcre_printint.src"
54    #endif
55    
56    
57    
58  /*************************************************  /*************************************************
59  *      Code parameters and static tables         *  *      Code parameters and static tables         *
60  *************************************************/  *************************************************/
# Line 107  static const short int escapes[] = { Line 117  static const short int escapes[] = {
117    
118    
119  /* Tables of names of POSIX character classes and their lengths. The list is  /* Tables of names of POSIX character classes and their lengths. The list is
120  terminated by a zero length entry. The first three must be alpha, upper, lower,  terminated by a zero length entry. The first three must be alpha, lower, upper,
121  as this is assumed for handling case independence. */  as this is assumed for handling case independence. */
122    
123  static const char *const posix_names[] = {  static const char *const posix_names[] = {
# Line 118  static const char *const posix_names[] = Line 128  static const char *const posix_names[] =
128  static const uschar posix_name_lengths[] = {  static const uschar posix_name_lengths[] = {
129    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 0 };    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 0 };
130    
131  /* Table of class bit maps for each POSIX class; up to three may be combined  /* Table of class bit maps for each POSIX class. Each class is formed from a
132  to form the class. The table for [:blank:] is dynamically modified to remove  base map, with an optional addition or removal of another map. Then, for some
133  the vertical space characters. */  classes, there is some additional tweaking: for [:blank:] the vertical space
134    characters are removed, and for [:alpha:] and [:alnum:] the underscore
135    character is removed. The triples in the table consist of the base map offset,
136    second map offset or -1 if no second map, and a non-negative value for map
137    addition or a negative value for map subtraction (if there are two maps). The
138    absolute value of the third field has these meanings: 0 => no tweaking, 1 =>
139    remove vertical space characters, 2 => remove underscore. */
140    
141  static const int posix_class_maps[] = {  static const int posix_class_maps[] = {
142    cbit_lower, cbit_upper, -1,             /* alpha */    cbit_word,  cbit_digit, -2,             /* alpha */
143    cbit_lower, -1,         -1,             /* lower */    cbit_lower, -1,          0,             /* lower */
144    cbit_upper, -1,         -1,             /* upper */    cbit_upper, -1,          0,             /* upper */
145    cbit_digit, cbit_lower, cbit_upper,     /* alnum */    cbit_word,  -1,          2,             /* alnum - word without underscore */
146    cbit_print, cbit_cntrl, -1,             /* ascii */    cbit_print, cbit_cntrl,  0,             /* ascii */
147    cbit_space, -1,         -1,             /* blank - a GNU extension */    cbit_space, -1,          1,             /* blank - a GNU extension */
148    cbit_cntrl, -1,         -1,             /* cntrl */    cbit_cntrl, -1,          0,             /* cntrl */
149    cbit_digit, -1,         -1,             /* digit */    cbit_digit, -1,          0,             /* digit */
150    cbit_graph, -1,         -1,             /* graph */    cbit_graph, -1,          0,             /* graph */
151    cbit_print, -1,         -1,             /* print */    cbit_print, -1,          0,             /* print */
152    cbit_punct, -1,         -1,             /* punct */    cbit_punct, -1,          0,             /* punct */
153    cbit_space, -1,         -1,             /* space */    cbit_space, -1,          0,             /* space */
154    cbit_word,  -1,         -1,             /* word - a Perl extension */    cbit_word,  -1,          0,             /* word - a Perl extension */
155    cbit_xdigit,-1,         -1              /* xdigit */    cbit_xdigit,-1,          0              /* xdigit */
156  };  };
157    
158    
# Line 175  static const char *error_texts[] = { Line 191  static const char *error_texts[] = {
191    "unrecognized character after (?<",    "unrecognized character after (?<",
192    /* 25 */    /* 25 */
193    "lookbehind assertion is not fixed length",    "lookbehind assertion is not fixed length",
194    "malformed number after (?(",    "malformed number or name after (?(",
195    "conditional group contains more than two branches",    "conditional group contains more than two branches",
196    "assertion expected after (?(",    "assertion expected after (?(",
197    "(?R or (?digits must be followed by )",    "(?R or (?digits must be followed by )",
# Line 195  static const char *error_texts[] = { Line 211  static const char *error_texts[] = {
211    "recursive call could loop indefinitely",    "recursive call could loop indefinitely",
212    "unrecognized character after (?P",    "unrecognized character after (?P",
213    "syntax error after (?P",    "syntax error after (?P",
214    "two named groups have the same name",    "two named subpatterns have the same name",
215    "invalid UTF-8 string",    "invalid UTF-8 string",
216    /* 45 */    /* 45 */
217    "support for \\P, \\p, and \\X has not been compiled",    "support for \\P, \\p, and \\X has not been compiled",
218    "malformed \\P or \\p sequence",    "malformed \\P or \\p sequence",
219    "unknown property name after \\P or \\p"    "unknown property name after \\P or \\p",
220      "subpattern name is too long (maximum 32 characters)",
221      "too many named subpatterns (maximum 10,000)",
222      /* 50 */
223      "repeated subpattern is too long",
224      "octal value is greater than \\377 (not in UTF-8 mode)"
225  };  };
226    
227    
# Line 362  static int Line 383  static int
383  check_escape(const uschar **ptrptr, int *errorcodeptr, int bracount,  check_escape(const uschar **ptrptr, int *errorcodeptr, int bracount,
384    int options, BOOL isclass)    int options, BOOL isclass)
385  {  {
386  const uschar *ptr = *ptrptr;  BOOL utf8 = (options & PCRE_UTF8) != 0;
387    const uschar *ptr = *ptrptr + 1;
388  int c, i;  int c, i;
389    
390    GETCHARINCTEST(c, ptr);           /* Get character value, increment pointer */
391    ptr--;                            /* Set pointer back to the last byte */
392    
393  /* If backslash is at the end of the pattern, it's an error. */  /* If backslash is at the end of the pattern, it's an error. */
394    
 c = *(++ptr);  
395  if (c == 0) *errorcodeptr = ERR1;  if (c == 0) *errorcodeptr = ERR1;
396    
397  /* Non-alphamerics are literals. For digits or letters, do an initial lookup in  /* Non-alphamerics are literals. For digits or letters, do an initial lookup in
# Line 442  else Line 466  else
466        }        }
467    
468      /* \0 always starts an octal number, but we may drop through to here with a      /* \0 always starts an octal number, but we may drop through to here with a
469      larger first octal digit. */      larger first octal digit. The original code used just to take the least
470        significant 8 bits of octal numbers (I think this is what early Perls used
471        to do). Nowadays we allow for larger numbers in UTF-8 mode, but no more
472        than 3 octal digits. */
473    
474      case '0':      case '0':
475      c -= '0';      c -= '0';
476      while(i++ < 2 && ptr[1] >= '0' && ptr[1] <= '7')      while(i++ < 2 && ptr[1] >= '0' && ptr[1] <= '7')
477          c = c * 8 + *(++ptr) - '0';          c = c * 8 + *(++ptr) - '0';
478      c &= 255;     /* Take least significant 8 bits */      if (!utf8 && c > 255) *errorcodeptr = ERR51;
479      break;      break;
480    
481      /* \x is complicated when UTF-8 is enabled. \x{ddd} is a character number      /* \x is complicated. \x{ddd} is a character number which can be greater
482      which can be greater than 0xff, but only if the ddd are hex digits. */      than 0xff in utf8 mode, but only if the ddd are hex digits. If not, { is
483        treated as a data character. */
484    
485      case 'x':      case 'x':
486  #ifdef SUPPORT_UTF8      if (ptr[1] == '{')
     if (ptr[1] == '{' && (options & PCRE_UTF8) != 0)  
487        {        {
488        const uschar *pt = ptr + 2;        const uschar *pt = ptr + 2;
489        register int count = 0;        int count = 0;
490    
491        c = 0;        c = 0;
492        while ((digitab[*pt] & ctype_xdigit) != 0)        while ((digitab[*pt] & ctype_xdigit) != 0)
493          {          {
494          int cc = *pt++;          register int cc = *pt++;
495            if (c == 0 && cc == '0') continue;     /* Leading zeroes */
496          count++;          count++;
497    
498  #if !EBCDIC    /* ASCII coding */  #if !EBCDIC    /* ASCII coding */
499          if (cc >= 'a') cc -= 32;               /* Convert to upper case */          if (cc >= 'a') cc -= 32;               /* Convert to upper case */
500          c = c * 16 + cc - ((cc < 'A')? '0' : ('A' - 10));          c = (c << 4) + cc - ((cc < 'A')? '0' : ('A' - 10));
501  #else          /* EBCDIC coding */  #else          /* EBCDIC coding */
502          if (cc >= 'a' && cc <= 'z') cc += 64;  /* Convert to upper case */          if (cc >= 'a' && cc <= 'z') cc += 64;  /* Convert to upper case */
503          c = c * 16 + cc - ((cc >= '0')? '0' : ('A' - 10));          c = (c << 4) + cc - ((cc >= '0')? '0' : ('A' - 10));
504  #endif  #endif
505          }          }
506    
507        if (*pt == '}')        if (*pt == '}')
508          {          {
509          if (c < 0 || count > 8) *errorcodeptr = ERR34;          if (c < 0 || count > (utf8? 8 : 2)) *errorcodeptr = ERR34;
510          ptr = pt;          ptr = pt;
511          break;          break;
512          }          }
513    
514        /* If the sequence of hex digits does not end with '}', then we don't        /* If the sequence of hex digits does not end with '}', then we don't
515        recognize this construct; fall through to the normal \x handling. */        recognize this construct; fall through to the normal \x handling. */
516        }        }
 #endif  
517    
518      /* Read just a single hex char */      /* Read just a single-byte hex-defined char */
519    
520      c = 0;      c = 0;
521      while (i++ < 2 && (digitab[ptr[1]] & ctype_xdigit) != 0)      while (i++ < 2 && (digitab[ptr[1]] & ctype_xdigit) != 0)
# Line 560  escape sequence. Line 591  escape sequence.
591  Argument:  Argument:
592    ptrptr         points to the pattern position pointer    ptrptr         points to the pattern position pointer
593    negptr         points to a boolean that is set TRUE for negation else FALSE    negptr         points to a boolean that is set TRUE for negation else FALSE
594      dptr           points to an int that is set to the detailed property value
595    errorcodeptr   points to the error code variable    errorcodeptr   points to the error code variable
596    
597  Returns:     value from ucp_type_table, or -1 for an invalid type  Returns:         type value from ucp_type_table, or -1 for an invalid type
598  */  */
599    
600  static int  static int
601  get_ucp(const uschar **ptrptr, BOOL *negptr, int *errorcodeptr)  get_ucp(const uschar **ptrptr, BOOL *negptr, int *dptr, int *errorcodeptr)
602  {  {
603  int c, i, bot, top;  int c, i, bot, top;
604  const uschar *ptr = *ptrptr;  const uschar *ptr = *ptrptr;
605  char name[4];  char name[32];
606    
607  c = *(++ptr);  c = *(++ptr);
608  if (c == 0) goto ERROR_RETURN;  if (c == 0) goto ERROR_RETURN;
609    
610  *negptr = FALSE;  *negptr = FALSE;
611    
612  /* \P or \p can be followed by a one- or two-character name in {}, optionally  /* \P or \p can be followed by a name in {}, optionally preceded by ^ for
613  preceded by ^ for negation. */  negation. */
614    
615  if (c == '{')  if (c == '{')
616    {    {
# Line 587  if (c == '{') Line 619  if (c == '{')
619      *negptr = TRUE;      *negptr = TRUE;
620      ptr++;      ptr++;
621      }      }
622    for (i = 0; i <= 2; i++)    for (i = 0; i < sizeof(name) - 1; i++)
623      {      {
624      c = *(++ptr);      c = *(++ptr);
625      if (c == 0) goto ERROR_RETURN;      if (c == 0) goto ERROR_RETURN;
626      if (c == '}') break;      if (c == '}') break;
627      name[i] = c;      name[i] = c;
628      }      }
629    if (c !='}')   /* Try to distinguish error cases */    if (c !='}') goto ERROR_RETURN;
     {  
     while (*(++ptr) != 0 && *ptr != '}');  
     if (*ptr == '}') goto UNKNOWN_RETURN; else goto ERROR_RETURN;  
     }  
630    name[i] = 0;    name[i] = 0;
631    }    }
632    
# Line 619  top = _pcre_utt_size; Line 647  top = _pcre_utt_size;
647    
648  while (bot < top)  while (bot < top)
649    {    {
650    i = (bot + top)/2;    i = (bot + top) >> 1;
651    c = strcmp(name, _pcre_utt[i].name);    c = strcmp(name, _pcre_utt[i].name);
652    if (c == 0) return _pcre_utt[i].value;    if (c == 0)
653        {
654        *dptr = _pcre_utt[i].value;
655        return _pcre_utt[i].type;
656        }
657    if (c > 0) bot = i + 1; else top = i;    if (c > 0) bot = i + 1; else top = i;
658    }    }
659    
 UNKNOWN_RETURN:  
660  *errorcodeptr = ERR47;  *errorcodeptr = ERR47;
661  *ptrptr = ptr;  *ptrptr = ptr;
662  return -1;  return -1;
# Line 698  read_repeat_counts(const uschar *p, int Line 729  read_repeat_counts(const uschar *p, int
729  int min = 0;  int min = 0;
730  int max = -1;  int max = -1;
731    
732    /* Read the minimum value and do a paranoid check: a negative value indicates
733    an integer overflow. */
734    
735  while ((digitab[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0';  while ((digitab[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0';
736    if (min < 0 || min > 65535)
737      {
738      *errorcodeptr = ERR5;
739      return p;
740      }
741    
742    /* Read the maximum value if there is one, and again do a paranoid on its size.
743    Also, max must not be less than min. */
744    
745  if (*p == '}') max = min; else  if (*p == '}') max = min; else
746    {    {
# Line 706  if (*p == '}') max = min; else Line 748  if (*p == '}') max = min; else
748      {      {
749      max = 0;      max = 0;
750      while((digitab[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0';      while((digitab[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0';
751        if (max < 0 || max > 65535)
752          {
753          *errorcodeptr = ERR5;
754          return p;
755          }
756      if (max < min)      if (max < min)
757        {        {
758        *errorcodeptr = ERR4;        *errorcodeptr = ERR4;
# Line 714  if (*p == '}') max = min; else Line 761  if (*p == '}') max = min; else
761      }      }
762    }    }
763    
764  /* Do paranoid checks, then fill in the required variables, and pass back the  /* Fill in the required variables, and pass back the pointer to the terminating
765  pointer to the terminating '}'. */  '}'. */
766    
767  if (min > 65535 || max > 65535)  *minp = min;
768    *errorcodeptr = ERR5;  *maxp = max;
769  else  return p;
770    }
771    
772    
773    
774    /*************************************************
775    *     Find forward referenced named subpattern   *
776    *************************************************/
777    
778    /* This function scans along a pattern looking for capturing subpatterns, and
779    counting them. If it finds a named pattern that matches the name it is given,
780    it returns its number. This is used for forward references to named
781    subpatterns. We know that if (?P< is encountered, the name will be terminated
782    by '>' because that is checked in the first pass.
783    
784    Arguments:
785      pointer      current position in the pattern
786      count        current count of capturing parens
787      name         name to seek
788      namelen      name length
789    
790    Returns:       the number of the named subpattern, or -1 if not found
791    */
792    
793    static int
794    find_named_parens(const uschar *ptr, int count, const uschar *name, int namelen)
795    {
796    const uschar *thisname;
797    for (; *ptr != 0; ptr++)
798    {    {
799    *minp = min;    if (*ptr == '\\' && ptr[1] != 0) { ptr++; continue; }
800    *maxp = max;    if (*ptr != '(') continue;
801      if (ptr[1] != '?') { count++; continue; }
802      if (ptr[2] == '(') { ptr += 2; continue; }
803      if (ptr[2] != 'P' || ptr[3] != '<') continue;
804      count++;
805      ptr += 4;
806      thisname = ptr;
807      while (*ptr != '>') ptr++;
808      if (namelen == ptr - thisname && strncmp(name, thisname, namelen) == 0)
809        return count;
810    }    }
811  return p;  return -1;
812  }  }
813    
814    
# Line 884  for (;;) Line 968  for (;;)
968    
969      case OP_CHAR:      case OP_CHAR:
970      case OP_CHARNC:      case OP_CHARNC:
971        case OP_NOT:
972      branchlength++;      branchlength++;
973      cc += 2;      cc += 2;
974  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 917  for (;;) Line 1002  for (;;)
1002    
1003      case OP_PROP:      case OP_PROP:
1004      case OP_NOTPROP:      case OP_NOTPROP:
1005      cc++;      cc += 2;
1006      /* Fall through */      /* Fall through */
1007    
1008      case OP_NOT_DIGIT:      case OP_NOT_DIGIT:
# Line 998  Returns:      pointer to the opcode for Line 1083  Returns:      pointer to the opcode for
1083  static const uschar *  static const uschar *
1084  find_bracket(const uschar *code, BOOL utf8, int number)  find_bracket(const uschar *code, BOOL utf8, int number)
1085  {  {
 #ifndef SUPPORT_UTF8  
 utf8 = utf8;               /* Stop pedantic compilers complaining */  
 #endif  
   
1086  for (;;)  for (;;)
1087    {    {
1088    register int c = *code;    register int c = *code;
1089    if (c == OP_END) return NULL;    if (c == OP_END) return NULL;
1090    
1091      /* XCLASS is used for classes that cannot be represented just by a bit
1092      map. This includes negated single high-valued characters. The length in
1093      the table is zero; the actual length is stored in the compiled code. */
1094    
1095      if (c == OP_XCLASS) code += GET(code, 1);
1096    
1097      /* Handle bracketed group */
1098    
1099    else if (c > OP_BRA)    else if (c > OP_BRA)
1100      {      {
1101      int n = c - OP_BRA;      int n = c - OP_BRA;
# Line 1013  for (;;) Line 1103  for (;;)
1103      if (n == number) return (uschar *)code;      if (n == number) return (uschar *)code;
1104      code += _pcre_OP_lengths[OP_BRA];      code += _pcre_OP_lengths[OP_BRA];
1105      }      }
1106    
1107      /* Otherwise, we get the item's length from the table. In UTF-8 mode, opcodes
1108      that are followed by a character may be followed by a multi-byte character.
1109      The length in the table is a minimum, so we have to scan along to skip the
1110      extra bytes. All opcodes are less than 128, so we can use relatively
1111      efficient code. */
1112    
1113    else    else
1114      {      {
1115      code += _pcre_OP_lengths[c];      code += _pcre_OP_lengths[c];
   
 #ifdef SUPPORT_UTF8  
   
     /* In UTF-8 mode, opcodes that are followed by a character may be followed  
     by a multi-byte character. The length in the table is a minimum, so we have  
     to scan along to skip the extra bytes. All opcodes are less than 128, so we  
     can use relatively efficient code. */  
   
1116      if (utf8) switch(c)      if (utf8) switch(c)
1117        {        {
1118        case OP_CHAR:        case OP_CHAR:
# Line 1039  for (;;) Line 1128  for (;;)
1128        case OP_MINQUERY:        case OP_MINQUERY:
1129        while ((*code & 0xc0) == 0x80) code++;        while ((*code & 0xc0) == 0x80) code++;
1130        break;        break;
   
       /* XCLASS is used for classes that cannot be represented just by a bit  
       map. This includes negated single high-valued characters. The length in  
       the table is zero; the actual length is stored in the compiled code. */  
   
       case OP_XCLASS:  
       code += GET(code, 1) + 1;  
       break;  
1131        }        }
 #endif  
1132      }      }
1133    }    }
1134  }  }
# Line 1072  Returns:      pointer to the opcode for Line 1152  Returns:      pointer to the opcode for
1152  static const uschar *  static const uschar *
1153  find_recurse(const uschar *code, BOOL utf8)  find_recurse(const uschar *code, BOOL utf8)
1154  {  {
 #ifndef SUPPORT_UTF8  
 utf8 = utf8;               /* Stop pedantic compilers complaining */  
 #endif  
   
1155  for (;;)  for (;;)
1156    {    {
1157    register int c = *code;    register int c = *code;
1158    if (c == OP_END) return NULL;    if (c == OP_END) return NULL;
1159    else if (c == OP_RECURSE) return code;    if (c == OP_RECURSE) return code;
1160    
1161      /* XCLASS is used for classes that cannot be represented just by a bit
1162      map. This includes negated single high-valued characters. The length in
1163      the table is zero; the actual length is stored in the compiled code. */
1164    
1165      if (c == OP_XCLASS) code += GET(code, 1);
1166    
1167      /* All bracketed groups have the same length. */
1168    
1169    else if (c > OP_BRA)    else if (c > OP_BRA)
1170      {      {
1171      code += _pcre_OP_lengths[OP_BRA];      code += _pcre_OP_lengths[OP_BRA];
1172      }      }
1173    
1174      /* Otherwise, we get the item's length from the table. In UTF-8 mode, opcodes
1175      that are followed by a character may be followed by a multi-byte character.
1176      The length in the table is a minimum, so we have to scan along to skip the
1177      extra bytes. All opcodes are less than 128, so we can use relatively
1178      efficient code. */
1179    
1180    else    else
1181      {      {
1182      code += _pcre_OP_lengths[c];      code += _pcre_OP_lengths[c];
   
 #ifdef SUPPORT_UTF8  
   
     /* In UTF-8 mode, opcodes that are followed by a character may be followed  
     by a multi-byte character. The length in the table is a minimum, so we have  
     to scan along to skip the extra bytes. All opcodes are less than 128, so we  
     can use relatively efficient code. */  
   
1183      if (utf8) switch(c)      if (utf8) switch(c)
1184        {        {
1185        case OP_CHAR:        case OP_CHAR:
# Line 1111  for (;;) Line 1195  for (;;)
1195        case OP_MINQUERY:        case OP_MINQUERY:
1196        while ((*code & 0xc0) == 0x80) code++;        while ((*code & 0xc0) == 0x80) code++;
1197        break;        break;
   
       /* XCLASS is used for classes that cannot be represented just by a bit  
       map. This includes negated single high-valued characters. The length in  
       the table is zero; the actual length is stored in the compiled code. */  
   
       case OP_XCLASS:  
       code += GET(code, 1) + 1;  
       break;  
1198        }        }
 #endif  
1199      }      }
1200    }    }
1201  }  }
# Line 1477  Yield:        TRUE when range returned; Line 1552  Yield:        TRUE when range returned;
1552  static BOOL  static BOOL
1553  get_othercase_range(int *cptr, int d, int *ocptr, int *odptr)  get_othercase_range(int *cptr, int d, int *ocptr, int *odptr)
1554  {  {
1555  int c, chartype, othercase, next;  int c, othercase, next;
1556    
1557  for (c = *cptr; c <= d; c++)  for (c = *cptr; c <= d; c++)
1558    {    { if ((othercase = _pcre_ucp_othercase(c)) >= 0) break; }
   if (_pcre_ucp_findchar(c, &chartype, &othercase) == ucp_L && othercase != 0)  
     break;  
   }  
1559    
1560  if (c > d) return FALSE;  if (c > d) return FALSE;
1561    
# Line 1492  next = othercase + 1; Line 1564  next = othercase + 1;
1564    
1565  for (++c; c <= d; c++)  for (++c; c <= d; c++)
1566    {    {
1567    if (_pcre_ucp_findchar(c, &chartype, &othercase) != ucp_L ||    if (_pcre_ucp_othercase(c) != next) break;
         othercase != next)  
     break;  
1568    next++;    next++;
1569    }    }
1570    
# Line 1541  int greedy_default, greedy_non_default; Line 1611  int greedy_default, greedy_non_default;
1611  int firstbyte, reqbyte;  int firstbyte, reqbyte;
1612  int zeroreqbyte, zerofirstbyte;  int zeroreqbyte, zerofirstbyte;
1613  int req_caseopt, reqvary, tempreqvary;  int req_caseopt, reqvary, tempreqvary;
 int condcount = 0;  
1614  int options = *optionsptr;  int options = *optionsptr;
1615  int after_manual_callout = 0;  int after_manual_callout = 0;
1616  register int c;  register int c;
# Line 1655  for (;; ptr++) Line 1724  for (;; ptr++)
1724      if ((cd->ctypes[c] & ctype_space) != 0) continue;      if ((cd->ctypes[c] & ctype_space) != 0) continue;
1725      if (c == '#')      if (c == '#')
1726        {        {
1727        /* The space before the ; is to avoid a warning on a silly compiler        while (*(++ptr) != 0) if (IS_NEWLINE(ptr)) break;
1728        on the Macintosh. */        if (*ptr != 0)
1729        while ((c = *(++ptr)) != 0 && c != NEWLINE) ;          {
1730        if (c != 0) continue;   /* Else fall through to handle end of string */          ptr += cd->nllen - 1;
1731            continue;
1732            }
1733          /* Else fall through to handle end of string */
1734          c = 0;
1735        }        }
1736      }      }
1737    
# Line 1711  for (;; ptr++) Line 1784  for (;; ptr++)
1784      *code++ = OP_ANY;      *code++ = OP_ANY;
1785      break;      break;
1786    
1787      /* Character classes. If the included characters are all < 255 in value, we      /* Character classes. If the included characters are all < 256, we build a
1788      build a 32-byte bitmap of the permitted characters, except in the special      32-byte bitmap of the permitted characters, except in the special case
1789      case where there is only one such character. For negated classes, we build      where there is only one such character. For negated classes, we build the
1790      the map as usual, then invert it at the end. However, we use a different      map as usual, then invert it at the end. However, we use a different opcode
1791      opcode so that data characters > 255 can be handled correctly.      so that data characters > 255 can be handled correctly.
1792    
1793      If the class contains characters outside the 0-255 range, a different      If the class contains characters outside the 0-255 range, a different
1794      opcode is compiled. It may optionally have a bit map for characters < 256,      opcode is compiled. It may optionally have a bit map for characters < 256,
# Line 1806  for (;; ptr++) Line 1879  for (;; ptr++)
1879            check_posix_syntax(ptr, &tempptr, cd))            check_posix_syntax(ptr, &tempptr, cd))
1880          {          {
1881          BOOL local_negate = FALSE;          BOOL local_negate = FALSE;
1882          int posix_class, i;          int posix_class, taboffset, tabopt;
1883          register const uschar *cbits = cd->cbits;          register const uschar *cbits = cd->cbits;
1884            uschar pbits[32];
1885    
1886          if (ptr[1] != ':')          if (ptr[1] != ':')
1887            {            {
# Line 1836  for (;; ptr++) Line 1910  for (;; ptr++)
1910          if ((options & PCRE_CASELESS) != 0 && posix_class <= 2)          if ((options & PCRE_CASELESS) != 0 && posix_class <= 2)
1911            posix_class = 0;            posix_class = 0;
1912    
1913          /* Or into the map we are building up to 3 of the static class          /* We build the bit map for the POSIX class in a chunk of local store
1914          tables, or their negations. The [:blank:] class sets up the same          because we may be adding and subtracting from it, and we don't want to
1915          chars as the [:space:] class (all white space). We remove the vertical          subtract bits that may be in the main map already. At the end we or the
1916          white space chars afterwards. */          result into the bit map that is being built. */
1917    
1918          posix_class *= 3;          posix_class *= 3;
1919          for (i = 0; i < 3; i++)  
1920            /* Copy in the first table (always present) */
1921    
1922            memcpy(pbits, cbits + posix_class_maps[posix_class],
1923              32 * sizeof(uschar));
1924    
1925            /* If there is a second table, add or remove it as required. */
1926    
1927            taboffset = posix_class_maps[posix_class + 1];
1928            tabopt = posix_class_maps[posix_class + 2];
1929    
1930            if (taboffset >= 0)
1931            {            {
1932            BOOL blankclass = strncmp((char *)ptr, "blank", 5) == 0;            if (tabopt >= 0)
1933            int taboffset = posix_class_maps[posix_class + i];              for (c = 0; c < 32; c++) pbits[c] |= cbits[c + taboffset];
           if (taboffset < 0) break;  
           if (local_negate)  
             {  
             if (i == 0)  
               for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+taboffset];  
             else  
               for (c = 0; c < 32; c++) classbits[c] &= ~cbits[c+taboffset];  
             if (blankclass) classbits[1] |= 0x3c;  
             }  
1934            else            else
1935              {              for (c = 0; c < 32; c++) pbits[c] &= ~cbits[c + taboffset];
             for (c = 0; c < 32; c++) classbits[c] |= cbits[c+taboffset];  
             if (blankclass) classbits[1] &= ~0x3c;  
             }  
1936            }            }
1937    
1938            /* Not see if we need to remove any special characters. An option
1939            value of 1 removes vertical space and 2 removes underscore. */
1940    
1941            if (tabopt < 0) tabopt = -tabopt;
1942            if (tabopt == 1) pbits[1] &= ~0x3c;
1943              else if (tabopt == 2) pbits[11] &= 0x7f;
1944    
1945            /* Add the POSIX table or its complement into the main table that is
1946            being built and we are done. */
1947    
1948            if (local_negate)
1949              for (c = 0; c < 32; c++) classbits[c] |= ~pbits[c];
1950            else
1951              for (c = 0; c < 32; c++) classbits[c] |= pbits[c];
1952    
1953          ptr = tempptr + 1;          ptr = tempptr + 1;
1954          class_charcount = 10;  /* Set > 1; assumes more than 1 per class */          class_charcount = 10;  /* Set > 1; assumes more than 1 per class */
1955          continue;    /* End of POSIX syntax handling */          continue;    /* End of POSIX syntax handling */
# Line 1928  for (;; ptr++) Line 2016  for (;; ptr++)
2016              case ESC_P:              case ESC_P:
2017                {                {
2018                BOOL negated;                BOOL negated;
2019                int property = get_ucp(&ptr, &negated, errorcodeptr);                int pdata;
2020                if (property < 0) goto FAILED;                int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);
2021                  if (ptype < 0) goto FAILED;
2022                class_utf8 = TRUE;                class_utf8 = TRUE;
2023                *class_utf8data++ = ((-c == ESC_p) != negated)?                *class_utf8data++ = ((-c == ESC_p) != negated)?
2024                  XCL_PROP : XCL_NOTPROP;                  XCL_PROP : XCL_NOTPROP;
2025                *class_utf8data++ = property;                *class_utf8data++ = ptype;
2026                  *class_utf8data++ = pdata;
2027                class_charcount -= 2;   /* Not a < 256 character */                class_charcount -= 2;   /* Not a < 256 character */
2028                }                }
2029              continue;              continue;
# Line 2115  for (;; ptr++) Line 2205  for (;; ptr++)
2205  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2206          if ((options & PCRE_CASELESS) != 0)          if ((options & PCRE_CASELESS) != 0)
2207            {            {
           int chartype;  
2208            int othercase;            int othercase;
2209            if (_pcre_ucp_findchar(c, &chartype, &othercase) >= 0 &&            if ((othercase = _pcre_ucp_othercase(c)) >= 0)
                othercase > 0)  
2210              {              {
2211              *class_utf8data++ = XCL_SINGLE;              *class_utf8data++ = XCL_SINGLE;
2212              class_utf8data += _pcre_ord2utf8(othercase, class_utf8data);              class_utf8data += _pcre_ord2utf8(othercase, class_utf8data);
# Line 2403  for (;; ptr++) Line 2491  for (;; ptr++)
2491      else if (*previous < OP_EODN)      else if (*previous < OP_EODN)
2492        {        {
2493        uschar *oldcode;        uschar *oldcode;
2494        int prop_type;        int prop_type, prop_value;
2495        op_type = OP_TYPESTAR - OP_STAR;  /* Use type opcodes */        op_type = OP_TYPESTAR - OP_STAR;  /* Use type opcodes */
2496        c = *previous;        c = *previous;
2497    
2498        OUTPUT_SINGLE_REPEAT:        OUTPUT_SINGLE_REPEAT:
2499        prop_type = (*previous == OP_PROP || *previous == OP_NOTPROP)?        if (*previous == OP_PROP || *previous == OP_NOTPROP)
2500          previous[1] : -1;          {
2501            prop_type = previous[1];
2502            prop_value = previous[2];
2503            }
2504          else prop_type = prop_value = -1;
2505    
2506        oldcode = code;        oldcode = code;
2507        code = previous;                  /* Usually overwrite previous item */        code = previous;                  /* Usually overwrite previous item */
# Line 2470  for (;; ptr++) Line 2562  for (;; ptr++)
2562    
2563          /* If the maximum is unlimited, insert an OP_STAR. Before doing so,          /* If the maximum is unlimited, insert an OP_STAR. Before doing so,
2564          we have to insert the character for the previous code. For a repeated          we have to insert the character for the previous code. For a repeated
2565          Unicode property match, there is an extra byte that defines the          Unicode property match, there are two extra bytes that define the
2566          required property. In UTF-8 mode, long characters have their length in          required property. In UTF-8 mode, long characters have their length in
2567          c, with the 0x80 bit as a flag. */          c, with the 0x80 bit as a flag. */
2568    
# Line 2486  for (;; ptr++) Line 2578  for (;; ptr++)
2578  #endif  #endif
2579              {              {
2580              *code++ = c;              *code++ = c;
2581              if (prop_type >= 0) *code++ = prop_type;              if (prop_type >= 0)
2582                  {
2583                  *code++ = prop_type;
2584                  *code++ = prop_value;
2585                  }
2586              }              }
2587            *code++ = OP_STAR + repeat_type;            *code++ = OP_STAR + repeat_type;
2588            }            }
# Line 2505  for (;; ptr++) Line 2601  for (;; ptr++)
2601            else            else
2602  #endif  #endif
2603            *code++ = c;            *code++ = c;
2604            if (prop_type >= 0) *code++ = prop_type;            if (prop_type >= 0)
2605                {
2606                *code++ = prop_type;
2607                *code++ = prop_value;
2608                }
2609            repeat_max -= repeat_min;            repeat_max -= repeat_min;
2610            *code++ = OP_UPTO + repeat_type;            *code++ = OP_UPTO + repeat_type;
2611            PUT2INC(code, 0, repeat_max);            PUT2INC(code, 0, repeat_max);
# Line 2524  for (;; ptr++) Line 2624  for (;; ptr++)
2624  #endif  #endif
2625        *code++ = c;        *code++ = c;
2626    
2627        /* For a repeated Unicode property match, there is an extra byte that        /* For a repeated Unicode property match, there are two extra bytes that
2628        defines the required property. */        define the required property. */
2629    
2630  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2631        if (prop_type >= 0) *code++ = prop_type;        if (prop_type >= 0)
2632            {
2633            *code++ = prop_type;
2634            *code++ = prop_value;
2635            }
2636  #endif  #endif
2637        }        }
2638    
# Line 2792  for (;; ptr++) Line 2896  for (;; ptr++)
2896          case '(':          case '(':
2897          bravalue = OP_COND;       /* Conditional group */          bravalue = OP_COND;       /* Conditional group */
2898    
2899          /* Condition to test for recursion */          /* A condition can be a number, referring to a numbered group, a name,
2900            referring to a named group, 'R', referring to recursion, or an
2901            assertion. There are two unfortunate ambiguities, caused by history.
2902            (a) 'R' can be the recursive thing or the name 'R', and (b) a number
2903            could be a name that consists of digits. In both cases, we look for a
2904            name first; if not found, we try the other cases. If the first
2905            character after (?( is a word character, we know the rest up to ) will
2906            also be word characters because the syntax was checked in the first
2907            pass. */
2908    
2909          if (ptr[1] == 'R')          if ((cd->ctypes[ptr[1]] & ctype_word) != 0)
2910            {            {
2911            code[1+LINK_SIZE] = OP_CREF;            int i, namelen;
2912            PUT2(code, 2+LINK_SIZE, CREF_RECURSE);            int condref = 0;
2913              const uschar *name;
2914              uschar *slot = cd->name_table;
2915    
2916              /* This is needed for all successful cases. */
2917    
2918            skipbytes = 3;            skipbytes = 3;
           ptr += 3;  
           }  
2919    
2920          /* Condition to test for a numbered subpattern match. We know that            /* Read the name, but also get it as a number if it's all digits */
         if a digit follows ( then there will just be digits until ) because  
         the syntax was checked in the first pass. */  
2921    
2922          else if ((digitab[ptr[1]] && ctype_digit) != 0)            name = ++ptr;
2923            {            while (*ptr != ')')
           int condref;                 /* Don't amalgamate; some compilers */  
           condref = *(++ptr) - '0';    /* grumble at autoincrement in declaration */  
           while (*(++ptr) != ')') condref = condref*10 + *ptr - '0';  
           if (condref == 0)  
2924              {              {
2925              *errorcodeptr = ERR35;              if (condref >= 0)
2926              goto FAILED;                condref = ((digitab[*ptr] & ctype_digit) != 0)?
2927                    condref * 10 + *ptr - '0' : -1;
2928                ptr++;
2929              }              }
2930              namelen = ptr - name;
2931            ptr++;            ptr++;
2932            code[1+LINK_SIZE] = OP_CREF;  
2933            PUT2(code, 2+LINK_SIZE, condref);            for (i = 0; i < cd->names_found; i++)
2934            skipbytes = 3;              {
2935                if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;
2936                slot += cd->name_entry_size;
2937                }
2938    
2939              /* Found a previous named subpattern */
2940    
2941              if (i < cd->names_found)
2942                {
2943                condref = GET2(slot, 0);
2944                code[1+LINK_SIZE] = OP_CREF;
2945                PUT2(code, 2+LINK_SIZE, condref);
2946                }
2947    
2948              /* Search the pattern for a forward reference */
2949    
2950              else if ((i = find_named_parens(ptr, *brackets, name, namelen)) > 0)
2951                {
2952                code[1+LINK_SIZE] = OP_CREF;
2953                PUT2(code, 2+LINK_SIZE, i);
2954                }
2955    
2956              /* Check for 'R' for recursion */
2957    
2958              else if (namelen == 1 && *name == 'R')
2959                {
2960                code[1+LINK_SIZE] = OP_CREF;
2961                PUT2(code, 2+LINK_SIZE, CREF_RECURSE);
2962                }
2963    
2964              /* Check for a subpattern number */
2965    
2966              else if (condref > 0)
2967                {
2968                code[1+LINK_SIZE] = OP_CREF;
2969                PUT2(code, 2+LINK_SIZE, condref);
2970                }
2971    
2972              /* Either an unidentified subpattern, or a reference to (?(0) */
2973    
2974              else
2975                {
2976                *errorcodeptr = (condref == 0)? ERR35: ERR15;
2977                goto FAILED;
2978                }
2979            }            }
2980    
2981          /* For conditions that are assertions, we just fall through, having          /* For conditions that are assertions, we just fall through, having
2982          set bravalue above. */          set bravalue above. */
2983    
2984          break;          break;
2985    
2986          case '=':                 /* Positive lookahead */          case '=':                 /* Positive lookahead */
# Line 2894  for (;; ptr++) Line 3052  for (;; ptr++)
3052                {                {
3053                if (slot[2+namelen] == 0)                if (slot[2+namelen] == 0)
3054                  {                  {
3055                  *errorcodeptr = ERR43;                  if ((options & PCRE_DUPNAMES) == 0)
3056                  goto FAILED;                    {
3057                      *errorcodeptr = ERR43;
3058                      goto FAILED;
3059                      }
3060                  }                  }
3061                crc = -1;             /* Current name is substring */                else crc = -1;      /* Current name is substring */
3062                }                }
3063              if (crc < 0)              if (crc < 0)
3064                {                {
# Line 2930  for (;; ptr++) Line 3091  for (;; ptr++)
3091              if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;              if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;
3092              slot += cd->name_entry_size;              slot += cd->name_entry_size;
3093              }              }
3094            if (i >= cd->names_found)  
3095              if (i < cd->names_found)         /* Back reference */
3096                {
3097                recno = GET2(slot, 0);
3098                }
3099              else if ((recno =                /* Forward back reference */
3100                        find_named_parens(ptr, *brackets, name, namelen)) <= 0)
3101              {              {
3102              *errorcodeptr = ERR15;              *errorcodeptr = ERR15;
3103              goto FAILED;              goto FAILED;
3104              }              }
3105    
           recno = GET2(slot, 0);  
   
3106            if (type == '>') goto HANDLE_RECURSION;  /* A few lines below */            if (type == '>') goto HANDLE_RECURSION;  /* A few lines below */
3107    
3108            /* Back reference */            /* Back reference */
# Line 2977  for (;; ptr++) Line 3142  for (;; ptr++)
3142            regex in case it doesn't exist. */            regex in case it doesn't exist. */
3143    
3144            *code = OP_END;            *code = OP_END;
3145            called = (recno == 0)?            called = (recno == 0)? cd->start_code :
3146              cd->start_code : find_bracket(cd->start_code, utf8, recno);              find_bracket(cd->start_code, utf8, recno);
   
3147            if (called == NULL)            if (called == NULL)
3148              {              {
3149              *errorcodeptr = ERR15;              *errorcodeptr = ERR15;
# Line 2996  for (;; ptr++) Line 3160  for (;; ptr++)
3160              goto FAILED;              goto FAILED;
3161              }              }
3162    
3163            /* Insert the recursion/subroutine item */            /* Insert the recursion/subroutine item, automatically wrapped inside
3164              "once" brackets. */
3165    
3166              *code = OP_ONCE;
3167              PUT(code, 1, 2 + 2*LINK_SIZE);
3168              code += 1 + LINK_SIZE;
3169    
3170            *code = OP_RECURSE;            *code = OP_RECURSE;
3171            PUT(code, 1, called - cd->start_code);            PUT(code, 1, called - cd->start_code);
3172            code += 1 + LINK_SIZE;            code += 1 + LINK_SIZE;
3173    
3174              *code = OP_KET;
3175              PUT(code, 1, 2 + 2*LINK_SIZE);
3176              code += 1 + LINK_SIZE;
3177            }            }
3178          continue;          continue;
3179    
# Line 3017  for (;; ptr++) Line 3190  for (;; ptr++)
3190              case '-': optset = &unset; break;              case '-': optset = &unset; break;
3191    
3192              case 'i': *optset |= PCRE_CASELESS; break;              case 'i': *optset |= PCRE_CASELESS; break;
3193                case 'J': *optset |= PCRE_DUPNAMES; break;
3194              case 'm': *optset |= PCRE_MULTILINE; break;              case 'm': *optset |= PCRE_MULTILINE; break;
3195              case 's': *optset |= PCRE_DOTALL; break;              case 's': *optset |= PCRE_DOTALL; break;
3196              case 'x': *optset |= PCRE_EXTENDED; break;              case 'x': *optset |= PCRE_EXTENDED; break;
# Line 3133  for (;; ptr++) Line 3307  for (;; ptr++)
3307      else if (bravalue == OP_COND)      else if (bravalue == OP_COND)
3308        {        {
3309        uschar *tc = code;        uschar *tc = code;
3310        condcount = 0;        int condcount = 0;
3311    
3312        do {        do {
3313           condcount++;           condcount++;
# Line 3270  for (;; ptr++) Line 3444  for (;; ptr++)
3444        else if (-c == ESC_P || -c == ESC_p)        else if (-c == ESC_P || -c == ESC_p)
3445          {          {
3446          BOOL negated;          BOOL negated;
3447          int value = get_ucp(&ptr, &negated, errorcodeptr);          int pdata;
3448            int ptype = get_ucp(&ptr, &negated, &pdata, errorcodeptr);
3449          previous = code;          previous = code;
3450          *code++ = ((-c == ESC_p) != negated)? OP_PROP : OP_NOTPROP;          *code++ = ((-c == ESC_p) != negated)? OP_PROP : OP_NOTPROP;
3451          *code++ = value;          *code++ = ptype;
3452            *code++ = pdata;
3453          }          }
3454  #endif  #endif
3455    
# Line 3828  Returns:        pointer to compiled data Line 4004  Returns:        pointer to compiled data
4004                  with errorptr and erroroffset set                  with errorptr and erroroffset set
4005  */  */
4006    
4007  EXPORT pcre *  PCRE_DATA_SCOPE pcre *
4008  pcre_compile(const char *pattern, int options, const char **errorptr,  pcre_compile(const char *pattern, int options, const char **errorptr,
4009    int *erroroffset, const unsigned char *tables)    int *erroroffset, const unsigned char *tables)
4010  {  {
# Line 3836  return pcre_compile2(pattern, options, N Line 4012  return pcre_compile2(pattern, options, N
4012  }  }
4013    
4014    
4015  EXPORT pcre *  
4016    PCRE_DATA_SCOPE pcre *
4017  pcre_compile2(const char *pattern, int options, int *errorcodeptr,  pcre_compile2(const char *pattern, int options, int *errorcodeptr,
4018    const char **errorptr, int *erroroffset, const unsigned char *tables)    const char **errorptr, int *erroroffset, const unsigned char *tables)
4019  {  {
4020  real_pcre *re;  real_pcre *re;
4021  int length = 1 + LINK_SIZE;      /* For initial BRA plus length */  int length = 1 + LINK_SIZE;      /* For initial BRA plus length */
4022  int c, firstbyte, reqbyte;  int c, firstbyte, reqbyte, newline;
4023  int bracount = 0;  int bracount = 0;
4024  int branch_extra = 0;  int branch_extra = 0;
4025  int branch_newextra;  int branch_newextra;
# Line 3856  BOOL utf8; Line 4033  BOOL utf8;
4033  BOOL class_utf8;  BOOL class_utf8;
4034  #endif  #endif
4035  BOOL inescq = FALSE;  BOOL inescq = FALSE;
4036    BOOL capturing;
4037  unsigned int brastackptr = 0;  unsigned int brastackptr = 0;
4038  size_t size;  size_t size;
4039  uschar *code;  uschar *code;
4040  const uschar *codestart;  const uschar *codestart;
4041  const uschar *ptr;  const uschar *ptr;
4042  compile_data compile_block;  compile_data compile_block;
4043    compile_data *cd = &compile_block;
4044  int brastack[BRASTACK_SIZE];  int brastack[BRASTACK_SIZE];
4045  uschar bralenstack[BRASTACK_SIZE];  uschar bralenstack[BRASTACK_SIZE];
4046    
# Line 3915  if ((options & ~PUBLIC_OPTIONS) != 0) Line 4094  if ((options & ~PUBLIC_OPTIONS) != 0)
4094  /* Set up pointers to the individual character tables */  /* Set up pointers to the individual character tables */
4095    
4096  if (tables == NULL) tables = _pcre_default_tables;  if (tables == NULL) tables = _pcre_default_tables;
4097  compile_block.lcc = tables + lcc_offset;  cd->lcc = tables + lcc_offset;
4098  compile_block.fcc = tables + fcc_offset;  cd->fcc = tables + fcc_offset;
4099  compile_block.cbits = tables + cbits_offset;  cd->cbits = tables + cbits_offset;
4100  compile_block.ctypes = tables + ctypes_offset;  cd->ctypes = tables + ctypes_offset;
4101    
4102    /* Handle different types of newline. The two bits give four cases. The current
4103    code allows for one- or two-byte sequences. */
4104    
4105    switch (options & PCRE_NEWLINE_CRLF)
4106      {
4107      default:              newline = NEWLINE; break;   /* Compile-time default */
4108      case PCRE_NEWLINE_CR: newline = '\r'; break;
4109      case PCRE_NEWLINE_LF: newline = '\n'; break;
4110      case PCRE_NEWLINE_CR+
4111           PCRE_NEWLINE_LF: newline = ('\r' << 8) | '\n'; break;
4112      }
4113    
4114    if (newline > 255)
4115      {
4116      cd->nllen = 2;
4117      cd->nl[0] = (newline >> 8) & 255;
4118      cd->nl[1] = newline & 255;
4119      }
4120    else
4121      {
4122      cd->nllen = 1;
4123      cd->nl[0] = newline;
4124      }
4125    
4126  /* Maximum back reference and backref bitmap. This is updated for numeric  /* Maximum back reference and backref bitmap. This is updated for numeric
4127  references during the first pass, but for named references during the actual  references during the first pass, but for named references during the actual
4128  compile pass. The bitmap records up to 31 back references to help in deciding  compile pass. The bitmap records up to 31 back references to help in deciding
4129  whether (.*) can be treated as anchored or not. */  whether (.*) can be treated as anchored or not. */
4130    
4131  compile_block.top_backref = 0;  cd->top_backref = 0;
4132  compile_block.backref_map = 0;  cd->backref_map = 0;
4133    
4134  /* Reflect pattern for debugging output */  /* Reflect pattern for debugging output */
4135    
# Line 3960  while ((c = *(++ptr)) != 0) Line 4163  while ((c = *(++ptr)) != 0)
4163    
4164    if ((options & PCRE_EXTENDED) != 0)    if ((options & PCRE_EXTENDED) != 0)
4165      {      {
4166      if ((compile_block.ctypes[c] & ctype_space) != 0) continue;      if ((cd->ctypes[c] & ctype_space) != 0) continue;
4167      if (c == '#')      if (c == '#')
4168        {        {
4169        /* The space before the ; is to avoid a warning on a silly compiler        while (*(++ptr) != 0) if (IS_NEWLINE(ptr)) break;
4170        on the Macintosh. */        if (*ptr != 0)
4171        while ((c = *(++ptr)) != 0 && c != NEWLINE) ;          {
4172        if (c == 0) break;          ptr += cd->nllen - 1;
4173        continue;          continue;
4174            }
4175          break;    /* End loop at end of pattern */
4176        }        }
4177      }      }
4178    
# Line 4028  while ((c = *(++ptr)) != 0) Line 4233  while ((c = *(++ptr)) != 0)
4233  #endif  #endif
4234    
4235      /* \P and \p are for Unicode properties, but only when the support has      /* \P and \p are for Unicode properties, but only when the support has
4236      been compiled. Each item needs 2 bytes. */      been compiled. Each item needs 3 bytes. */
4237    
4238      else if (-c == ESC_P || -c == ESC_p)      else if (-c == ESC_P || -c == ESC_p)
4239        {        {
4240  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
4241        BOOL negated;        BOOL negated;
4242        length += 2;        BOOL pdata;
4243        lastitemlength = 2;        length += 3;
4244        if (get_ucp(&ptr, &negated, &errorcode) < 0) goto PCRE_ERROR_RETURN;        lastitemlength = 3;
4245          if (get_ucp(&ptr, &negated, &pdata, &errorcode) < 0)
4246            goto PCRE_ERROR_RETURN;
4247        continue;        continue;
4248  #else  #else
4249        errorcode = ERR45;        errorcode = ERR45;
# Line 4055  while ((c = *(++ptr)) != 0) Line 4262  while ((c = *(++ptr)) != 0)
4262      if (c <= -ESC_REF)      if (c <= -ESC_REF)
4263        {        {
4264        int refnum = -c - ESC_REF;        int refnum = -c - ESC_REF;
4265        compile_block.backref_map |= (refnum < 32)? (1 << refnum) : 1;        cd->backref_map |= (refnum < 32)? (1 << refnum) : 1;
4266        if (refnum > compile_block.top_backref)        if (refnum > cd->top_backref)
4267          compile_block.top_backref = refnum;          cd->top_backref = refnum;
4268        length += 2;   /* For single back reference */        length += 2;   /* For single back reference */
4269        if (ptr[1] == '{' && is_counted_repeat(ptr+2))        if (ptr[1] == '{' && is_counted_repeat(ptr+2))
4270          {          {
# Line 4202  while ((c = *(++ptr)) != 0) Line 4409  while ((c = *(++ptr)) != 0)
4409                class_utf8 = TRUE;                class_utf8 = TRUE;
4410                length += LINK_SIZE + 2;                length += LINK_SIZE + 2;
4411                }                }
4412              length += 2;              length += 3;
4413              }              }
4414  #endif  #endif
4415            }            }
# Line 4211  while ((c = *(++ptr)) != 0) Line 4418  while ((c = *(++ptr)) != 0)
4418        /* Check the syntax for POSIX stuff. The bits we actually handle are        /* Check the syntax for POSIX stuff. The bits we actually handle are
4419        checked during the real compile phase. */        checked during the real compile phase. */
4420    
4421        else if (*ptr == '[' && check_posix_syntax(ptr, &ptr, &compile_block))        else if (*ptr == '[' &&
4422                    (ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
4423                    check_posix_syntax(ptr, &ptr, cd))
4424          {          {
4425          ptr++;          ptr++;
4426          class_optcount = 10;    /* Make sure > 1 */          class_optcount = 10;    /* Make sure > 1 */
# Line 4410  while ((c = *(++ptr)) != 0) Line 4619  while ((c = *(++ptr)) != 0)
4619      case '(':      case '(':
4620      branch_newextra = 0;      branch_newextra = 0;
4621      bracket_length = 1 + LINK_SIZE;      bracket_length = 1 + LINK_SIZE;
4622        capturing = FALSE;
4623    
4624      /* Handle special forms of bracket, which all start (? */      /* Handle special forms of bracket, which all start (? */
4625    
# Line 4443  while ((c = *(++ptr)) != 0) Line 4653  while ((c = *(++ptr)) != 0)
4653          ptr += 2;          ptr += 2;
4654          break;          break;
4655    
4656            /* Named subpatterns are an extension copied from Python */
4657    
4658            case 'P':
4659            ptr += 3;
4660    
4661            /* Handle the definition of a named subpattern */
4662    
4663            if (*ptr == '<')
4664              {
4665              const uschar *p;    /* Don't amalgamate; some compilers */
4666              p = ++ptr;          /* grumble at autoincrement in declaration */
4667              while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
4668              if (*ptr != '>')
4669                {
4670                errorcode = ERR42;
4671                goto PCRE_ERROR_RETURN;
4672                }
4673              name_count++;
4674              if (name_count > MAX_NAME_COUNT)
4675                {
4676                errorcode = ERR49;
4677                goto PCRE_ERROR_RETURN;
4678                }
4679              if (ptr - p > max_name_size)
4680                {
4681                max_name_size = (ptr - p);
4682                if (max_name_size > MAX_NAME_SIZE)
4683                  {
4684                  errorcode = ERR48;
4685                  goto PCRE_ERROR_RETURN;
4686                  }
4687                }
4688              capturing = TRUE;   /* Named parentheses are always capturing */
4689              break;              /* Go handle capturing parentheses */
4690              }
4691    
4692            /* Handle back references and recursive calls to named subpatterns */
4693    
4694            if (*ptr == '=' || *ptr == '>')
4695              {
4696              length += 3 + 3*LINK_SIZE;  /* Allow for the automatic "once" */
4697              while ((cd->ctypes[*(++ptr)] & ctype_word) != 0);
4698              if (*ptr != ')')
4699                {
4700                errorcode = ERR42;
4701                goto PCRE_ERROR_RETURN;
4702                }
4703              goto RECURSE_CHECK_QUANTIFIED;
4704              }
4705    
4706            /* Unknown character after (?P */
4707    
4708            errorcode = ERR41;
4709            goto PCRE_ERROR_RETURN;
4710    
4711          /* (?R) specifies a recursive call to the regex, which is an extension          /* (?R) specifies a recursive call to the regex, which is an extension
4712          to provide the facility which can be obtained by (?p{perl-code}) in          to provide the facility which can be obtained by (?p{perl-code}) in
4713          Perl 5.6. In Perl 5.8 this has become (??{perl-code}).          Perl 5.6. In Perl 5.8 this has become (??{perl-code}).
# Line 4464  while ((c = *(++ptr)) != 0) Line 4729  while ((c = *(++ptr)) != 0)
4729            errorcode = ERR29;            errorcode = ERR29;
4730            goto PCRE_ERROR_RETURN;            goto PCRE_ERROR_RETURN;
4731            }            }
4732          length += 1 + LINK_SIZE;          length += 3 + 3*LINK_SIZE;  /* Allows for the automatic "once" */
4733    
4734          /* If this item is quantified, it will get wrapped inside brackets so          /* If this item is quantified, it will get wrapped inside brackets so
4735          as to use the code for quantified brackets. We jump down and use the          as to use the code for quantified brackets. We jump down and use the
4736          code that handles this for real brackets. */          code that handles this for real brackets. Come here from code for
4737            named recursions/subroutines. */
4738    
4739            RECURSE_CHECK_QUANTIFIED:
4740          if (ptr[1] == '+' || ptr[1] == '*' || ptr[1] == '?' || ptr[1] == '{')          if (ptr[1] == '+' || ptr[1] == '*' || ptr[1] == '?' || ptr[1] == '{')
4741            {            {
4742            length += 2 + 2 * LINK_SIZE;       /* to make bracketed */            length += 2 + 2 * LINK_SIZE;       /* to make bracketed */
# Line 4493  while ((c = *(++ptr)) != 0) Line 4760  while ((c = *(++ptr)) != 0)
4760          length += 2 + 2*LINK_SIZE;          length += 2 + 2*LINK_SIZE;
4761          continue;          continue;
4762    
         /* Named subpatterns are an extension copied from Python */  
   
         case 'P':  
         ptr += 3;  
         if (*ptr == '<')  
           {  
           const uschar *p;    /* Don't amalgamate; some compilers */  
           p = ++ptr;          /* grumble at autoincrement in declaration */  
           while ((compile_block.ctypes[*ptr] & ctype_word) != 0) ptr++;  
           if (*ptr != '>')  
             {  
             errorcode = ERR42;  
             goto PCRE_ERROR_RETURN;  
             }  
           name_count++;  
           if (ptr - p > max_name_size) max_name_size = (ptr - p);  
           break;  
           }  
   
         if (*ptr == '=' || *ptr == '>')  
           {  
           while ((compile_block.ctypes[*(++ptr)] & ctype_word) != 0);  
           if (*ptr != ')')  
             {  
             errorcode = ERR42;  
             goto PCRE_ERROR_RETURN;  
             }  
           break;  
           }  
   
         /* Unknown character after (?P */  
   
         errorcode = ERR41;  
         goto PCRE_ERROR_RETURN;  
   
4763          /* Lookbehinds are in Perl from version 5.005 */          /* Lookbehinds are in Perl from version 5.005 */
4764    
4765          case '<':          case '<':
# Line 4543  while ((c = *(++ptr)) != 0) Line 4775  while ((c = *(++ptr)) != 0)
4775    
4776          /* Conditionals are in Perl from version 5.005. The bracket must either          /* Conditionals are in Perl from version 5.005. The bracket must either
4777          be followed by a number (for bracket reference) or by an assertion          be followed by a number (for bracket reference) or by an assertion
4778          group, or (a PCRE extension) by 'R' for a recursion test. */          group. PCRE extends this by allowing a name to reference a named group;
4779            unfortunately, previously 'R' was implemented for a recursion test.
4780            When this is compiled, we look for the named group 'R' first. At this
4781            point we just do a basic syntax check. */
4782    
4783          case '(':          case '(':
4784          if (ptr[3] == 'R' && ptr[4] == ')')          if ((cd->ctypes[ptr[3]] & ctype_word) != 0)
           {  
           ptr += 4;  
           length += 3;  
           }  
         else if ((digitab[ptr[3]] & ctype_digit) != 0)  
4785            {            {
4786            ptr += 4;            ptr += 4;
4787            length += 3;            length += 3;
4788            while ((digitab[*ptr] & ctype_digit) != 0) ptr++;            while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
4789            if (*ptr != ')')            if (*ptr != ')')
4790              {              {
4791              errorcode = ERR26;              errorcode = ERR26;
# Line 4594  while ((c = *(++ptr)) != 0) Line 4824  while ((c = *(++ptr)) != 0)
4824              *optset |= PCRE_CASELESS;              *optset |= PCRE_CASELESS;
4825              continue;              continue;
4826    
4827                case 'J':
4828                *optset |= PCRE_DUPNAMES;
4829                options |= PCRE_JCHANGED;   /* Record that it changed */
4830                continue;
4831    
4832              case 'm':              case 'm':
4833              *optset |= PCRE_MULTILINE;              *optset |= PCRE_MULTILINE;
4834              continue;              continue;
# Line 4659  while ((c = *(++ptr)) != 0) Line 4894  while ((c = *(++ptr)) != 0)
4894              will lead to an over-estimate on the length, but this shouldn't              will lead to an over-estimate on the length, but this shouldn't
4895              matter very much. We also have to allow for resetting options at              matter very much. We also have to allow for resetting options at
4896              the start of any alternations, which we do by setting              the start of any alternations, which we do by setting
4897              branch_newextra to 2. Finally, we record whether the case-dependent              branch_newextra to 2. */
             flag ever changes within the regex. This is used by the "required  
             character" code. */  
4898    
4899              case ':':              case ':':
4900              if (((set|unset) & PCRE_IMS) != 0)              if (((set|unset) & PCRE_IMS) != 0)
4901                {                {
4902                length += 4;                length += 4;
4903                branch_newextra = 2;                branch_newextra = 2;
               if (((set|unset) & PCRE_CASELESS) != 0) options |= PCRE_ICHANGED;  
4904                }                }
4905              goto END_OPTIONS;              goto END_OPTIONS;
4906    
# Line 4695  while ((c = *(++ptr)) != 0) Line 4927  while ((c = *(++ptr)) != 0)
4927            continue;            continue;
4928            }            }
4929    
4930          /* If options were terminated by ':' control comes here. Fall through          /* If options were terminated by ':' control comes here. This is a
4931          to handle the group below. */          non-capturing group with an options change. There is nothing more that
4932            needs to be done because "capturing" is already set FALSE by default;
4933            we can just fall through. */
4934    
4935          }          }
4936        }        }
4937    
4938      /* Extracting brackets must be counted so we can process escapes in a      /* Ordinary parentheses, not followed by '?', are capturing unless
4939      Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to      PCRE_NO_AUTO_CAPTURE is set. */
4940      need an additional 3 bytes of store per extracting bracket. However, if  
4941      PCRE_NO_AUTO)CAPTURE is set, unadorned brackets become non-capturing, so we      else capturing = (options & PCRE_NO_AUTO_CAPTURE) == 0;
     must leave the count alone (it will aways be zero). */  
4942    
4943      else if ((options & PCRE_NO_AUTO_CAPTURE) == 0)      /* Capturing brackets must be counted so we can process escapes in a
4944        Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to need
4945        an additional 3 bytes of memory per capturing bracket. */
4946    
4947        if (capturing)
4948        {        {
4949        bracount++;        bracount++;
4950        if (bracount > EXTRACT_BASIC_MAX) bracket_length += 3;        if (bracount > EXTRACT_BASIC_MAX) bracket_length += 3;
# Line 4742  while ((c = *(++ptr)) != 0) Line 4980  while ((c = *(++ptr)) != 0)
4980        {        {
4981        duplength = length - brastack[--brastackptr];        duplength = length - brastack[--brastackptr];
4982        branch_extra = bralenstack[brastackptr];        branch_extra = bralenstack[brastackptr];
4983          /* This is a paranoid check to stop integer overflow later on */
4984          if (duplength > MAX_DUPLENGTH)
4985            {
4986            errorcode = ERR50;
4987            goto PCRE_ERROR_RETURN;
4988            }
4989        }        }
4990      else duplength = 0;      else duplength = 0;
4991    
# Line 4846  if (length > MAX_PATTERN_SIZE) Line 5090  if (length > MAX_PATTERN_SIZE)
5090    }    }
5091    
5092  /* Compute the size of data block needed and get it, either from malloc or  /* Compute the size of data block needed and get it, either from malloc or
5093  externally provided function. */  externally provided function. Integer overflow should no longer be possible
5094    because nowadays we limit the maximum value of name_count and max_name size. */
5095    
5096  size = length + sizeof(real_pcre) + name_count * (max_name_size + 3);  size = length + sizeof(real_pcre) + name_count * (max_name_size + 3);
5097  re = (real_pcre *)(pcre_malloc)(size);  re = (real_pcre *)(pcre_malloc)(size);
# Line 4876  re->nullpad = NULL; Line 5121  re->nullpad = NULL;
5121  /* 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
5122  passed around in the compile data block. */  passed around in the compile data block. */
5123    
5124  compile_block.names_found = 0;  cd->names_found = 0;
5125  compile_block.name_entry_size = max_name_size + 3;  cd->name_entry_size = max_name_size + 3;
5126  compile_block.name_table = (uschar *)re + re->name_table_offset;  cd->name_table = (uschar *)re + re->name_table_offset;
5127  codestart = compile_block.name_table + re->name_entry_size * re->name_count;  codestart = cd->name_table + re->name_entry_size * re->name_count;
5128  compile_block.start_code = codestart;  cd->start_code = codestart;
5129  compile_block.start_pattern = (const uschar *)pattern;  cd->start_pattern = (const uschar *)pattern;
5130  compile_block.req_varyopt = 0;  cd->req_varyopt = 0;
5131  compile_block.nopartial = FALSE;  cd->nopartial = FALSE;
5132    
5133  /* Set up a starting, non-extracting bracket, then compile the expression. On  /* Set up a starting, non-extracting bracket, then compile the expression. On
5134  error, errorcode will be set non-zero, so we don't need to look at the result  error, errorcode will be set non-zero, so we don't need to look at the result
# Line 4894  code = (uschar *)codestart; Line 5139  code = (uschar *)codestart;
5139  *code = OP_BRA;  *code = OP_BRA;
5140  bracount = 0;  bracount = 0;
5141  (void)compile_regex(options, options & PCRE_IMS, &bracount, &code, &ptr,  (void)compile_regex(options, options & PCRE_IMS, &bracount, &code, &ptr,
5142    &errorcode, FALSE, 0, &firstbyte, &reqbyte, NULL, &compile_block);    &errorcode, FALSE, 0, &firstbyte, &reqbyte, NULL, cd);
5143  re->top_bracket = bracount;  re->top_bracket = bracount;
5144  re->top_backref = compile_block.top_backref;  re->top_backref = cd->top_backref;
5145    
5146  if (compile_block.nopartial) re->options |= PCRE_NOPARTIAL;  if (cd->nopartial) re->options |= PCRE_NOPARTIAL;
5147    
5148  /* If not reached end of pattern on success, there's an excess bracket. */  /* If not reached end of pattern on success, there's an excess bracket. */
5149    
# Line 4944  start with ^. and also when all branches Line 5189  start with ^. and also when all branches
5189  if ((options & PCRE_ANCHORED) == 0)  if ((options & PCRE_ANCHORED) == 0)
5190    {    {
5191    int temp_options = options;    int temp_options = options;
5192    if (is_anchored(codestart, &temp_options, 0, compile_block.backref_map))    if (is_anchored(codestart, &temp_options, 0, cd->backref_map))
5193      re->options |= PCRE_ANCHORED;      re->options |= PCRE_ANCHORED;
5194    else    else
5195      {      {
# Line 4954  if ((options & PCRE_ANCHORED) == 0) Line 5199  if ((options & PCRE_ANCHORED) == 0)
5199        {        {
5200        int ch = firstbyte & 255;        int ch = firstbyte & 255;
5201        re->first_byte = ((firstbyte & REQ_CASELESS) != 0 &&        re->first_byte = ((firstbyte & REQ_CASELESS) != 0 &&
5202           compile_block.fcc[ch] == ch)? ch : firstbyte;           cd->fcc[ch] == ch)? ch : firstbyte;
5203        re->options |= PCRE_FIRSTSET;        re->options |= PCRE_FIRSTSET;
5204        }        }
5205      else if (is_startline(codestart, 0, compile_block.backref_map))      else if (is_startline(codestart, 0, cd->backref_map))
5206        re->options |= PCRE_STARTLINE;        re->options |= PCRE_STARTLINE;
5207      }      }
5208    }    }
# Line 4971  if (reqbyte >= 0 && Line 5216  if (reqbyte >= 0 &&
5216    {    {
5217    int ch = reqbyte & 255;    int ch = reqbyte & 255;
5218    re->req_byte = ((reqbyte & REQ_CASELESS) != 0 &&    re->req_byte = ((reqbyte & REQ_CASELESS) != 0 &&
5219      compile_block.fcc[ch] == ch)? (reqbyte & ~REQ_CASELESS) : reqbyte;      cd->fcc[ch] == ch)? (reqbyte & ~REQ_CASELESS) : reqbyte;
5220    re->options |= PCRE_REQCHSET;    re->options |= PCRE_REQCHSET;
5221    }    }
5222    
5223  /* Print out the compiled data for debugging */  /* Print out the compiled data if debugging is enabled. This is never the
5224    case when building a production library. */
5225    
5226  #ifdef DEBUG  #ifdef DEBUG
5227    
# Line 4984  printf("Length = %d top_bracket = %d top Line 5230  printf("Length = %d top_bracket = %d top
5230    
5231  if (re->options != 0)  if (re->options != 0)
5232    {    {
5233    printf("%s%s%s%s%s%s%s%s%s%s\n",    printf("%s%s%s%s%s%s%s%s%s\n",
5234      ((re->options & PCRE_NOPARTIAL) != 0)? "nopartial " : "",      ((re->options & PCRE_NOPARTIAL) != 0)? "nopartial " : "",
5235      ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "",      ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "",
5236      ((re->options & PCRE_CASELESS) != 0)? "caseless " : "",      ((re->options & PCRE_CASELESS) != 0)? "caseless " : "",
     ((re->options & PCRE_ICHANGED) != 0)? "case state changed " : "",  
5237      ((re->options & PCRE_EXTENDED) != 0)? "extended " : "",      ((re->options & PCRE_EXTENDED) != 0)? "extended " : "",
5238      ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "",      ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "",
5239      ((re->options & PCRE_DOTALL) != 0)? "dotall " : "",      ((re->options & PCRE_DOTALL) != 0)? "dotall " : "",
# Line 5000  if (re->options != 0) Line 5245  if (re->options != 0)
5245  if ((re->options & PCRE_FIRSTSET) != 0)  if ((re->options & PCRE_FIRSTSET) != 0)
5246    {    {
5247    int ch = re->first_byte & 255;    int ch = re->first_byte & 255;
5248    const char *caseless = ((re->first_byte & REQ_CASELESS) == 0)? "" : " (caseless)";    const char *caseless = ((re->first_byte & REQ_CASELESS) == 0)?
5249        "" : " (caseless)";
5250    if (isprint(ch)) printf("First char = %c%s\n", ch, caseless);    if (isprint(ch)) printf("First char = %c%s\n", ch, caseless);
5251      else printf("First char = \\x%02x%s\n", ch, caseless);      else printf("First char = \\x%02x%s\n", ch, caseless);
5252    }    }
# Line 5008  if ((re->options & PCRE_FIRSTSET) != 0) Line 5254  if ((re->options & PCRE_FIRSTSET) != 0)
5254  if ((re->options & PCRE_REQCHSET) != 0)  if ((re->options & PCRE_REQCHSET) != 0)
5255    {    {
5256    int ch = re->req_byte & 255;    int ch = re->req_byte & 255;
5257    const char *caseless = ((re->req_byte & REQ_CASELESS) == 0)? "" : " (caseless)";    const char *caseless = ((re->req_byte & REQ_CASELESS) == 0)?
5258        "" : " (caseless)";
5259    if (isprint(ch)) printf("Req char = %c%s\n", ch, caseless);    if (isprint(ch)) printf("Req char = %c%s\n", ch, caseless);
5260      else printf("Req char = \\x%02x%s\n", ch, caseless);      else printf("Req char = \\x%02x%s\n", ch, caseless);
5261    }    }
5262    
5263  _pcre_printint(re, stdout);  pcre_printint(re, stdout);
5264    
5265  /* 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
5266  was compiled can be seen. */  was compiled can be seen. */

Legend:
Removed from v.79  
changed lines
  Added in v.91

  ViewVC Help
Powered by ViewVC 1.1.5