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

Diff of /code/trunk/pcretest.c

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

revision 141 by ph10, Fri Mar 30 15:46:27 2007 UTC revision 142 by ph10, Fri Mar 30 15:55:18 2007 UTC
# Line 1972  while (!done) Line 1972  while (!done)
1972    
1973      for (;; gmatched++)    /* Loop for /g or /G */      for (;; gmatched++)    /* Loop for /g or /G */
1974        {        {
1975        int gany_fudge;        int gany_fudge;
1976        if (timeitm > 0)        if (timeitm > 0)
1977          {          {
1978          register int i;          register int i;
# Line 2256  while (!done) Line 2256  while (!done)
2256        what Perl's /g options does. This turns out to be rather cunning. First        what Perl's /g options does. This turns out to be rather cunning. First
2257        we set PCRE_NOTEMPTY and PCRE_ANCHORED and try the match again at the        we set PCRE_NOTEMPTY and PCRE_ANCHORED and try the match again at the
2258        same point. If this fails (picked up above) we advance to the next        same point. If this fails (picked up above) we advance to the next
2259        character.        character.
2260    
2261        Yet more complication arises in the case when the newline option is        Yet more complication arises in the case when the newline option is
2262        "any" and a pattern in multiline mode has to match at the start of a        "any" and a pattern in multiline mode has to match at the start of a
2263        line. If a previous match was at the end of a line, and advance of one        line. If a previous match was at the end of a line, and advance of one
2264        character just passes the \r, whereas we should prefer the longer newline        character just passes the \r, whereas we should prefer the longer newline
2265        sequence, as does the code in pcre_exec(). So we fudge it. */        sequence, as does the code in pcre_exec(). So we fudge it. */
2266    
2267        g_notempty = 0;        g_notempty = 0;
2268        gany_fudge = 0;        gany_fudge = 0;
2269    
2270        if (use_offsets[0] == use_offsets[1])        if (use_offsets[0] == use_offsets[1])
2271          {          {
2272          if (use_offsets[0] == len) break;          if (use_offsets[0] == len) break;
# Line 2274  while (!done) Line 2274  while (!done)
2274          if ((((real_pcre *)re)->options & PCRE_STARTLINE) != 0 &&          if ((((real_pcre *)re)->options & PCRE_STARTLINE) != 0 &&
2275              (((real_pcre *)re)->options & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY &&              (((real_pcre *)re)->options & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY &&
2276              use_offsets[0] < len - 1 &&              use_offsets[0] < len - 1 &&
2277              bptr[use_offsets[0]] == '\r' &&              bptr[use_offsets[0]] == '\r' &&
2278              bptr[use_offsets[0]+1] == '\n')              bptr[use_offsets[0]+1] == '\n')
2279            gany_fudge = 1;            gany_fudge = 1;
2280          }          }
2281    
2282        /* For /g, update the start offset, leaving the rest alone */        /* For /g, update the start offset, leaving the rest alone */

Legend:
Removed from v.141  
changed lines
  Added in v.142

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12