/[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 210 by ph10, Wed Aug 8 14:24:50 2007 UTC revision 211 by ph10, Thu Aug 9 09:52:43 2007 UTC
# Line 68  defined PCRE_ERROR_xxx codes, which are Line 68  defined PCRE_ERROR_xxx codes, which are
68  #define MATCH_MATCH        1  #define MATCH_MATCH        1
69  #define MATCH_NOMATCH      0  #define MATCH_NOMATCH      0
70    
71  /* Special internal returns from the match() function. Make them sufficiently  /* Special internal returns from the match() function. Make them sufficiently
72  negative to avoid the external error codes. */  negative to avoid the external error codes. */
73    
74  #define MATCH_COMMIT       (-999)  #define MATCH_COMMIT       (-999)
# Line 622  for (;;) Line 622  for (;;)
622    switch(op)    switch(op)
623      {      {
624      case OP_FAIL:      case OP_FAIL:
625      return MATCH_NOMATCH;      return MATCH_NOMATCH;
626    
627      case OP_PRUNE:      case OP_PRUNE:
628      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
629        ims, eptrb, flags, RM51);        ims, eptrb, flags, RM51);
630      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
631      return MATCH_PRUNE;      return MATCH_PRUNE;
632    
633      case OP_COMMIT:      case OP_COMMIT:
634      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
635        ims, eptrb, flags, RM52);        ims, eptrb, flags, RM52);
636      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
637      return MATCH_COMMIT;      return MATCH_COMMIT;
638    
639      case OP_SKIP:      case OP_SKIP:
640      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
641        ims, eptrb, flags, RM53);        ims, eptrb, flags, RM53);
642      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
643      md->start_match_ptr = eptr;   /* Pass back current position */      md->start_match_ptr = eptr;   /* Pass back current position */
644      return MATCH_SKIP;      return MATCH_SKIP;
645    
646      case OP_THEN:      case OP_THEN:
647      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
648        ims, eptrb, flags, RM53);        ims, eptrb, flags, RM53);
649      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
650      return MATCH_THEN;      return MATCH_THEN;
651    
652      /* Handle a capturing bracket. If there is space in the offset vector, save      /* Handle a capturing bracket. If there is space in the offset vector, save
653      the current subject position in the working slot at the top of the vector.      the current subject position in the working slot at the top of the vector.
654      We mustn't change the current values of the data slot, because they may be      We mustn't change the current values of the data slot, because they may be
# Line 4586  the loop runs just once. */ Line 4586  the loop runs just once. */
4586  for(;;)  for(;;)
4587    {    {
4588    USPTR save_end_subject = end_subject;    USPTR save_end_subject = end_subject;
4589    USPTR new_start_match;    USPTR new_start_match;
4590    
4591    /* Reset the maximum number of extractions we might see. */    /* Reset the maximum number of extractions we might see. */
4592    
# Line 4730  for(;;) Line 4730  for(;;)
4730    md->start_match_ptr = start_match;    md->start_match_ptr = start_match;
4731    md->match_call_count = 0;    md->match_call_count = 0;
4732    rc = match(start_match, md->start_code, start_match, 2, md, ims, NULL, 0, 0);    rc = match(start_match, md->start_code, start_match, 2, md, ims, NULL, 0, 0);
4733    
4734    switch(rc)    switch(rc)
4735      {      {
4736      /* NOMATCH and PRUNE advance by one character. THEN at this level acts      /* NOMATCH and PRUNE advance by one character. THEN at this level acts
4737      exactly like PRUNE. */      exactly like PRUNE. */
4738    
4739      case MATCH_NOMATCH:      case MATCH_NOMATCH:
4740      case MATCH_PRUNE:      case MATCH_PRUNE:
4741      case MATCH_THEN:      case MATCH_THEN:
4742      new_start_match = start_match + 1;      new_start_match = start_match + 1;
4743  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
4744      if (utf8)      if (utf8)
4745        while(new_start_match < end_subject && (*new_start_match & 0xc0) == 0x80)        while(new_start_match < end_subject && (*new_start_match & 0xc0) == 0x80)
4746          new_start_match++;          new_start_match++;
4747  #endif  #endif
4748      break;      break;
4749    
4750      /* SKIP passes back the next starting point explicitly. */      /* SKIP passes back the next starting point explicitly. */
4751    
4752      case MATCH_SKIP:      case MATCH_SKIP:
4753      new_start_match = md->start_match_ptr;      new_start_match = md->start_match_ptr;
4754      break;      break;
4755    
4756      /* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */      /* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */
4757    
4758      case MATCH_COMMIT:      case MATCH_COMMIT:
4759      rc = MATCH_NOMATCH;      rc = MATCH_NOMATCH;
4760      goto ENDLOOP;      goto ENDLOOP;
4761    
4762      /* Any other return is some kind of error. */      /* Any other return is some kind of error. */
4763    
4764      default:      default:
4765      goto ENDLOOP;      goto ENDLOOP;
4766      }      }
4767    
4768    /* Control reaches here for the various types of "no match at this point"    /* Control reaches here for the various types of "no match at this point"
4769    result. Reset the code to MATCH_NOMATCH for subsequent checking. */    result. Reset the code to MATCH_NOMATCH for subsequent checking. */
4770    
4771    rc = MATCH_NOMATCH;    rc = MATCH_NOMATCH;
4772    
4773    /* If PCRE_FIRSTLINE is set, the match must happen before or at the first    /* If PCRE_FIRSTLINE is set, the match must happen before or at the first
4774    newline in the subject (though it may continue over the newline). Therefore,    newline in the subject (though it may continue over the newline). Therefore,

Legend:
Removed from v.210  
changed lines
  Added in v.211

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12