/[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 746 by ph10, Tue Nov 15 15:07:02 2011 UTC revision 747 by ph10, Tue Nov 15 17:35:10 2011 UTC
# Line 410  static const char error_texts[] = Line 410  static const char error_texts[] =
410    "this version of PCRE is not compiled with PCRE_UCP support\0"    "this version of PCRE is not compiled with PCRE_UCP support\0"
411    "\\c must be followed by an ASCII character\0"    "\\c must be followed by an ASCII character\0"
412    "\\k is not followed by a braced, angle-bracketed, or quoted name\0"    "\\k is not followed by a braced, angle-bracketed, or quoted name\0"
413      /* 70 */
414      "internal error: unknown opcode in find_fixedlength()\0"
415    ;    ;
416    
417  /* Table to identify digits and hex digits. This is used when compiling  /* Table to identify digits and hex digits. This is used when compiling
# Line 1528  Returns: the fixed length, Line 1530  Returns: the fixed length,
1530               or -1 if there is no fixed length,               or -1 if there is no fixed length,
1531               or -2 if \C was encountered               or -2 if \C was encountered
1532               or -3 if an OP_RECURSE item was encountered and atend is FALSE               or -3 if an OP_RECURSE item was encountered and atend is FALSE
1533                 or -4 if an unknown opcode was encountered (internal error)
1534  */  */
1535    
1536  static int  static int
# Line 1551  for (;;) Line 1554  for (;;)
1554      /* We only need to continue for OP_CBRA (normal capturing bracket) and      /* We only need to continue for OP_CBRA (normal capturing bracket) and
1555      OP_BRA (normal non-capturing bracket) because the other variants of these      OP_BRA (normal non-capturing bracket) because the other variants of these
1556      opcodes are all concerned with unlimited repeated groups, which of course      opcodes are all concerned with unlimited repeated groups, which of course
1557      are not of fixed length. They will cause a -1 response from the default      are not of fixed length. */
     case of this switch. */  
1558    
1559      case OP_CBRA:      case OP_CBRA:
1560      case OP_BRA:      case OP_BRA:
# Line 1566  for (;;) Line 1568  for (;;)
1568      cc += 1 + LINK_SIZE;      cc += 1 + LINK_SIZE;
1569      break;      break;
1570    
1571      /* Reached end of a branch; if it's a ket it is the end of a nested      /* Reached end of a branch; if it's a ket it is the end of a nested call.
1572      call. If it's ALT it is an alternation in a nested call. If it is      If it's ALT it is an alternation in a nested call. An ACCEPT is effectively
1573      END it's the end of the outer call. All can be handled by the same code.      an ALT. If it is END it's the end of the outer call. All can be handled by
1574      Note that we must not include the OP_KETRxxx opcodes here, because they      the same code. Note that we must not include the OP_KETRxxx opcodes here,
1575      all imply an unlimited repeat. */      because they all imply an unlimited repeat. */
1576    
1577      case OP_ALT:      case OP_ALT:
1578      case OP_KET:      case OP_KET:
1579      case OP_END:      case OP_END:
1580        case OP_ACCEPT:
1581        case OP_ASSERT_ACCEPT:
1582      if (length < 0) length = branchlength;      if (length < 0) length = branchlength;
1583        else if (length != branchlength) return -1;        else if (length != branchlength) return -1;
1584      if (*cc != OP_ALT) return length;      if (*cc != OP_ALT) return length;
# Line 1608  for (;;) Line 1612  for (;;)
1612    
1613      /* Skip over things that don't match chars */      /* Skip over things that don't match chars */
1614    
1615      case OP_REVERSE:      case OP_MARK:
1616      case OP_CREF:      case OP_PRUNE_ARG:
1617      case OP_NCREF:      case OP_SKIP_ARG:
1618      case OP_RREF:      case OP_THEN_ARG:
1619      case OP_NRREF:      cc += cc[1] + _pcre_OP_lengths[*cc];
1620      case OP_DEF:      break;
1621    
1622      case OP_CALLOUT:      case OP_CALLOUT:
     case OP_SOD:  
     case OP_SOM:  
     case OP_SET_SOM:  
     case OP_EOD:  
     case OP_EODN:  
1623      case OP_CIRC:      case OP_CIRC:
1624      case OP_CIRCM:      case OP_CIRCM:
1625        case OP_CLOSE:
1626        case OP_COMMIT:
1627        case OP_CREF:
1628        case OP_DEF:
1629      case OP_DOLL:      case OP_DOLL:
1630      case OP_DOLLM:      case OP_DOLLM:
1631        case OP_EOD:
1632        case OP_EODN:
1633        case OP_FAIL:
1634        case OP_NCREF:
1635        case OP_NRREF:
1636      case OP_NOT_WORD_BOUNDARY:      case OP_NOT_WORD_BOUNDARY:
1637        case OP_PRUNE:
1638        case OP_REVERSE:
1639        case OP_RREF:
1640        case OP_SET_SOM:
1641        case OP_SKIP:
1642        case OP_SOD:
1643        case OP_SOM:
1644        case OP_THEN:
1645      case OP_WORD_BOUNDARY:      case OP_WORD_BOUNDARY:
1646      cc += _pcre_OP_lengths[*cc];      cc += _pcre_OP_lengths[*cc];
1647      break;      break;
# Line 1646  for (;;) Line 1663  for (;;)
1663      need to skip over a multibyte character in UTF8 mode.  */      need to skip over a multibyte character in UTF8 mode.  */
1664    
1665      case OP_EXACT:      case OP_EXACT:
1666      case OP_EXACTI:      case OP_EXACTI:
1667        case OP_NOTEXACT:
1668        case OP_NOTEXACTI:
1669      branchlength += GET2(cc,1);      branchlength += GET2(cc,1);
1670      cc += 4;      cc += 4;
1671  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 1667  for (;;) Line 1686  for (;;)
1686      cc += 2;      cc += 2;
1687      /* Fall through */      /* Fall through */
1688    
1689        case OP_HSPACE:
1690        case OP_VSPACE:
1691        case OP_NOT_HSPACE:
1692        case OP_NOT_VSPACE:
1693      case OP_NOT_DIGIT:      case OP_NOT_DIGIT:
1694      case OP_DIGIT:      case OP_DIGIT:
1695      case OP_NOT_WHITESPACE:      case OP_NOT_WHITESPACE:
# Line 1698  for (;;) Line 1721  for (;;)
1721    
1722      switch (*cc)      switch (*cc)
1723        {        {
1724          case OP_CRPLUS:
1725          case OP_CRMINPLUS:
1726        case OP_CRSTAR:        case OP_CRSTAR:
1727        case OP_CRMINSTAR:        case OP_CRMINSTAR:
1728        case OP_CRQUERY:        case OP_CRQUERY:
# Line 1718  for (;;) Line 1743  for (;;)
1743    
1744      /* Anything else is variable length */      /* Anything else is variable length */
1745    
1746      default:      case OP_ANYNL:
1747        case OP_BRAMINZERO:
1748        case OP_BRAPOS:
1749        case OP_BRAPOSZERO:
1750        case OP_BRAZERO:
1751        case OP_CBRAPOS:
1752        case OP_EXTUNI:
1753        case OP_KETRMAX:
1754        case OP_KETRMIN:
1755        case OP_KETRPOS:
1756        case OP_MINPLUS:
1757        case OP_MINPLUSI:
1758        case OP_MINQUERY:
1759        case OP_MINQUERYI:
1760        case OP_MINSTAR:
1761        case OP_MINSTARI:
1762        case OP_MINUPTO:
1763        case OP_MINUPTOI:
1764        case OP_NOTMINPLUS:
1765        case OP_NOTMINPLUSI:
1766        case OP_NOTMINQUERY:
1767        case OP_NOTMINQUERYI:
1768        case OP_NOTMINSTAR:
1769        case OP_NOTMINSTARI:
1770        case OP_NOTMINUPTO:
1771        case OP_NOTMINUPTOI:
1772        case OP_NOTPLUS:
1773        case OP_NOTPLUSI:
1774        case OP_NOTPOSPLUS:
1775        case OP_NOTPOSPLUSI:
1776        case OP_NOTPOSQUERY:
1777        case OP_NOTPOSQUERYI:
1778        case OP_NOTPOSSTAR:
1779        case OP_NOTPOSSTARI:
1780        case OP_NOTPOSUPTO:
1781        case OP_NOTPOSUPTOI:
1782        case OP_NOTQUERY:
1783        case OP_NOTQUERYI:
1784        case OP_NOTSTAR:
1785        case OP_NOTSTARI:
1786        case OP_NOTUPTO:
1787        case OP_NOTUPTOI:
1788        case OP_PLUS:
1789        case OP_PLUSI:
1790        case OP_POSPLUS:
1791        case OP_POSPLUSI:
1792        case OP_POSQUERY:
1793        case OP_POSQUERYI:
1794        case OP_POSSTAR:
1795        case OP_POSSTARI:
1796        case OP_POSUPTO:
1797        case OP_POSUPTOI:
1798        case OP_QUERY:
1799        case OP_QUERYI:
1800        case OP_REF:
1801        case OP_REFI:
1802        case OP_SBRA:
1803        case OP_SBRAPOS:
1804        case OP_SCBRA:
1805        case OP_SCBRAPOS:
1806        case OP_SCOND:
1807        case OP_SKIPZERO:
1808        case OP_STAR:
1809        case OP_STARI:
1810        case OP_TYPEMINPLUS:
1811        case OP_TYPEMINQUERY:
1812        case OP_TYPEMINSTAR:
1813        case OP_TYPEMINUPTO:
1814        case OP_TYPEPLUS:
1815        case OP_TYPEPOSPLUS:
1816        case OP_TYPEPOSQUERY:
1817        case OP_TYPEPOSSTAR:
1818        case OP_TYPEPOSUPTO:
1819        case OP_TYPEQUERY:
1820        case OP_TYPESTAR:
1821        case OP_TYPEUPTO:
1822        case OP_UPTO:
1823        case OP_UPTOI:
1824      return -1;      return -1;
1825    
1826        /* Catch unrecognized opcodes so that when new ones are added they
1827        are not forgotten, as has happened in the past. */
1828    
1829        default:
1830        return -4;
1831      }      }
1832    }    }
1833  /* Control never gets here */  /* Control never gets here */
# Line 6615  for (;;) Line 6723  for (;;)
6723          }          }
6724        else if (fixed_length < 0)        else if (fixed_length < 0)
6725          {          {
6726          *errorcodeptr = (fixed_length == -2)? ERR36 : ERR25;          *errorcodeptr = (fixed_length == -2)? ERR36 :
6727                            (fixed_length == -4)? ERR70: ERR25;
6728          *ptrptr = ptr;          *ptrptr = ptr;
6729          return FALSE;          return FALSE;
6730          }          }
# Line 7414  if (cd->check_lookbehind) Line 7523  if (cd->check_lookbehind)
7523        DPRINTF(("fixed length = %d\n", fixed_length));        DPRINTF(("fixed length = %d\n", fixed_length));
7524        if (fixed_length < 0)        if (fixed_length < 0)
7525          {          {
7526          errorcode = (fixed_length == -2)? ERR36 : ERR25;          errorcode = (fixed_length == -2)? ERR36 :
7527                        (fixed_length == -4)? ERR70 : ERR25;
7528          break;          break;
7529          }          }
7530        PUT(cc, 1, fixed_length);        PUT(cc, 1, fixed_length);

Legend:
Removed from v.746  
changed lines
  Added in v.747

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12