/[pcre]/code/trunk/pcre_exec.c
ViewVC logotype

Diff of /code/trunk/pcre_exec.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 933 by ph10, Sat Feb 25 12:18:23 2012 UTC revision 976 by ph10, Sat Jun 16 17:53:17 2012 UTC
# Line 37  POSSIBILITY OF SUCH DAMAGE. Line 37  POSSIBILITY OF SUCH DAMAGE.
37  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
38  */  */
39    
   
40  /* This module contains pcre_exec(), the externally visible function that does  /* This module contains pcre_exec(), the externally visible function that does
41  pattern matching using an NFA algorithm, trying to mimic Perl as closely as  pattern matching using an NFA algorithm, trying to mimic Perl as closely as
42  possible. There are also some static supporting functions. */  possible. There are also some static supporting functions. */
# Line 907  for (;;) Line 906  for (;;)
906        }        }
907      else  /* OP_KETRMAX */      else  /* OP_KETRMAX */
908        {        {
       md->match_function_type = MATCH_CBEGROUP;  
909        RMATCH(eptr, prev, offset_top, md, eptrb, RM66);        RMATCH(eptr, prev, offset_top, md, eptrb, RM66);
910        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
911        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
# Line 1036  for (;;) Line 1034  for (;;)
1034    
1035      for (;;)      for (;;)
1036        {        {
1037        if (op >= OP_SBRA || op == OP_ONCE) md->match_function_type = MATCH_CBEGROUP;        if (op >= OP_SBRA || op == OP_ONCE)
1038            md->match_function_type = MATCH_CBEGROUP;
1039    
1040        /* If this is not a possibly empty group, and there are no (*THEN)s in        /* If this is not a possibly empty group, and there are no (*THEN)s in
1041        the pattern, and this is the final alternative, optimize as described        the pattern, and this is the final alternative, optimize as described
# Line 1575  for (;;) Line 1574  for (;;)
1574          mstart = md->start_match_ptr;   /* In case \K reset it */          mstart = md->start_match_ptr;   /* In case \K reset it */
1575          break;          break;
1576          }          }
1577          md->mark = save_mark;
1578    
1579        /* PCRE does not allow THEN to escape beyond an assertion; it is treated        /* A COMMIT failure must fail the entire assertion, without trying any
1580        as NOMATCH. */        subsequent branches. */
1581    
1582          if (rrc == MATCH_COMMIT) RRETURN(MATCH_NOMATCH);
1583    
1584          /* PCRE does not allow THEN to escape beyond an assertion; it
1585          is treated as NOMATCH. */
1586    
1587        if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);        if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
1588        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
       md->mark = save_mark;  
1589        }        }
1590      while (*ecode == OP_ALT);      while (*ecode == OP_ALT);
1591    
# Line 1789  for (;;) Line 1793  for (;;)
1793            goto RECURSION_MATCHED;        /* Exit loop; end processing */            goto RECURSION_MATCHED;        /* Exit loop; end processing */
1794            }            }
1795    
1796          /* PCRE does not allow THEN to escape beyond a recursion; it is treated          /* PCRE does not allow THEN or COMMIT to escape beyond a recursion; it
1797          as NOMATCH. */          is treated as NOMATCH. */
1798    
1799          else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)          else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN &&
1800                     rrc != MATCH_COMMIT)
1801            {            {
1802            DPRINTF(("Recursion gave error %d\n", rrc));            DPRINTF(("Recursion gave error %d\n", rrc));
1803            if (new_recursive.offset_save != stacksave)            if (new_recursive.offset_save != stacksave)
# Line 2003  for (;;) Line 2008  for (;;)
2008          }          }
2009        if (*prev >= OP_SBRA)    /* Could match an empty string */        if (*prev >= OP_SBRA)    /* Could match an empty string */
2010          {          {
         md->match_function_type = MATCH_CBEGROUP;  
2011          RMATCH(eptr, prev, offset_top, md, eptrb, RM50);          RMATCH(eptr, prev, offset_top, md, eptrb, RM50);
2012          RRETURN(rrc);          RRETURN(rrc);
2013          }          }
# Line 2012  for (;;) Line 2016  for (;;)
2016        }        }
2017      else  /* OP_KETRMAX */      else  /* OP_KETRMAX */
2018        {        {
       if (*prev >= OP_SBRA) md->match_function_type = MATCH_CBEGROUP;  
2019        RMATCH(eptr, prev, offset_top, md, eptrb, RM13);        RMATCH(eptr, prev, offset_top, md, eptrb, RM13);
2020        if (rrc == MATCH_ONCE && md->once_target == prev) rrc = MATCH_NOMATCH;        if (rrc == MATCH_ONCE && md->once_target == prev) rrc = MATCH_NOMATCH;
2021        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
# Line 3425  for (;;) Line 3428  for (;;)
3428      maximizing, find the maximum number of characters and work backwards. */      maximizing, find the maximum number of characters and work backwards. */
3429    
3430      DPRINTF(("matching %c{%d,%d} against subject %.*s\n", fc, min, max,      DPRINTF(("matching %c{%d,%d} against subject %.*s\n", fc, min, max,
3431        max, eptr));        max, (char *)eptr));
3432    
3433      if (op >= OP_STARI)  /* Caseless */      if (op >= OP_STARI)  /* Caseless */
3434        {        {
# Line 3694  for (;;) Line 3697  for (;;)
3697      characters and work backwards. */      characters and work backwards. */
3698    
3699      DPRINTF(("negative matching %c{%d,%d} against subject %.*s\n", fc, min, max,      DPRINTF(("negative matching %c{%d,%d} against subject %.*s\n", fc, min, max,
3700        max, eptr));        max, (char *)eptr));
3701    
3702      if (op >= OP_NOTSTARI)     /* Caseless */      if (op >= OP_NOTSTARI)     /* Caseless */
3703        {        {
# Line 6463  if (extra_data != NULL Line 6466  if (extra_data != NULL
6466                      PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART |                      PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART |
6467                      PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD)) == 0)                      PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD)) == 0)
6468    {    {
6469    rc = PRIV(jit_exec)(re, extra_data->executable_jit,    rc = PRIV(jit_exec)(re, extra_data, (const pcre_uchar *)subject, length,
6470      (const pcre_uchar *)subject, length, start_offset, options,         start_offset, options, offsets, offsetcount);
     ((extra_data->flags & PCRE_EXTRA_MATCH_LIMIT) == 0)  
     ? MATCH_LIMIT : extra_data->match_limit, offsets, offsetcount,  
     ((extra_data->flags & PCRE_EXTRA_MARK) != 0) ? extra_data->mark : NULL);  
6471    
6472    /* PCRE_ERROR_NULL means that the selected normal or partial matching    /* PCRE_ERROR_NULL means that the selected normal or partial matching
6473    mode is not compiled. In this case we simply fallback to interpreter. */    mode is not compiled. In this case we simply fallback to interpreter. */
# Line 7067  if (rc == MATCH_MATCH || rc == MATCH_ACC Line 7067  if (rc == MATCH_MATCH || rc == MATCH_ACC
7067      {      {
7068      register int *iptr, *iend;      register int *iptr, *iend;
7069      int resetcount = 2 + re->top_bracket * 2;      int resetcount = 2 + re->top_bracket * 2;
7070      if (resetcount > offsetcount) resetcount = ocount;      if (resetcount > offsetcount) resetcount = offsetcount;
7071      iptr = offsets + md->end_offset_top;      iptr = offsets + md->end_offset_top;
7072      iend = offsets + resetcount;      iend = offsets + resetcount;
7073      while (iptr < iend) *iptr++ = -1;      while (iptr < iend) *iptr++ = -1;

Legend:
Removed from v.933  
changed lines
  Added in v.976

  ViewVC Help
Powered by ViewVC 1.1.5