/[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 529 by ph10, Mon May 31 17:28:08 2010 UTC revision 543 by ph10, Tue Jun 15 16:33:29 2010 UTC
# Line 295  argument of match(), which never changes Line 295  argument of match(), which never changes
295  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\
296    {\    {\
297    heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\    heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\
298      if (newframe == NULL) RRETURN(PCRE_ERROR_NOMEMORY);\
299    frame->Xwhere = rw; \    frame->Xwhere = rw; \
300    newframe->Xeptr = ra;\    newframe->Xeptr = ra;\
301    newframe->Xecode = rb;\    newframe->Xecode = rb;\
# Line 488  heap whenever RMATCH() does a "recursion Line 489  heap whenever RMATCH() does a "recursion
489    
490  #ifdef NO_RECURSE  #ifdef NO_RECURSE
491  heapframe *frame = (pcre_stack_malloc)(sizeof(heapframe));  heapframe *frame = (pcre_stack_malloc)(sizeof(heapframe));
492    if (frame == NULL) RRETURN(PCRE_ERROR_NOMEMORY);
493  frame->Xprevframe = NULL;            /* Marks the top level */  frame->Xprevframe = NULL;            /* Marks the top level */
494    
495  /* Copy in the original argument variables */  /* Copy in the original argument variables */
# Line 794  for (;;) Line 796  for (;;)
796        save_capture_last = md->capture_last;        save_capture_last = md->capture_last;
797    
798        DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));        DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
799        md->offset_vector[md->offset_end - number] = eptr - md->start_subject;        md->offset_vector[md->offset_end - number] =
800            (int)(eptr - md->start_subject);
801    
802        flags = (op == OP_SCBRA)? match_cbegroup : 0;        flags = (op == OP_SCBRA)? match_cbegroup : 0;
803        do        do
# Line 889  for (;;) Line 892  for (;;)
892          cb.callout_number   = ecode[LINK_SIZE+2];          cb.callout_number   = ecode[LINK_SIZE+2];
893          cb.offset_vector    = md->offset_vector;          cb.offset_vector    = md->offset_vector;
894          cb.subject          = (PCRE_SPTR)md->start_subject;          cb.subject          = (PCRE_SPTR)md->start_subject;
895          cb.subject_length   = md->end_subject - md->start_subject;          cb.subject_length   = (int)(md->end_subject - md->start_subject);
896          cb.start_match      = mstart - md->start_subject;          cb.start_match      = (int)(mstart - md->start_subject);
897          cb.current_position = eptr - md->start_subject;          cb.current_position = (int)(eptr - md->start_subject);
898          cb.pattern_position = GET(ecode, LINK_SIZE + 3);          cb.pattern_position = GET(ecode, LINK_SIZE + 3);
899          cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE);          cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE);
900          cb.capture_top      = offset_top/2;          cb.capture_top      = offset_top/2;
# Line 1117  for (;;) Line 1120  for (;;)
1120        {        {
1121        md->offset_vector[offset] =        md->offset_vector[offset] =
1122          md->offset_vector[md->offset_end - number];          md->offset_vector[md->offset_end - number];
1123        md->offset_vector[offset+1] = eptr - md->start_subject;        md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
1124        if (offset_top <= offset) offset_top = offset + 2;        if (offset_top <= offset) offset_top = offset + 2;
1125        }        }
1126      ecode += 3;      ecode += 3;
# Line 1280  for (;;) Line 1283  for (;;)
1283        cb.callout_number   = ecode[1];        cb.callout_number   = ecode[1];
1284        cb.offset_vector    = md->offset_vector;        cb.offset_vector    = md->offset_vector;
1285        cb.subject          = (PCRE_SPTR)md->start_subject;        cb.subject          = (PCRE_SPTR)md->start_subject;
1286        cb.subject_length   = md->end_subject - md->start_subject;        cb.subject_length   = (int)(md->end_subject - md->start_subject);
1287        cb.start_match      = mstart - md->start_subject;        cb.start_match      = (int)(mstart - md->start_subject);
1288        cb.current_position = eptr - md->start_subject;        cb.current_position = (int)(eptr - md->start_subject);
1289        cb.pattern_position = GET(ecode, 2);        cb.pattern_position = GET(ecode, 2);
1290        cb.next_item_length = GET(ecode, 2 + LINK_SIZE);        cb.next_item_length = GET(ecode, 2 + LINK_SIZE);
1291        cb.capture_top      = offset_top/2;        cb.capture_top      = offset_top/2;
# Line 1559  for (;;) Line 1562  for (;;)
1562          {          {
1563          md->offset_vector[offset] =          md->offset_vector[offset] =
1564            md->offset_vector[md->offset_end - number];            md->offset_vector[md->offset_end - number];
1565          md->offset_vector[offset+1] = eptr - md->start_subject;          md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
1566          if (offset_top <= offset) offset_top = offset + 2;          if (offset_top <= offset) offset_top = offset + 2;
1567          }          }
1568    
# Line 2233  for (;;) Line 2236  for (;;)
2236        referenced subpattern. */        referenced subpattern. */
2237    
2238        if (offset >= offset_top || md->offset_vector[offset] < 0)        if (offset >= offset_top || md->offset_vector[offset] < 0)
2239          length = (md->jscript_compat)? 0 : md->end_subject - eptr + 1;          length = (md->jscript_compat)? 0 : (int)(md->end_subject - eptr + 1);
2240        else        else
2241          length = md->offset_vector[offset+1] - md->offset_vector[offset];          length = md->offset_vector[offset+1] - md->offset_vector[offset];
2242    
# Line 5956  for(;;) Line 5959  for(;;)
5959        while (start_match < end_subject)        while (start_match < end_subject)
5960          {          {
5961          register unsigned int c = *start_match;          register unsigned int c = *start_match;
5962          if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++;          if ((start_bits[c/8] & (1 << (c&7))) == 0)
5963            else break;            {
5964              start_match++;
5965    #ifdef SUPPORT_UTF8
5966              if (utf8)
5967                while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
5968                  start_match++;
5969    #endif
5970              }
5971            else break;
5972          }          }
5973        }        }
5974      }   /* Starting optimizations */      }   /* Starting optimizations */
# Line 6058  for(;;) Line 6069  for(;;)
6069    
6070    switch(rc)    switch(rc)
6071      {      {
6072      /* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches      /* SKIP passes back the next starting point explicitly, but if it is the
6073      this level it means that a MARK that matched the SKIP's arg was not found.      same as the match we have just done, treat it as NOMATCH. */
6074      We treat this as NOMATCH. THEN at this level acts exactly like PRUNE. */  
6075        case MATCH_SKIP:
6076        if (md->start_match_ptr != start_match)
6077          {
6078          new_start_match = md->start_match_ptr;
6079          break;
6080          }
6081        /* Fall through */
6082    
6083        /* If MATCH_SKIP_ARG reaches this level it means that a MARK that matched
6084        the SKIP's arg was not found. We also treat this as NOMATCH. */
6085    
6086        case MATCH_SKIP_ARG:
6087        /* Fall through */
6088    
6089        /* NOMATCH and PRUNE advance by one character. THEN at this level acts
6090        exactly like PRUNE. */
6091    
6092      case MATCH_NOMATCH:      case MATCH_NOMATCH:
6093      case MATCH_PRUNE:      case MATCH_PRUNE:
     case MATCH_SKIP_ARG:  
6094      case MATCH_THEN:      case MATCH_THEN:
6095      new_start_match = start_match + 1;      new_start_match = start_match + 1;
6096  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 6074  for(;;) Line 6100  for(;;)
6100  #endif  #endif
6101      break;      break;
6102    
     /* SKIP passes back the next starting point explicitly. */  
   
     case MATCH_SKIP:  
     new_start_match = md->start_match_ptr;  
     break;  
   
6103      /* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */      /* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */
6104    
6105      case MATCH_COMMIT:      case MATCH_COMMIT:
# Line 6176  if (rc == MATCH_MATCH || rc == MATCH_ACC Line 6196  if (rc == MATCH_MATCH || rc == MATCH_ACC
6196    
6197    if (offsetcount < 2) rc = 0; else    if (offsetcount < 2) rc = 0; else
6198      {      {
6199      offsets[0] = md->start_match_ptr - md->start_subject;      offsets[0] = (int)(md->start_match_ptr - md->start_subject);
6200      offsets[1] = md->end_match_ptr - md->start_subject;      offsets[1] = (int)(md->end_match_ptr - md->start_subject);
6201      }      }
6202    
6203    DPRINTF((">>>> returning %d\n", rc));    DPRINTF((">>>> returning %d\n", rc));
# Line 6209  if (start_partial != NULL) Line 6229  if (start_partial != NULL)
6229    md->mark = NULL;    md->mark = NULL;
6230    if (offsetcount > 1)    if (offsetcount > 1)
6231      {      {
6232      offsets[0] = start_partial - (USPTR)subject;      offsets[0] = (int)(start_partial - (USPTR)subject);
6233      offsets[1] = end_subject - (USPTR)subject;      offsets[1] = (int)(end_subject - (USPTR)subject);
6234      }      }
6235    rc = PCRE_ERROR_PARTIAL;    rc = PCRE_ERROR_PARTIAL;
6236    }    }

Legend:
Removed from v.529  
changed lines
  Added in v.543

  ViewVC Help
Powered by ViewVC 1.1.5