/[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 963 by ph10, Sat Apr 21 18:06:31 2012 UTC revision 1011 by ph10, Sat Aug 25 11:36:15 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 1577  for (;;) Line 1576  for (;;)
1576          }          }
1577        md->mark = save_mark;        md->mark = save_mark;
1578    
1579        /* A COMMIT failure must fail the entire assertion, without trying any        /* A COMMIT failure must fail the entire assertion, without trying any
1580        subsequent branches. */        subsequent branches. */
1581    
1582        if (rrc == MATCH_COMMIT) RRETURN(MATCH_NOMATCH);        if (rrc == MATCH_COMMIT) RRETURN(MATCH_NOMATCH);
1583    
1584        /* PCRE does not allow THEN to escape beyond an assertion; it        /* PCRE does not allow THEN to escape beyond an assertion; it
# Line 2009  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 2018  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 2644  for (;;) Line 2641  for (;;)
2641        SCHECK_PARTIAL();        SCHECK_PARTIAL();
2642        RRETURN(MATCH_NOMATCH);        RRETURN(MATCH_NOMATCH);
2643        }        }
2644      GETCHARINCTEST(c, eptr);      else
2645      if (UCD_CATEGORY(c) == ucp_M) RRETURN(MATCH_NOMATCH);        {
2646      while (eptr < md->end_subject)        int lgb, rgb;
2647        {        GETCHARINCTEST(c, eptr);
2648        int len = 1;        lgb = UCD_GRAPHBREAK(c);
2649        if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }        while (eptr < md->end_subject)
2650        if (UCD_CATEGORY(c) != ucp_M) break;          {
2651        eptr += len;          int len = 1;
2652            if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
2653            rgb = UCD_GRAPHBREAK(c);
2654            if (PRIV(ucp_gbtable)[lgb * ucp_gbCount + rgb] == 0) break;
2655            lgb = rgb;
2656            eptr += len;
2657            }
2658        }        }
2659      CHECK_PARTIAL();      CHECK_PARTIAL();
2660      ecode++;      ecode++;
# Line 3431  for (;;) Line 3434  for (;;)
3434      maximizing, find the maximum number of characters and work backwards. */      maximizing, find the maximum number of characters and work backwards. */
3435    
3436      DPRINTF(("matching %c{%d,%d} against subject %.*s\n", fc, min, max,      DPRINTF(("matching %c{%d,%d} against subject %.*s\n", fc, min, max,
3437        max, eptr));        max, (char *)eptr));
3438    
3439      if (op >= OP_STARI)  /* Caseless */      if (op >= OP_STARI)  /* Caseless */
3440        {        {
# Line 3700  for (;;) Line 3703  for (;;)
3703      characters and work backwards. */      characters and work backwards. */
3704    
3705      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,
3706        max, eptr));        max, (char *)eptr));
3707    
3708      if (op >= OP_NOTSTARI)     /* Caseless */      if (op >= OP_NOTSTARI)     /* Caseless */
3709        {        {
# Line 4229  for (;;) Line 4232  for (;;)
4232              SCHECK_PARTIAL();              SCHECK_PARTIAL();
4233              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4234              }              }
4235            GETCHARINCTEST(c, eptr);            else
4236            if (UCD_CATEGORY(c) == ucp_M) RRETURN(MATCH_NOMATCH);              {
4237            while (eptr < md->end_subject)              int lgb, rgb;
4238              {              GETCHARINCTEST(c, eptr);
4239              int len = 1;              lgb = UCD_GRAPHBREAK(c);
4240              if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }             while (eptr < md->end_subject)
4241              if (UCD_CATEGORY(c) != ucp_M) break;                {
4242              eptr += len;                int len = 1;
4243                  if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
4244                  rgb = UCD_GRAPHBREAK(c);
4245                  if (PRIV(ucp_gbtable)[lgb * ucp_gbCount + rgb] == 0) break;
4246                  lgb = rgb;
4247                  eptr += len;
4248                  }
4249              }              }
4250            CHECK_PARTIAL();            CHECK_PARTIAL();
4251            }            }
# Line 5032  for (;;) Line 5041  for (;;)
5041              SCHECK_PARTIAL();              SCHECK_PARTIAL();
5042              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
5043              }              }
5044            GETCHARINCTEST(c, eptr);            else
5045            if (UCD_CATEGORY(c) == ucp_M) RRETURN(MATCH_NOMATCH);              {
5046            while (eptr < md->end_subject)              int lgb, rgb;
5047              {              GETCHARINCTEST(c, eptr);
5048              int len = 1;              lgb = UCD_GRAPHBREAK(c);
5049              if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }              while (eptr < md->end_subject)
5050              if (UCD_CATEGORY(c) != ucp_M) break;                {
5051              eptr += len;                int len = 1;
5052                  if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
5053                  rgb = UCD_GRAPHBREAK(c);
5054                  if (PRIV(ucp_gbtable)[lgb * ucp_gbCount + rgb] == 0) break;
5055                  lgb = rgb;
5056                  eptr += len;
5057                  }
5058              }              }
5059            CHECK_PARTIAL();            CHECK_PARTIAL();
5060            }            }
# Line 5591  for (;;) Line 5606  for (;;)
5606          {          {
5607          for (i = min; i < max; i++)          for (i = min; i < max; i++)
5608            {            {
           int len = 1;  
5609            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
5610              {              {
5611              SCHECK_PARTIAL();              SCHECK_PARTIAL();
5612              break;              break;
5613              }              }
5614            if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }            else
5615            if (UCD_CATEGORY(c) == ucp_M) break;              {
5616            eptr += len;              int lgb, rgb;
5617            while (eptr < md->end_subject)              GETCHARINCTEST(c, eptr);
5618              {              lgb = UCD_GRAPHBREAK(c);
5619              len = 1;              while (eptr < md->end_subject)
5620              if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }                {
5621              if (UCD_CATEGORY(c) != ucp_M) break;                int len = 1;
5622              eptr += len;                if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
5623                  rgb = UCD_GRAPHBREAK(c);
5624                  if (PRIV(ucp_gbtable)[lgb * ucp_gbCount + rgb] == 0) break;
5625                  lgb = rgb;
5626                  eptr += len;
5627                  }
5628              }              }
5629            CHECK_PARTIAL();            CHECK_PARTIAL();
5630            }            }

Legend:
Removed from v.963  
changed lines
  Added in v.1011

  ViewVC Help
Powered by ViewVC 1.1.5