/[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 606 by ph10, Mon Jun 6 17:46:22 2011 UTC revision 608 by ph10, Sun Jun 12 16:25:55 2011 UTC
# Line 1305  for (;;) Line 1305  for (;;)
1305      break;      break;
1306    
1307    
1308      /* End of the pattern, either real or forced. If we are in a top-level      /* End of the pattern, either real or forced. If we are in a recursion, we
1309      recursion, we should restore the offsets appropriately and continue from      should restore the offsets appropriately, and if it's a top-level
1310      after the call. */      recursion, continue from after the call. */
1311    
1312      case OP_ACCEPT:      case OP_ACCEPT:
1313      case OP_END:      case OP_END:
1314      if (md->recursive != NULL && md->recursive->group_num == 0)      if (md->recursive != NULL)
1315        {        {
1316        recursion_info *rec = md->recursive;        recursion_info *rec = md->recursive;
       DPRINTF(("End of pattern in a (?0) recursion\n"));  
1317        md->recursive = rec->prevrec;        md->recursive = rec->prevrec;
1318        memmove(md->offset_vector, rec->offset_save,        memmove(md->offset_vector, rec->offset_save,
1319          rec->saved_max * sizeof(int));          rec->saved_max * sizeof(int));
1320        offset_top = rec->save_offset_top;        offset_top = rec->save_offset_top;
1321        ecode = rec->after_call;        if (rec->group_num == 0)
1322        break;          {
1323            ecode = rec->after_call;
1324            break;
1325            }
1326        }        }
1327    
1328      /* Otherwise, if we have matched an empty string, fail if PCRE_NOTEMPTY is      /* Otherwise, if we have matched an empty string, fail if PCRE_NOTEMPTY is
# Line 1328  for (;;) Line 1330  for (;;)
1330      the subject. In both cases, backtracking will then try other alternatives,      the subject. In both cases, backtracking will then try other alternatives,
1331      if any. */      if any. */
1332    
1333      if (eptr == mstart &&      else if (eptr == mstart &&
1334          (md->notempty ||          (md->notempty ||
1335            (md->notempty_atstart &&            (md->notempty_atstart &&
1336              mstart == md->start_subject + md->start_offset)))              mstart == md->start_subject + md->start_offset)))
1337        MRRETURN(MATCH_NOMATCH);        MRRETURN(MATCH_NOMATCH);
1338    
1339      /* Otherwise, we have a match. */      /* Otherwise, we have a match. */
1340    
1341      md->end_match_ptr = eptr;           /* Record where we ended */      md->end_match_ptr = eptr;           /* Record where we ended */
1342      md->end_offset_top = offset_top;    /* and how many extracts were taken */      md->end_offset_top = offset_top;    /* and how many extracts were taken */
1343      md->start_match_ptr = mstart;       /* and the start (\K can modify) */      md->start_match_ptr = mstart;       /* and the start (\K can modify) */
# Line 1538  for (;;) Line 1540  for (;;)
1540        memcpy(new_recursive.offset_save, md->offset_vector,        memcpy(new_recursive.offset_save, md->offset_vector,
1541              new_recursive.saved_max * sizeof(int));              new_recursive.saved_max * sizeof(int));
1542        new_recursive.save_offset_top = offset_top;        new_recursive.save_offset_top = offset_top;
1543    
1544        /* OK, now we can do the recursion. For each top-level alternative we        /* OK, now we can do the recursion. For each top-level alternative we
1545        restore the offset and recursion data. */        restore the offset and recursion data. */
1546    

Legend:
Removed from v.606  
changed lines
  Added in v.608

  ViewVC Help
Powered by ViewVC 1.1.5