/[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 518 by ph10, Tue May 18 15:47:01 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 1712  for (;;) Line 1718  for (;;)
1718  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1719        if (utf8)        if (utf8)
1720          {          {
1721            /* Get status of previous character */
1722    
1723          if (eptr == md->start_subject) prev_is_word = FALSE; else          if (eptr == md->start_subject) prev_is_word = FALSE; else
1724            {            {
1725            USPTR lastptr = eptr - 1;            USPTR lastptr = eptr - 1;
1726            while((*lastptr & 0xc0) == 0x80) lastptr--;            while((*lastptr & 0xc0) == 0x80) lastptr--;
1727            if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr;            if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr;
1728            GETCHAR(c, lastptr);            GETCHAR(c, lastptr);
1729    #ifdef SUPPORT_UCP
1730              if (md->use_ucp)
1731                {
1732                if (c == '_') prev_is_word = TRUE; else
1733                  {
1734                  int cat = UCD_CATEGORY(c);
1735                  prev_is_word = (cat == ucp_L || cat == ucp_N);
1736                  }
1737                }
1738              else
1739    #endif
1740            prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;            prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
1741            }            }
1742    
1743            /* Get status of next character */
1744    
1745          if (eptr >= md->end_subject)          if (eptr >= md->end_subject)
1746            {            {
1747            SCHECK_PARTIAL();            SCHECK_PARTIAL();
# Line 1728  for (;;) Line 1750  for (;;)
1750          else          else
1751            {            {
1752            GETCHAR(c, eptr);            GETCHAR(c, eptr);
1753    #ifdef SUPPORT_UCP
1754              if (md->use_ucp)
1755                {
1756                if (c == '_') cur_is_word = TRUE; else
1757                  {
1758                  int cat = UCD_CATEGORY(c);
1759                  cur_is_word = (cat == ucp_L || cat == ucp_N);
1760                  }
1761                }
1762              else
1763    #endif
1764            cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;            cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
1765            }            }
1766          }          }
1767        else        else
1768  #endif  #endif
1769    
1770        /* Not in UTF-8 mode */        /* Not in UTF-8 mode, but we may still have PCRE_UCP set, and for
1771          consistency with the behaviour of \w we do use it in this case. */
1772    
1773          {          {
1774            /* Get status of previous character */
1775    
1776          if (eptr == md->start_subject) prev_is_word = FALSE; else          if (eptr == md->start_subject) prev_is_word = FALSE; else
1777            {            {
1778            if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1;            if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1;
1779    #ifdef SUPPORT_UCP
1780              if (md->use_ucp)
1781                {
1782                c = eptr[-1];
1783                if (c == '_') prev_is_word = TRUE; else
1784                  {
1785                  int cat = UCD_CATEGORY(c);
1786                  prev_is_word = (cat == ucp_L || cat == ucp_N);
1787                  }
1788                }
1789              else
1790    #endif
1791            prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0);            prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0);
1792            }            }
1793    
1794            /* Get status of next character */
1795    
1796          if (eptr >= md->end_subject)          if (eptr >= md->end_subject)
1797            {            {
1798            SCHECK_PARTIAL();            SCHECK_PARTIAL();
1799            cur_is_word = FALSE;            cur_is_word = FALSE;
1800            }            }
1801          else cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0);          else
1802    #ifdef SUPPORT_UCP
1803            if (md->use_ucp)
1804              {
1805              c = *eptr;
1806              if (c == '_') cur_is_word = TRUE; else
1807                {
1808                int cat = UCD_CATEGORY(c);
1809                cur_is_word = (cat == ucp_L || cat == ucp_N);
1810                }
1811              }
1812            else
1813    #endif
1814            cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0);
1815          }          }
1816    
1817        /* Now see if the situation is what we want */        /* Now see if the situation is what we want */
# Line 2054  for (;;) Line 2118  for (;;)
2118               prop->chartype == ucp_Ll ||               prop->chartype == ucp_Ll ||
2119               prop->chartype == ucp_Lt) == (op == OP_NOTPROP))               prop->chartype == ucp_Lt) == (op == OP_NOTPROP))
2120            MRRETURN(MATCH_NOMATCH);            MRRETURN(MATCH_NOMATCH);
2121           break;          break;
2122    
2123          case PT_GC:          case PT_GC:
2124          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 2134  for (;;)
2134          if ((ecode[2] != prop->script) == (op == OP_PROP))          if ((ecode[2] != prop->script) == (op == OP_PROP))
2135            MRRETURN(MATCH_NOMATCH);            MRRETURN(MATCH_NOMATCH);
2136          break;          break;
2137    
2138            /* These are specials */
2139    
2140            case PT_ALNUM:
2141            if ((_pcre_ucp_gentype[prop->chartype] == ucp_L ||
2142                 _pcre_ucp_gentype[prop->chartype] == ucp_N) == (op == OP_NOTPROP))
2143              MRRETURN(MATCH_NOMATCH);
2144            break;
2145    
2146            case PT_SPACE:    /* Perl space */
2147            if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z ||
2148                 c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR)
2149                   == (op == OP_NOTPROP))
2150              MRRETURN(MATCH_NOMATCH);
2151            break;
2152    
2153            case PT_PXSPACE:  /* POSIX space */
2154            if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z ||
2155                 c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
2156                 c == CHAR_FF || c == CHAR_CR)
2157                   == (op == OP_NOTPROP))
2158              MRRETURN(MATCH_NOMATCH);
2159            break;
2160    
2161            case PT_WORD:
2162            if ((_pcre_ucp_gentype[prop->chartype] == ucp_L ||
2163                 _pcre_ucp_gentype[prop->chartype] == ucp_N ||
2164                 c == CHAR_UNDERSCORE) == (op == OP_NOTPROP))
2165              MRRETURN(MATCH_NOMATCH);
2166            break;
2167    
2168            /* This should never occur */
2169    
2170          default:          default:
2171          RRETURN(PCRE_ERROR_INTERNAL);          RRETURN(PCRE_ERROR_INTERNAL);
# Line 3486  for (;;) Line 3582  for (;;)
3582                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
3583              }              }
3584            break;            break;
3585    
3586              case PT_ALNUM:
3587              for (i = 1; i <= min; i++)
3588                {
3589                if (eptr >= md->end_subject)
3590                  {
3591                  SCHECK_PARTIAL();
3592                  MRRETURN(MATCH_NOMATCH);
3593                  }
3594                GETCHARINCTEST(c, eptr);
3595                prop_category = UCD_CATEGORY(c);
3596                if ((prop_category == ucp_L || prop_category == ucp_N)
3597                       == prop_fail_result)
3598                  MRRETURN(MATCH_NOMATCH);
3599                }
3600              break;
3601    
3602              case PT_SPACE:    /* Perl space */
3603              for (i = 1; i <= min; i++)
3604                {
3605                if (eptr >= md->end_subject)
3606                  {
3607                  SCHECK_PARTIAL();
3608                  MRRETURN(MATCH_NOMATCH);
3609                  }
3610                GETCHARINCTEST(c, eptr);
3611                prop_category = UCD_CATEGORY(c);
3612                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
3613                     c == CHAR_FF || c == CHAR_CR)
3614                       == prop_fail_result)
3615                  MRRETURN(MATCH_NOMATCH);
3616                }
3617              break;
3618    
3619              case PT_PXSPACE:  /* POSIX space */
3620              for (i = 1; i <= min; i++)
3621                {
3622                if (eptr >= md->end_subject)
3623                  {
3624                  SCHECK_PARTIAL();
3625                  MRRETURN(MATCH_NOMATCH);
3626                  }
3627                GETCHARINCTEST(c, eptr);
3628                prop_category = UCD_CATEGORY(c);
3629                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
3630                     c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
3631                       == prop_fail_result)
3632                  MRRETURN(MATCH_NOMATCH);
3633                }
3634              break;
3635    
3636              case PT_WORD:
3637              for (i = 1; i <= min; i++)
3638                {
3639                if (eptr >= md->end_subject)
3640                  {
3641                  SCHECK_PARTIAL();
3642                  MRRETURN(MATCH_NOMATCH);
3643                  }
3644                GETCHARINCTEST(c, eptr);
3645                prop_category = UCD_CATEGORY(c);
3646                if ((prop_category == ucp_L || prop_category == ucp_N ||
3647                     c == CHAR_UNDERSCORE)
3648                       == prop_fail_result)
3649                  MRRETURN(MATCH_NOMATCH);
3650                }
3651              break;
3652    
3653              /* This should not occur */
3654    
3655            default:            default:
3656            RRETURN(PCRE_ERROR_INTERNAL);            RRETURN(PCRE_ERROR_INTERNAL);
# Line 4126  for (;;) Line 4291  for (;;)
4291              }              }
4292            /* Control never gets here */            /* Control never gets here */
4293    
4294              case PT_ALNUM:
4295              for (fi = min;; fi++)
4296                {
4297                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
4298                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4299                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4300                if (eptr >= md->end_subject)
4301                  {
4302                  SCHECK_PARTIAL();
4303                  MRRETURN(MATCH_NOMATCH);
4304                  }
4305                GETCHARINC(c, eptr);
4306                prop_category = UCD_CATEGORY(c);
4307                if ((prop_category == ucp_L || prop_category == ucp_N)
4308                       == prop_fail_result)
4309                  MRRETURN(MATCH_NOMATCH);
4310                }
4311              /* Control never gets here */
4312    
4313              case PT_SPACE:    /* Perl space */
4314              for (fi = min;; fi++)
4315                {
4316                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
4317                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4318                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4319                if (eptr >= md->end_subject)
4320                  {
4321                  SCHECK_PARTIAL();
4322                  MRRETURN(MATCH_NOMATCH);
4323                  }
4324                GETCHARINC(c, eptr);
4325                prop_category = UCD_CATEGORY(c);
4326                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4327                     c == CHAR_FF || c == CHAR_CR)
4328                       == prop_fail_result)
4329                  MRRETURN(MATCH_NOMATCH);
4330                }
4331              /* Control never gets here */
4332    
4333              case PT_PXSPACE:  /* POSIX space */
4334              for (fi = min;; fi++)
4335                {
4336                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
4337                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4338                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4339                if (eptr >= md->end_subject)
4340                  {
4341                  SCHECK_PARTIAL();
4342                  MRRETURN(MATCH_NOMATCH);
4343                  }
4344                GETCHARINC(c, eptr);
4345                prop_category = UCD_CATEGORY(c);
4346                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4347                     c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
4348                       == prop_fail_result)
4349                  MRRETURN(MATCH_NOMATCH);
4350                }
4351              /* Control never gets here */
4352    
4353              case PT_WORD:
4354              for (fi = min;; fi++)
4355                {
4356                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
4357                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4358                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4359                if (eptr >= md->end_subject)
4360                  {
4361                  SCHECK_PARTIAL();
4362                  MRRETURN(MATCH_NOMATCH);
4363                  }
4364                GETCHARINC(c, eptr);
4365                prop_category = UCD_CATEGORY(c);
4366                if ((prop_category == ucp_L ||
4367                     prop_category == ucp_N ||
4368                     c == CHAR_UNDERSCORE)
4369                       == prop_fail_result)
4370                  MRRETURN(MATCH_NOMATCH);
4371                }
4372              /* Control never gets here */
4373    
4374              /* This should never occur */
4375    
4376            default:            default:
4377            RRETURN(PCRE_ERROR_INTERNAL);            RRETURN(PCRE_ERROR_INTERNAL);
4378            }            }
# Line 4547  for (;;) Line 4794  for (;;)
4794              eptr+= len;              eptr+= len;
4795              }              }
4796            break;            break;
4797    
4798              case PT_ALNUM:
4799              for (i = min; i < max; i++)
4800                {
4801                int len = 1;
4802                if (eptr >= md->end_subject)
4803                  {
4804                  SCHECK_PARTIAL();
4805                  break;
4806                  }
4807                GETCHARLEN(c, eptr, len);
4808                prop_category = UCD_CATEGORY(c);
4809                if ((prop_category == ucp_L || prop_category == ucp_N)
4810                     == prop_fail_result)
4811                  break;
4812                eptr+= len;
4813                }
4814              break;
4815    
4816              case PT_SPACE:    /* Perl space */
4817              for (i = min; i < max; i++)
4818                {
4819                int len = 1;
4820                if (eptr >= md->end_subject)
4821                  {
4822                  SCHECK_PARTIAL();
4823                  break;
4824                  }
4825                GETCHARLEN(c, eptr, len);
4826                prop_category = UCD_CATEGORY(c);
4827                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4828                     c == CHAR_FF || c == CHAR_CR)
4829                     == prop_fail_result)
4830                  break;
4831                eptr+= len;
4832                }
4833              break;
4834    
4835              case PT_PXSPACE:  /* POSIX space */
4836              for (i = min; i < max; i++)
4837                {
4838                int len = 1;
4839                if (eptr >= md->end_subject)
4840                  {
4841                  SCHECK_PARTIAL();
4842                  break;
4843                  }
4844                GETCHARLEN(c, eptr, len);
4845                prop_category = UCD_CATEGORY(c);
4846                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4847                     c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
4848                     == prop_fail_result)
4849                  break;
4850                eptr+= len;
4851                }
4852              break;
4853    
4854              case PT_WORD:
4855              for (i = min; i < max; i++)
4856                {
4857                int len = 1;
4858                if (eptr >= md->end_subject)
4859                  {
4860                  SCHECK_PARTIAL();
4861                  break;
4862                  }
4863                GETCHARLEN(c, eptr, len);
4864                prop_category = UCD_CATEGORY(c);
4865                if ((prop_category == ucp_L || prop_category == ucp_N ||
4866                     c == CHAR_UNDERSCORE) == prop_fail_result)
4867                  break;
4868                eptr+= len;
4869                }
4870              break;
4871    
4872              default:
4873              RRETURN(PCRE_ERROR_INTERNAL);
4874            }            }
4875    
4876          /* 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 5456  switch (frame->Xwhere)
5456    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)
5457    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)
5458    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)
5459    LBL(53) LBL(54)    LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58)
5460  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
5461    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)
5462    LBL(32) LBL(34) LBL(42) LBL(46)    LBL(32) LBL(34) LBL(42) LBL(46)
# Line 5341  end_subject = md->end_subject; Line 5665  end_subject = md->end_subject;
5665    
5666  md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;  md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
5667  utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0;  utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0;
5668    md->use_ucp = (re->options & PCRE_UCP) != 0;
5669  md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;  md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
5670    
5671  md->notbol = (options & PCRE_NOTBOL) != 0;  md->notbol = (options & PCRE_NOTBOL) != 0;
# Line 5721  for(;;) Line 6046  for(;;)
6046    
6047    /* 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
6048    first starting point for which a partial match was found. */    first starting point for which a partial match was found. */
6049    
6050    md->start_match_ptr = start_match;    md->start_match_ptr = start_match;
6051    md->start_used_ptr = start_match;    md->start_used_ptr = start_match;
6052    md->match_call_count = 0;    md->match_call_count = 0;
# Line 5731  for(;;) Line 6056  for(;;)
6056    
6057    switch(rc)    switch(rc)
6058      {      {
6059      /* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches      /* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches
6060      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.
6061      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. */
6062    
6063      case MATCH_NOMATCH:      case MATCH_NOMATCH:
6064      case MATCH_PRUNE:      case MATCH_PRUNE:
6065      case MATCH_SKIP_ARG:      case MATCH_SKIP_ARG:
6066      case MATCH_THEN:      case MATCH_THEN:
6067      new_start_match = start_match + 1;      new_start_match = start_match + 1;
6068  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 5823  capturing parentheses than vector slots. Line 6148  capturing parentheses than vector slots.
6148    
6149  ENDLOOP:  ENDLOOP:
6150    
6151  if (rc == MATCH_MATCH)  if (rc == MATCH_MATCH || rc == MATCH_ACCEPT)
6152    {    {
6153    if (using_temporary_offsets)    if (using_temporary_offsets)
6154      {      {
# Line 5865  if (using_temporary_offsets) Line 6190  if (using_temporary_offsets)
6190    DPRINTF(("Freeing temporary memory\n"));    DPRINTF(("Freeing temporary memory\n"));
6191    (pcre_free)(md->offset_vector);    (pcre_free)(md->offset_vector);
6192    }    }
6193    
6194  /* For anything other than nomatch or partial match, just return the code. */  /* For anything other than nomatch or partial match, just return the code. */
6195    
6196  if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL)  if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL)
6197    {    {
6198    DPRINTF((">>>> error: returning %d\n", rc));    DPRINTF((">>>> error: returning %d\n", rc));
6199    return rc;    return rc;
6200    }    }
6201    
6202  /* Handle partial matches - disable any mark data */  /* Handle partial matches - disable any mark data */
6203    
6204  if (start_partial != NULL)  if (start_partial != NULL)
6205    {    {
6206    DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));    DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));
6207    md->mark = NULL;    md->mark = NULL;
6208    if (offsetcount > 1)    if (offsetcount > 1)
6209      {      {
6210      offsets[0] = start_partial - (USPTR)subject;      offsets[0] = start_partial - (USPTR)subject;
# Line 5887  if (start_partial != NULL) Line 6212  if (start_partial != NULL)
6212      }      }
6213    rc = PCRE_ERROR_PARTIAL;    rc = PCRE_ERROR_PARTIAL;
6214    }    }
6215    
6216  /* This is the classic nomatch case */  /* This is the classic nomatch case */
6217    
6218  else  else
6219    {    {
6220    DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n"));    DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n"));
6221    rc = PCRE_ERROR_NOMATCH;    rc = PCRE_ERROR_NOMATCH;
6222    }    }
6223    
6224  /* Return the MARK data if it has been requested. */  /* Return the MARK data if it has been requested. */
6225    
6226  RETURN_MARK:  RETURN_MARK:
6227    
6228  if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)  if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)
6229    *(extra_data->mark) = (unsigned char *)(md->mark);    *(extra_data->mark) = (unsigned char *)(md->mark);
6230  return rc;  return rc;
6231  }  }
6232    
6233  /* End of pcre_exec.c */  /* End of pcre_exec.c */

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

  ViewVC Help
Powered by ViewVC 1.1.5