/[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 510 by ph10, Sat Mar 27 17:45:29 2010 UTC revision 517 by ph10, Wed May 5 10:44:20 2010 UTC
# Line 71  defined PCRE_ERROR_xxx codes, which are Line 71  defined PCRE_ERROR_xxx codes, which are
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_ACCEPT       (-999)
75  #define MATCH_PRUNE        (-998)  #define MATCH_COMMIT       (-998)
76  #define MATCH_SKIP         (-997)  #define MATCH_PRUNE        (-997)
77  #define MATCH_SKIP_ARG     (-996)  #define MATCH_SKIP         (-996)
78  #define MATCH_THEN         (-995)  #define MATCH_SKIP_ARG     (-995)
79    #define MATCH_THEN         (-994)
80    
81  /* This is a convenience macro for code that occurs many times. */  /* This is a convenience macro for code that occurs many times. */
82    
# Line 254  enum { RM1=1, RM2,  RM3,  RM4,  RM5,  RM Line 255  enum { RM1=1, RM2,  RM3,  RM4,  RM5,  RM
255         RM21,  RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30,         RM21,  RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30,
256         RM31,  RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,         RM31,  RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,
257         RM41,  RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,         RM41,  RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,
258         RM51,  RM52, RM53, RM54 };         RM51,  RM52, RM53, RM54, RM55, RM56, RM57, RM58 };
259    
260  /* These versions of the macros use the stack, as normal. There are debugging  /* These versions of the macros use the stack, as normal. There are debugging
261  versions and production versions. Note that the "rw" argument of RMATCH isn't  versions and production versions. Note that the "rw" argument of RMATCH isn't
# Line 684  for (;;) Line 685  for (;;)
685      case OP_MARK:      case OP_MARK:
686      markptr = ecode + 2;      markptr = ecode + 2;
687      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
688        ims, eptrb, flags, RM51);        ims, eptrb, flags, RM55);
689    
690      /* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an      /* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an
691      argument, and we must check whether that argument matches this MARK's      argument, and we must check whether that argument matches this MARK's
692      argument. It is passed back in md->start_match_ptr (an overloading of that      argument. It is passed back in md->start_match_ptr (an overloading of that
693      variable). If it does match, we reset that variable to the current subject      variable). If it does match, we reset that variable to the current subject
694      position and return MATCH_SKIP. Otherwise, pass back the return code      position and return MATCH_SKIP. Otherwise, pass back the return code
695      unaltered. */      unaltered. */
696    
697      if (rrc == MATCH_SKIP_ARG &&      if (rrc == MATCH_SKIP_ARG &&
698          strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0)          strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0)
699        {        {
700        md->start_match_ptr = eptr;        md->start_match_ptr = eptr;
701        RRETURN(MATCH_SKIP);        RRETURN(MATCH_SKIP);
702        }        }
703    
704      if (md->mark == NULL) md->mark = markptr;      if (md->mark == NULL) md->mark = markptr;
705      RRETURN(rrc);      RRETURN(rrc);
706    
707      case OP_FAIL:      case OP_FAIL:
# Line 720  for (;;) Line 721  for (;;)
721    
722      case OP_PRUNE_ARG:      case OP_PRUNE_ARG:
723      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
724        ims, eptrb, flags, RM51);        ims, eptrb, flags, RM56);
725      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
726      md->mark = ecode + 2;      md->mark = ecode + 2;
727      RRETURN(MATCH_PRUNE);      RRETURN(MATCH_PRUNE);
# Line 734  for (;;) Line 735  for (;;)
735    
736      case OP_SKIP_ARG:      case OP_SKIP_ARG:
737      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
738        ims, eptrb, flags, RM53);        ims, eptrb, flags, RM57);
739      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
740    
741      /* 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
742      returning the special MATCH_SKIP_ARG return code. This will either be      returning the special MATCH_SKIP_ARG return code. This will either be
743      caught by a matching MARK, or get to the top, where it is treated the same      caught by a matching MARK, or get to the top, where it is treated the same
744      as PRUNE. */      as PRUNE. */
745    
746      md->start_match_ptr = ecode + 2;      md->start_match_ptr = ecode + 2;
747      RRETURN(MATCH_SKIP_ARG);      RRETURN(MATCH_SKIP_ARG);
748    
749      case OP_THEN:      case OP_THEN:
750      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
751        ims, eptrb, flags, RM54);        ims, eptrb, flags, RM54);
# Line 753  for (;;) Line 754  for (;;)
754    
755      case OP_THEN_ARG:      case OP_THEN_ARG:
756      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
757        ims, eptrb, flags, RM54);        ims, eptrb, flags, RM58);
758      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
759      md->mark = ecode + 2;      md->mark = ecode + 2;
760      RRETURN(MATCH_THEN);      RRETURN(MATCH_THEN);
# Line 851  for (;;) Line 852  for (;;)
852    
853          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
854            eptrb, flags, RM48);            eptrb, flags, RM48);
855          if (rrc == MATCH_NOMATCH) md->mark = markptr;          if (rrc == MATCH_NOMATCH) md->mark = markptr;
856          RRETURN(rrc);          RRETURN(rrc);
857          }          }
858    
859        /* For non-final alternatives, continue the loop for a NOMATCH result;        /* For non-final alternatives, continue the loop for a NOMATCH result;
# Line 1157  for (;;) Line 1158  for (;;)
1158      md->end_match_ptr = eptr;           /* Record where we ended */      md->end_match_ptr = eptr;           /* Record where we ended */
1159      md->end_offset_top = offset_top;    /* and how many extracts were taken */      md->end_offset_top = offset_top;    /* and how many extracts were taken */
1160      md->start_match_ptr = mstart;       /* and the start (\K can modify) */      md->start_match_ptr = mstart;       /* and the start (\K can modify) */
1161      MRRETURN(MATCH_MATCH);  
1162        /* For some reason, the macros don't work properly if an expression is
1163        given as the argument to MRRETURN when the heap is in use. */
1164    
1165        rrc = (op == OP_END)? MATCH_MATCH : MATCH_ACCEPT;
1166        MRRETURN(rrc);
1167    
1168      /* Change option settings */      /* Change option settings */
1169    
# Line 1179  for (;;) Line 1185  for (;;)
1185        {        {
1186        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
1187          RM4);          RM4);
1188        if (rrc == MATCH_MATCH)        if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
1189          {          {
1190          mstart = md->start_match_ptr;   /* In case \K reset it */          mstart = md->start_match_ptr;   /* In case \K reset it */
1191          break;          break;
# Line 1212  for (;;) Line 1218  for (;;)
1218        {        {
1219        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
1220          RM5);          RM5);
1221        if (rrc == MATCH_MATCH) MRRETURN(MATCH_NOMATCH);        if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) MRRETURN(MATCH_NOMATCH);
1222        if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT)        if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT)
1223          {          {
1224          do ecode += GET(ecode,1); while (*ecode == OP_ALT);          do ecode += GET(ecode,1); while (*ecode == OP_ALT);
# Line 1347  for (;;) Line 1353  for (;;)
1353          {          {
1354          RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,          RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,
1355            md, ims, eptrb, flags, RM6);            md, ims, eptrb, flags, RM6);
1356          if (rrc == MATCH_MATCH)          if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
1357            {            {
1358            DPRINTF(("Recursion matched\n"));            DPRINTF(("Recursion matched\n"));
1359            md->recursive = new_recursive.prevrec;            md->recursive = new_recursive.prevrec;
# Line 1393  for (;;) Line 1399  for (;;)
1399      do      do
1400        {        {
1401        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM7);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM7);
1402        if (rrc == MATCH_MATCH)        if (rrc == MATCH_MATCH)  /* Note: _not_ MATCH_ACCEPT */
1403          {          {
1404          mstart = md->start_match_ptr;          mstart = md->start_match_ptr;
1405          break;          break;
# Line 2054  for (;;) Line 2060  for (;;)
2060               prop->chartype == ucp_Ll ||               prop->chartype == ucp_Ll ||
2061               prop->chartype == ucp_Lt) == (op == OP_NOTPROP))               prop->chartype == ucp_Lt) == (op == OP_NOTPROP))
2062            MRRETURN(MATCH_NOMATCH);            MRRETURN(MATCH_NOMATCH);
2063           break;          break;
2064    
2065          case PT_GC:          case PT_GC:
2066          if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP))          if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP))
# Line 2070  for (;;) Line 2076  for (;;)
2076          if ((ecode[2] != prop->script) == (op == OP_PROP))          if ((ecode[2] != prop->script) == (op == OP_PROP))
2077            MRRETURN(MATCH_NOMATCH);            MRRETURN(MATCH_NOMATCH);
2078          break;          break;
2079    
2080            /* These are specials */
2081    
2082            case PT_ALNUM:
2083            if ((_pcre_ucp_gentype[prop->chartype] == ucp_L ||
2084                 _pcre_ucp_gentype[prop->chartype] == ucp_N) == (op == OP_NOTPROP))
2085              MRRETURN(MATCH_NOMATCH);
2086            break;
2087    
2088            case PT_SPACE:    /* Perl space */
2089            if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z ||
2090                 c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR)
2091                   == (op == OP_NOTPROP))
2092              MRRETURN(MATCH_NOMATCH);
2093            break;
2094    
2095            case PT_PXSPACE:  /* POSIX space */
2096            if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z ||
2097                 c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
2098                 c == CHAR_FF || c == CHAR_CR)
2099                   == (op == OP_NOTPROP))
2100              MRRETURN(MATCH_NOMATCH);
2101            break;
2102    
2103            case PT_WORD:
2104            if ((_pcre_ucp_gentype[prop->chartype] == ucp_L ||
2105                 _pcre_ucp_gentype[prop->chartype] == ucp_N ||
2106                 c == CHAR_UNDERSCORE) == (op == OP_NOTPROP))
2107              MRRETURN(MATCH_NOMATCH);
2108            break;
2109    
2110            /* This should never occur */
2111    
2112          default:          default:
2113          RRETURN(PCRE_ERROR_INTERNAL);          RRETURN(PCRE_ERROR_INTERNAL);
# Line 3486  for (;;) Line 3524  for (;;)
3524                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
3525              }              }
3526            break;            break;
3527    
3528              case PT_ALNUM:
3529              for (i = 1; i <= min; i++)
3530                {
3531                if (eptr >= md->end_subject)
3532                  {
3533                  SCHECK_PARTIAL();
3534                  MRRETURN(MATCH_NOMATCH);
3535                  }
3536                GETCHARINCTEST(c, eptr);
3537                prop_category = UCD_CATEGORY(c);
3538                if ((prop_category == ucp_L || prop_category == ucp_N)
3539                       == prop_fail_result)
3540                  MRRETURN(MATCH_NOMATCH);
3541                }
3542              break;
3543    
3544              case PT_SPACE:    /* Perl space */
3545              for (i = 1; i <= min; i++)
3546                {
3547                if (eptr >= md->end_subject)
3548                  {
3549                  SCHECK_PARTIAL();
3550                  MRRETURN(MATCH_NOMATCH);
3551                  }
3552                GETCHARINCTEST(c, eptr);
3553                prop_category = UCD_CATEGORY(c);
3554                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
3555                     c == CHAR_FF || c == CHAR_CR)
3556                       == prop_fail_result)
3557                  MRRETURN(MATCH_NOMATCH);
3558                }
3559              break;
3560    
3561              case PT_PXSPACE:  /* POSIX space */
3562              for (i = 1; i <= min; i++)
3563                {
3564                if (eptr >= md->end_subject)
3565                  {
3566                  SCHECK_PARTIAL();
3567                  MRRETURN(MATCH_NOMATCH);
3568                  }
3569                GETCHARINCTEST(c, eptr);
3570                prop_category = UCD_CATEGORY(c);
3571                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
3572                     c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
3573                       == prop_fail_result)
3574                  MRRETURN(MATCH_NOMATCH);
3575                }
3576              break;
3577    
3578              case PT_WORD:
3579              for (i = 1; i <= min; i++)
3580                {
3581                if (eptr >= md->end_subject)
3582                  {
3583                  SCHECK_PARTIAL();
3584                  MRRETURN(MATCH_NOMATCH);
3585                  }
3586                GETCHARINCTEST(c, eptr);
3587                prop_category = UCD_CATEGORY(c);
3588                if ((prop_category == ucp_L || prop_category == ucp_N ||
3589                     c == CHAR_UNDERSCORE)
3590                       == prop_fail_result)
3591                  MRRETURN(MATCH_NOMATCH);
3592                }
3593              break;
3594    
3595              /* This should not occur */
3596    
3597            default:            default:
3598            RRETURN(PCRE_ERROR_INTERNAL);            RRETURN(PCRE_ERROR_INTERNAL);
# Line 4126  for (;;) Line 4233  for (;;)
4233              }              }
4234            /* Control never gets here */            /* Control never gets here */
4235    
4236              case PT_ALNUM:
4237              for (fi = min;; fi++)
4238                {
4239                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
4240                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4241                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4242                if (eptr >= md->end_subject)
4243                  {
4244                  SCHECK_PARTIAL();
4245                  MRRETURN(MATCH_NOMATCH);
4246                  }
4247                GETCHARINC(c, eptr);
4248                prop_category = UCD_CATEGORY(c);
4249                if ((prop_category == ucp_L || prop_category == ucp_N)
4250                       == prop_fail_result)
4251                  MRRETURN(MATCH_NOMATCH);
4252                }
4253              /* Control never gets here */
4254    
4255              case PT_SPACE:    /* Perl space */
4256              for (fi = min;; fi++)
4257                {
4258                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
4259                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4260                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4261                if (eptr >= md->end_subject)
4262                  {
4263                  SCHECK_PARTIAL();
4264                  MRRETURN(MATCH_NOMATCH);
4265                  }
4266                GETCHARINC(c, eptr);
4267                prop_category = UCD_CATEGORY(c);
4268                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4269                     c == CHAR_FF || c == CHAR_CR)
4270                       == prop_fail_result)
4271                  MRRETURN(MATCH_NOMATCH);
4272                }
4273              /* Control never gets here */
4274    
4275              case PT_PXSPACE:  /* POSIX space */
4276              for (fi = min;; fi++)
4277                {
4278                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
4279                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4280                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4281                if (eptr >= md->end_subject)
4282                  {
4283                  SCHECK_PARTIAL();
4284                  MRRETURN(MATCH_NOMATCH);
4285                  }
4286                GETCHARINC(c, eptr);
4287                prop_category = UCD_CATEGORY(c);
4288                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4289                     c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
4290                       == prop_fail_result)
4291                  MRRETURN(MATCH_NOMATCH);
4292                }
4293              /* Control never gets here */
4294    
4295              case PT_WORD:
4296              for (fi = min;; fi++)
4297                {
4298                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
4299                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4300                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4301                if (eptr >= md->end_subject)
4302                  {
4303                  SCHECK_PARTIAL();
4304                  MRRETURN(MATCH_NOMATCH);
4305                  }
4306                GETCHARINC(c, eptr);
4307                prop_category = UCD_CATEGORY(c);
4308                if ((prop_category == ucp_L ||
4309                     prop_category == ucp_N ||
4310                     c == CHAR_UNDERSCORE)
4311                       == prop_fail_result)
4312                  MRRETURN(MATCH_NOMATCH);
4313                }
4314              /* Control never gets here */
4315    
4316              /* This should never occur */
4317    
4318            default:            default:
4319            RRETURN(PCRE_ERROR_INTERNAL);            RRETURN(PCRE_ERROR_INTERNAL);
4320            }            }
# Line 4547  for (;;) Line 4736  for (;;)
4736              eptr+= len;              eptr+= len;
4737              }              }
4738            break;            break;
4739    
4740              case PT_ALNUM:
4741              for (i = min; i < max; i++)
4742                {
4743                int len = 1;
4744                if (eptr >= md->end_subject)
4745                  {
4746                  SCHECK_PARTIAL();
4747                  break;
4748                  }
4749                GETCHARLEN(c, eptr, len);
4750                prop_category = UCD_CATEGORY(c);
4751                if ((prop_category == ucp_L || prop_category == ucp_N)
4752                     == prop_fail_result)
4753                  break;
4754                eptr+= len;
4755                }
4756              break;
4757    
4758              case PT_SPACE:    /* Perl space */
4759              for (i = min; i < max; i++)
4760                {
4761                int len = 1;
4762                if (eptr >= md->end_subject)
4763                  {
4764                  SCHECK_PARTIAL();
4765                  break;
4766                  }
4767                GETCHARLEN(c, eptr, len);
4768                prop_category = UCD_CATEGORY(c);
4769                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4770                     c == CHAR_FF || c == CHAR_CR)
4771                     == prop_fail_result)
4772                  break;
4773                eptr+= len;
4774                }
4775              break;
4776    
4777              case PT_PXSPACE:  /* POSIX space */
4778              for (i = min; i < max; i++)
4779                {
4780                int len = 1;
4781                if (eptr >= md->end_subject)
4782                  {
4783                  SCHECK_PARTIAL();
4784                  break;
4785                  }
4786                GETCHARLEN(c, eptr, len);
4787                prop_category = UCD_CATEGORY(c);
4788                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4789                     c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
4790                     == prop_fail_result)
4791                  break;
4792                eptr+= len;
4793                }
4794              break;
4795    
4796              case PT_WORD:
4797              for (i = min; i < max; i++)
4798                {
4799                int len = 1;
4800                if (eptr >= md->end_subject)
4801                  {
4802                  SCHECK_PARTIAL();
4803                  break;
4804                  }
4805                GETCHARLEN(c, eptr, len);
4806                prop_category = UCD_CATEGORY(c);
4807                if ((prop_category == ucp_L || prop_category == ucp_N ||
4808                     c == CHAR_UNDERSCORE) == prop_fail_result)
4809                  break;
4810                eptr+= len;
4811                }
4812              break;
4813    
4814              default:
4815              RRETURN(PCRE_ERROR_INTERNAL);
4816            }            }
4817    
4818          /* eptr is now past the end of the maximum run */          /* eptr is now past the end of the maximum run */
# Line 5132  switch (frame->Xwhere) Line 5398  switch (frame->Xwhere)
5398    LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17)    LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17)
5399    LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33)    LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33)
5400    LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52)    LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52)
5401    LBL(53) LBL(54)    LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58)
5402  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
5403    LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30)    LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30)
5404    LBL(32) LBL(34) LBL(42) LBL(46)    LBL(32) LBL(34) LBL(42) LBL(46)
# Line 5721  for(;;) Line 5987  for(;;)
5987    
5988    /* OK, we can now run the match. If "hitend" is set afterwards, remember the    /* OK, we can now run the match. If "hitend" is set afterwards, remember the
5989    first starting point for which a partial match was found. */    first starting point for which a partial match was found. */
5990    
5991    md->start_match_ptr = start_match;    md->start_match_ptr = start_match;
5992    md->start_used_ptr = start_match;    md->start_used_ptr = start_match;
5993    md->match_call_count = 0;    md->match_call_count = 0;
# Line 5731  for(;;) Line 5997  for(;;)
5997    
5998    switch(rc)    switch(rc)
5999      {      {
6000      /* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches      /* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches
6001      this level it means that a MARK that matched the SKIP's arg was not found.      this level it means that a MARK that matched the SKIP's arg was not found.
6002      We treat this as NOMATCH. THEN at this level acts exactly like PRUNE. */      We treat this as NOMATCH. THEN at this level acts exactly like PRUNE. */
6003    
6004      case MATCH_NOMATCH:      case MATCH_NOMATCH:
6005      case MATCH_PRUNE:      case MATCH_PRUNE:
6006      case MATCH_SKIP_ARG:      case MATCH_SKIP_ARG:
6007      case MATCH_THEN:      case MATCH_THEN:
6008      new_start_match = start_match + 1;      new_start_match = start_match + 1;
6009  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 5823  capturing parentheses than vector slots. Line 6089  capturing parentheses than vector slots.
6089    
6090  ENDLOOP:  ENDLOOP:
6091    
6092  if (rc == MATCH_MATCH)  if (rc == MATCH_MATCH || rc == MATCH_ACCEPT)
6093    {    {
6094    if (using_temporary_offsets)    if (using_temporary_offsets)
6095      {      {
# Line 5865  if (using_temporary_offsets) Line 6131  if (using_temporary_offsets)
6131    DPRINTF(("Freeing temporary memory\n"));    DPRINTF(("Freeing temporary memory\n"));
6132    (pcre_free)(md->offset_vector);    (pcre_free)(md->offset_vector);
6133    }    }
6134    
6135  /* For anything other than nomatch or partial match, just return the code. */  /* For anything other than nomatch or partial match, just return the code. */
6136    
6137  if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL)  if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL)
6138    {    {
6139    DPRINTF((">>>> error: returning %d\n", rc));    DPRINTF((">>>> error: returning %d\n", rc));
6140    return rc;    return rc;
6141    }    }
6142    
6143  /* Handle partial matches - disable any mark data */  /* Handle partial matches - disable any mark data */
6144    
6145  if (start_partial != NULL)  if (start_partial != NULL)
6146    {    {
6147    DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));    DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));
6148    md->mark = NULL;    md->mark = NULL;
6149    if (offsetcount > 1)    if (offsetcount > 1)
6150      {      {
6151      offsets[0] = start_partial - (USPTR)subject;      offsets[0] = start_partial - (USPTR)subject;
# Line 5887  if (start_partial != NULL) Line 6153  if (start_partial != NULL)
6153      }      }
6154    rc = PCRE_ERROR_PARTIAL;    rc = PCRE_ERROR_PARTIAL;
6155    }    }
6156    
6157  /* This is the classic nomatch case */  /* This is the classic nomatch case */
6158    
6159  else  else
6160    {    {
6161    DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n"));    DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n"));
6162    rc = PCRE_ERROR_NOMATCH;    rc = PCRE_ERROR_NOMATCH;
6163    }    }
6164    
6165  /* Return the MARK data if it has been requested. */  /* Return the MARK data if it has been requested. */
6166    
6167  RETURN_MARK:  RETURN_MARK:
6168    
6169  if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)  if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)
6170    *(extra_data->mark) = (unsigned char *)(md->mark);    *(extra_data->mark) = (unsigned char *)(md->mark);
6171  return rc;  return rc;
6172  }  }
6173    
6174  /* End of pcre_exec.c */  /* End of pcre_exec.c */

Legend:
Removed from v.510  
changed lines
  Added in v.517

  ViewVC Help
Powered by ViewVC 1.1.5