/[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 1477 by ph10, Wed May 21 17:53:49 2014 UTC revision 1478 by ph10, Tue May 27 13:18:31 2014 UTC
# Line 1167  for (;;) Line 1167  for (;;)
1167          if (rrc == MATCH_KETRPOS)          if (rrc == MATCH_KETRPOS)
1168            {            {
1169            offset_top = md->end_offset_top;            offset_top = md->end_offset_top;
           eptr = md->end_match_ptr;  
1170            ecode = md->start_code + code_offset;            ecode = md->start_code + code_offset;
1171            save_capture_last = md->capture_last;            save_capture_last = md->capture_last;
1172            matched_once = TRUE;            matched_once = TRUE;
1173            mstart = md->start_match_ptr;    /* In case \K changed it */            mstart = md->start_match_ptr;    /* In case \K changed it */
1174              if (eptr == md->end_match_ptr)   /* Matched an empty string */
1175                {
1176                do ecode += GET(ecode, 1); while (*ecode == OP_ALT);
1177                break;
1178                }
1179              eptr = md->end_match_ptr;
1180            continue;            continue;
1181            }            }
1182    
# Line 1241  for (;;) Line 1246  for (;;)
1246        if (rrc == MATCH_KETRPOS)        if (rrc == MATCH_KETRPOS)
1247          {          {
1248          offset_top = md->end_offset_top;          offset_top = md->end_offset_top;
         eptr = md->end_match_ptr;  
1249          ecode = md->start_code + code_offset;          ecode = md->start_code + code_offset;
1250          matched_once = TRUE;          matched_once = TRUE;
1251          mstart = md->start_match_ptr;   /* In case \K reset it */          mstart = md->start_match_ptr;   /* In case \K reset it */
1252            if (eptr == md->end_match_ptr)  /* Matched an empty string */
1253              {
1254              do ecode += GET(ecode, 1); while (*ecode == OP_ALT);
1255              break;
1256              }
1257            eptr = md->end_match_ptr;
1258          continue;          continue;
1259          }          }
1260    
# Line 1894  for (;;) Line 1904  for (;;)
1904      case OP_KETRMAX:      case OP_KETRMAX:
1905      case OP_KETRPOS:      case OP_KETRPOS:
1906      prev = ecode - GET(ecode, 1);      prev = ecode - GET(ecode, 1);
1907    
1908      /* If this was a group that remembered the subject start, in order to break      /* If this was a group that remembered the subject start, in order to break
1909      infinite repeats of empty string matches, retrieve the subject start from      infinite repeats of empty string matches, retrieve the subject start from
1910      the chain. Otherwise, set it NULL. */      the chain. Otherwise, set it NULL. */
# Line 1919  for (;;) Line 1929  for (;;)
1929        md->start_match_ptr = mstart;        md->start_match_ptr = mstart;
1930        RRETURN(MATCH_MATCH);         /* Sets md->mark */        RRETURN(MATCH_MATCH);         /* Sets md->mark */
1931        }        }
1932    
1933      /* For capturing groups we have to check the group number back at the start      /* For capturing groups we have to check the group number back at the start
1934      and if necessary complete handling an extraction by setting the offsets and      and if necessary complete handling an extraction by setting the offsets and
1935      bumping the high water mark. Whole-pattern recursion is coded as a recurse      bumping the high water mark. Whole-pattern recursion is coded as a recurse
# Line 1979  for (;;) Line 1989  for (;;)
1989          }          }
1990        }        }
1991    
1992        /* OP_KETRPOS is a possessive repeating ket. Remember the current position,
1993        and return the MATCH_KETRPOS. This makes it possible to do the repeats one
1994        at a time from the outer level, thus saving stack. This must precede the
1995        empty string test - in this case that test is done at the outer level. */
1996    
1997        if (*ecode == OP_KETRPOS)
1998          {
1999          md->start_match_ptr = mstart;    /* In case \K reset it */
2000          md->end_match_ptr = eptr;
2001          md->end_offset_top = offset_top;
2002          RRETURN(MATCH_KETRPOS);
2003          }
2004    
2005      /* For an ordinary non-repeating ket, just continue at this level. This      /* For an ordinary non-repeating ket, just continue at this level. This
2006      also happens for a repeating ket if no characters were matched in the      also happens for a repeating ket if no characters were matched in the
2007      group. This is the forcible breaking of infinite loops as implemented in      group. This is the forcible breaking of infinite loops as implemented in
# Line 2001  for (;;) Line 2024  for (;;)
2024        break;        break;
2025        }        }
2026    
     /* OP_KETRPOS is a possessive repeating ket. Remember the current position,  
     and return the MATCH_KETRPOS. This makes it possible to do the repeats one  
     at a time from the outer level, thus saving stack. */  
   
     if (*ecode == OP_KETRPOS)  
       {  
       md->start_match_ptr = mstart;    /* In case \K reset it */  
       md->end_match_ptr = eptr;  
       md->end_offset_top = offset_top;  
       RRETURN(MATCH_KETRPOS);  
       }  
   
2027      /* The normal repeating kets try the rest of the pattern or restart from      /* The normal repeating kets try the rest of the pattern or restart from
2028      the preceding bracket, in the appropriate order. In the second case, we can      the preceding bracket, in the appropriate order. In the second case, we can
2029      use tail recursion to avoid using another stack frame, unless we have an      use tail recursion to avoid using another stack frame, unless we have an

Legend:
Removed from v.1477  
changed lines
  Added in v.1478

  ViewVC Help
Powered by ViewVC 1.1.5