/[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 218 by ph10, Thu Aug 16 10:13:23 2007 UTC revision 220 by ph10, Thu Aug 16 13:29:39 2007 UTC
# Line 283  static const char *error_texts[] = { Line 283  static const char *error_texts[] = {
283    "(*VERB) with an argument is not supported",    "(*VERB) with an argument is not supported",
284    /* 60 */    /* 60 */
285    "(*VERB) not recognized",    "(*VERB) not recognized",
286    "number is too big"    "number is too big"
287  };  };
288    
289    
# Line 524  else Line 524  else
524      c = 0;      c = 0;
525      while ((digitab[ptr[1]] & ctype_digit) != 0)      while ((digitab[ptr[1]] & ctype_digit) != 0)
526        c = c * 10 + *(++ptr) - '0';        c = c * 10 + *(++ptr) - '0';
527    
528      if (c < 0)      if (c < 0)
529        {        {
530        *errorcodeptr = ERR61;        *errorcodeptr = ERR61;
531        break;        break;
532        }        }
533    
534      if (c == 0 || (braced && *(++ptr) != '}'))      if (c == 0 || (braced && *(++ptr) != '}'))
535        {        {
# Line 574  else Line 574  else
574        if (c < 0)        if (c < 0)
575          {          {
576          *errorcodeptr = ERR61;          *errorcodeptr = ERR61;
577          break;          break;
578          }          }
579        if (c < 10 || c <= bracount)        if (c < 10 || c <= bracount)
580          {          {
581          c = -(ESC_REF + c);          c = -(ESC_REF + c);
# Line 950  for (; *ptr != 0; ptr++) Line 950  for (; *ptr != 0; ptr++)
950      {      {
951      while (*(++ptr) != ']')      while (*(++ptr) != ']')
952        {        {
953        if (*ptr == 0) return -1;        if (*ptr == 0) return -1;
954        if (*ptr == '\\')        if (*ptr == '\\')
955          {          {
956          if (*(++ptr) == 0) return -1;          if (*(++ptr) == 0) return -1;
# Line 1194  for (;;) Line 1194  for (;;)
1194    
1195      case OP_TYPEEXACT:      case OP_TYPEEXACT:
1196      branchlength += GET2(cc,1);      branchlength += GET2(cc,1);
1197      if (cc[3] == OP_PROP || cc[3] == OP_NOTPROP) cc += 2;      if (cc[3] == OP_PROP || cc[3] == OP_NOTPROP) cc += 2;
1198      cc += 4;      cc += 4;
1199      break;      break;
1200    
# Line 1303  for (;;) Line 1303  for (;;)
1303      code += _pcre_OP_lengths[c];      code += _pcre_OP_lengths[c];
1304      }      }
1305    
1306    /* Otherwise, we can get the item's length from the table, except that for    /* Otherwise, we can get the item's length from the table, except that for
1307    repeated character types, we have to test for \p and \P, which have an extra    repeated character types, we have to test for \p and \P, which have an extra
1308    two bytes of parameters. */    two bytes of parameters. */
1309    
1310    else    else
# Line 1325  for (;;) Line 1325  for (;;)
1325        case OP_TYPEPOSQUERY:        case OP_TYPEPOSQUERY:
1326        case OP_TYPEPOSUPTO:        case OP_TYPEPOSUPTO:
1327        if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;        if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
1328        break;        break;
1329        }        }
1330    
1331      /* Add in the fixed length from the table */      /* Add in the fixed length from the table */
1332    
1333      code += _pcre_OP_lengths[c];      code += _pcre_OP_lengths[c];
1334    
1335    /* In UTF-8 mode, opcodes that are followed by a character may be followed by    /* In UTF-8 mode, opcodes that are followed by a character may be followed by
1336    a multi-byte character. The length in the table is a minimum, so we have to    a multi-byte character. The length in the table is a minimum, so we have to
1337    arrange to skip the extra bytes. */    arrange to skip the extra bytes. */
1338    
1339  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1340      if (utf8) switch(c)      if (utf8) switch(c)
1341        {        {
# Line 1386  for (;;) Line 1386  for (;;)
1386    register int c = *code;    register int c = *code;
1387    if (c == OP_END) return NULL;    if (c == OP_END) return NULL;
1388    if (c == OP_RECURSE) return code;    if (c == OP_RECURSE) return code;
1389    
1390    /* XCLASS is used for classes that cannot be represented just by a bit    /* XCLASS is used for classes that cannot be represented just by a bit
1391    map. This includes negated single high-valued characters. The length in    map. This includes negated single high-valued characters. The length in
1392    the table is zero; the actual length is stored in the compiled code. */    the table is zero; the actual length is stored in the compiled code. */
1393    
1394    if (c == OP_XCLASS) code += GET(code, 1);    if (c == OP_XCLASS) code += GET(code, 1);
1395    
1396    /* Otherwise, we can get the item's length from the table, except that for    /* Otherwise, we can get the item's length from the table, except that for
1397    repeated character types, we have to test for \p and \P, which have an extra    repeated character types, we have to test for \p and \P, which have an extra
1398    two bytes of parameters. */    two bytes of parameters. */
1399    
1400    else    else
# Line 1415  for (;;) Line 1415  for (;;)
1415        case OP_TYPEPOSQUERY:        case OP_TYPEPOSQUERY:
1416        case OP_TYPEPOSUPTO:        case OP_TYPEPOSUPTO:
1417        if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;        if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
1418        break;        break;
1419        }        }
1420    
1421      /* Add in the fixed length from the table */      /* Add in the fixed length from the table */
1422    
1423      code += _pcre_OP_lengths[c];      code += _pcre_OP_lengths[c];
1424    
1425      /* In UTF-8 mode, opcodes that are followed by a character may be followed      /* In UTF-8 mode, opcodes that are followed by a character may be followed
1426      by a multi-byte character. The length in the table is a minimum, so we have      by a multi-byte character. The length in the table is a minimum, so we have
1427      to arrange to skip the extra bytes. */      to arrange to skip the extra bytes. */
1428    
1429  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1430      if (utf8) switch(c)      if (utf8) switch(c)
1431        {        {
# Line 1524  for (code = first_significant_code(code Line 1524  for (code = first_significant_code(code
1524      /* Check for quantifiers after a class. XCLASS is used for classes that      /* Check for quantifiers after a class. XCLASS is used for classes that
1525      cannot be represented just by a bit map. This includes negated single      cannot be represented just by a bit map. This includes negated single
1526      high-valued characters. The length in _pcre_OP_lengths[] is zero; the      high-valued characters. The length in _pcre_OP_lengths[] is zero; the
1527      actual length is stored in the compiled code, so we must update "code"      actual length is stored in the compiled code, so we must update "code"
1528      here. */      here. */
1529    
1530  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 2722  for (;; ptr++) Line 2722  for (;; ptr++)
2722            else inescq = TRUE;            else inescq = TRUE;
2723            continue;            continue;
2724            }            }
2725          else if (-c == ESC_E) continue;  /* Ignore orphan \E */          else if (-c == ESC_E) continue;  /* Ignore orphan \E */
2726    
2727          if (c < 0)          if (c < 0)
2728            {            {
# Line 4798  for (;; ptr++) Line 4798  for (;; ptr++)
4798        }        }
4799    
4800      /* In the pre-compile phase, update the length by the length of the group,      /* In the pre-compile phase, update the length by the length of the group,
4801      less the brackets at either end. Then reduce the compiled code to just a      less the brackets at either end. Then reduce the compiled code to just a
4802      set of non-capturing brackets so that it doesn't use much memory if it is      set of non-capturing brackets so that it doesn't use much memory if it is
4803      duplicated by a quantifier.*/      duplicated by a quantifier.*/
4804    
# Line 4810  for (;; ptr++) Line 4810  for (;; ptr++)
4810          goto FAILED;          goto FAILED;
4811          }          }
4812        *lengthptr += length_prevgroup - 2 - 2*LINK_SIZE;        *lengthptr += length_prevgroup - 2 - 2*LINK_SIZE;
4813        *code++ = OP_BRA;        *code++ = OP_BRA;
4814        PUTINC(code, 0, 1 + LINK_SIZE);        PUTINC(code, 0, 1 + LINK_SIZE);
4815        *code++ = OP_KET;        *code++ = OP_KET;
4816        PUTINC(code, 0, 1 + LINK_SIZE);        PUTINC(code, 0, 1 + LINK_SIZE);

Legend:
Removed from v.218  
changed lines
  Added in v.220

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12