/[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 552 by ph10, Sun Oct 10 17:33:07 2010 UTC revision 553 by ph10, Fri Oct 22 15:57:50 2010 UTC
# Line 422  immediately. The second one is used when Line 422  immediately. The second one is used when
422  the subject. */  the subject. */
423    
424  #define CHECK_PARTIAL()\  #define CHECK_PARTIAL()\
425    if (md->partial != 0 && eptr >= md->end_subject && eptr > mstart)\    if (md->partial != 0 && eptr >= md->end_subject && \
426      {\        eptr > md->start_used_ptr) \
427      md->hitend = TRUE;\      { \
428      if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL);\      md->hitend = TRUE; \
429        if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL); \
430      }      }
431    
432  #define SCHECK_PARTIAL()\  #define SCHECK_PARTIAL()\
433    if (md->partial != 0 && eptr > mstart)\    if (md->partial != 0 && eptr > md->start_used_ptr) \
434      {\      { \
435      md->hitend = TRUE;\      md->hitend = TRUE; \
436      if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL);\      if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL); \
437      }      }
438    
439    
# Line 711  for (;;) Line 712  for (;;)
712      MRRETURN(MATCH_NOMATCH);      MRRETURN(MATCH_NOMATCH);
713    
714      /* COMMIT overrides PRUNE, SKIP, and THEN */      /* COMMIT overrides PRUNE, SKIP, and THEN */
715    
716      case OP_COMMIT:      case OP_COMMIT:
717      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
718        ims, eptrb, flags, RM52);        ims, eptrb, flags, RM52);
719      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE &&      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE &&
720          rrc != MATCH_SKIP && rrc != MATCH_SKIP_ARG &&          rrc != MATCH_SKIP && rrc != MATCH_SKIP_ARG &&
721          rrc != MATCH_THEN)          rrc != MATCH_THEN)
722        RRETURN(rrc);        RRETURN(rrc);
723      MRRETURN(MATCH_COMMIT);      MRRETURN(MATCH_COMMIT);
724    
725      /* PRUNE overrides THEN */      /* PRUNE overrides THEN */
726    
727      case OP_PRUNE:      case OP_PRUNE:
728      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
729        ims, eptrb, flags, RM51);        ims, eptrb, flags, RM51);
# Line 737  for (;;) Line 738  for (;;)
738      RRETURN(MATCH_PRUNE);      RRETURN(MATCH_PRUNE);
739    
740      /* SKIP overrides PRUNE and THEN */      /* SKIP overrides PRUNE and THEN */
741    
742      case OP_SKIP:      case OP_SKIP:
743      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
744        ims, eptrb, flags, RM53);        ims, eptrb, flags, RM53);
745      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)
746        RRETURN(rrc);        RRETURN(rrc);
747      md->start_match_ptr = eptr;   /* Pass back current position */      md->start_match_ptr = eptr;   /* Pass back current position */
748      MRRETURN(MATCH_SKIP);      MRRETURN(MATCH_SKIP);
# Line 749  for (;;) Line 750  for (;;)
750      case OP_SKIP_ARG:      case OP_SKIP_ARG:
751      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
752        ims, eptrb, flags, RM57);        ims, eptrb, flags, RM57);
753      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)      if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)
754        RRETURN(rrc);        RRETURN(rrc);
755    
756      /* Pass back the current skip name by overloading md->start_match_ptr and      /* Pass back the current skip name by overloading md->start_match_ptr and
# Line 759  for (;;) Line 760  for (;;)
760    
761      md->start_match_ptr = ecode + 2;      md->start_match_ptr = ecode + 2;
762      RRETURN(MATCH_SKIP_ARG);      RRETURN(MATCH_SKIP_ARG);
763    
764      /* For THEN (and THEN_ARG) we pass back the address of the bracket or      /* For THEN (and THEN_ARG) we pass back the address of the bracket or
765      the alt that is at the start of the current branch. This makes it possible      the alt that is at the start of the current branch. This makes it possible
766      to skip back past alternatives that precede the THEN within the current      to skip back past alternatives that precede the THEN within the current
767      branch. */      branch. */
768    
769      case OP_THEN:      case OP_THEN:
770      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
# Line 773  for (;;) Line 774  for (;;)
774      MRRETURN(MATCH_THEN);      MRRETURN(MATCH_THEN);
775    
776      case OP_THEN_ARG:      case OP_THEN_ARG:
777      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1+LINK_SIZE],      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1+LINK_SIZE],
778        offset_top, md, ims, eptrb, flags, RM58);        offset_top, md, ims, eptrb, flags, RM58);
779      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
780      md->start_match_ptr = ecode - GET(ecode, 1);      md->start_match_ptr = ecode - GET(ecode, 1);
# Line 1704  for (;;) Line 1705  for (;;)
1705        if (eptr < md->end_subject)        if (eptr < md->end_subject)
1706          { if (!IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); }          { if (!IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); }
1707        else        else
1708          { if (md->noteol) MRRETURN(MATCH_NOMATCH); }          {
1709            if (md->noteol) MRRETURN(MATCH_NOMATCH);
1710            SCHECK_PARTIAL();
1711            }
1712        ecode++;        ecode++;
1713        break;        break;
1714        }        }
1715      else      else  /* Not multiline */
1716        {        {
1717        if (md->noteol) MRRETURN(MATCH_NOMATCH);        if (md->noteol) MRRETURN(MATCH_NOMATCH);
1718        if (!md->endonly)        if (!md->endonly) goto ASSERT_NL_OR_EOS;
         {  
         if (eptr != md->end_subject &&  
             (!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))  
           MRRETURN(MATCH_NOMATCH);  
         ecode++;  
         break;  
         }  
1719        }        }
1720    
1721      /* ... else fall through for endonly */      /* ... else fall through for endonly */
1722    
1723      /* End of subject assertion (\z) */      /* End of subject assertion (\z) */
1724    
1725      case OP_EOD:      case OP_EOD:
1726      if (eptr < md->end_subject) MRRETURN(MATCH_NOMATCH);      if (eptr < md->end_subject) MRRETURN(MATCH_NOMATCH);
1727        SCHECK_PARTIAL();
1728      ecode++;      ecode++;
1729      break;      break;
1730    
1731      /* End of subject or ending \n assertion (\Z) */      /* End of subject or ending \n assertion (\Z) */
1732    
1733      case OP_EODN:      case OP_EODN:
1734      if (eptr != md->end_subject &&      ASSERT_NL_OR_EOS:
1735        if (eptr < md->end_subject &&
1736          (!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))          (!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))
1737        MRRETURN(MATCH_NOMATCH);        MRRETURN(MATCH_NOMATCH);
1738    
1739        /* Either at end of string or \n before end. */
1740    
1741        SCHECK_PARTIAL();
1742      ecode++;      ecode++;
1743      break;      break;
1744    

Legend:
Removed from v.552  
changed lines
  Added in v.553

  ViewVC Help
Powered by ViewVC 1.1.5