/[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 511 by ph10, Mon Mar 29 09:25:38 2010 UTC revision 529 by ph10, Mon May 31 17:28:08 2010 UTC
# Line 255  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, RM59, RM60,
259           RM61,  RM62 };
260    
261  /* 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
262  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 314  argument of match(), which never changes Line 315  argument of match(), which never changes
315    
316  #define RRETURN(ra)\  #define RRETURN(ra)\
317    {\    {\
318    heapframe *newframe = frame;\    heapframe *oldframe = frame;\
319    frame = newframe->Xprevframe;\    frame = oldframe->Xprevframe;\
320    (pcre_stack_free)(newframe);\    (pcre_stack_free)(oldframe);\
321    if (frame != NULL)\    if (frame != NULL)\
322      {\      {\
323      rrc = ra;\      rrc = ra;\
# Line 685  for (;;) Line 686  for (;;)
686      case OP_MARK:      case OP_MARK:
687      markptr = ecode + 2;      markptr = ecode + 2;
688      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
689        ims, eptrb, flags, RM51);        ims, eptrb, flags, RM55);
690    
691      /* 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
692      argument, and we must check whether that argument matches this MARK's      argument, and we must check whether that argument matches this MARK's
693      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
694      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
695      position and return MATCH_SKIP. Otherwise, pass back the return code      position and return MATCH_SKIP. Otherwise, pass back the return code
696      unaltered. */      unaltered. */
697    
698      if (rrc == MATCH_SKIP_ARG &&      if (rrc == MATCH_SKIP_ARG &&
699          strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0)          strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0)
700        {        {
701        md->start_match_ptr = eptr;        md->start_match_ptr = eptr;
702        RRETURN(MATCH_SKIP);        RRETURN(MATCH_SKIP);
703        }        }
704    
705      if (md->mark == NULL) md->mark = markptr;      if (md->mark == NULL) md->mark = markptr;
706      RRETURN(rrc);      RRETURN(rrc);
707    
708      case OP_FAIL:      case OP_FAIL:
# Line 721  for (;;) Line 722  for (;;)
722    
723      case OP_PRUNE_ARG:      case OP_PRUNE_ARG:
724      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
725        ims, eptrb, flags, RM51);        ims, eptrb, flags, RM56);
726      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
727      md->mark = ecode + 2;      md->mark = ecode + 2;
728      RRETURN(MATCH_PRUNE);      RRETURN(MATCH_PRUNE);
# Line 735  for (;;) Line 736  for (;;)
736    
737      case OP_SKIP_ARG:      case OP_SKIP_ARG:
738      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
739        ims, eptrb, flags, RM53);        ims, eptrb, flags, RM57);
740      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
741    
742      /* 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
743      returning the special MATCH_SKIP_ARG return code. This will either be      returning the special MATCH_SKIP_ARG return code. This will either be
744      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
745      as PRUNE. */      as PRUNE. */
746    
747      md->start_match_ptr = ecode + 2;      md->start_match_ptr = ecode + 2;
748      RRETURN(MATCH_SKIP_ARG);      RRETURN(MATCH_SKIP_ARG);
749    
750      case OP_THEN:      case OP_THEN:
751      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
752        ims, eptrb, flags, RM54);        ims, eptrb, flags, RM54);
# Line 754  for (;;) Line 755  for (;;)
755    
756      case OP_THEN_ARG:      case OP_THEN_ARG:
757      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,      RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
758        ims, eptrb, flags, RM54);        ims, eptrb, flags, RM58);
759      if (rrc != MATCH_NOMATCH) RRETURN(rrc);      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
760      md->mark = ecode + 2;      md->mark = ecode + 2;
761      RRETURN(MATCH_THEN);      RRETURN(MATCH_THEN);
# Line 852  for (;;) Line 853  for (;;)
853    
854          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
855            eptrb, flags, RM48);            eptrb, flags, RM48);
856          if (rrc == MATCH_NOMATCH) md->mark = markptr;          if (rrc == MATCH_NOMATCH) md->mark = markptr;
857          RRETURN(rrc);          RRETURN(rrc);
858          }          }
859    
860        /* For non-final alternatives, continue the loop for a NOMATCH result;        /* For non-final alternatives, continue the loop for a NOMATCH result;
# Line 1158  for (;;) Line 1159  for (;;)
1159      md->end_match_ptr = eptr;           /* Record where we ended */      md->end_match_ptr = eptr;           /* Record where we ended */
1160      md->end_offset_top = offset_top;    /* and how many extracts were taken */      md->end_offset_top = offset_top;    /* and how many extracts were taken */
1161      md->start_match_ptr = mstart;       /* and the start (\K can modify) */      md->start_match_ptr = mstart;       /* and the start (\K can modify) */
1162      MRRETURN(((op == OP_END)? MATCH_MATCH : MATCH_ACCEPT));  
1163        /* For some reason, the macros don't work properly if an expression is
1164        given as the argument to MRRETURN when the heap is in use. */
1165    
1166        rrc = (op == OP_END)? MATCH_MATCH : MATCH_ACCEPT;
1167        MRRETURN(rrc);
1168    
1169      /* Change option settings */      /* Change option settings */
1170    
# Line 1713  for (;;) Line 1719  for (;;)
1719  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1720        if (utf8)        if (utf8)
1721          {          {
1722            /* Get status of previous character */
1723    
1724          if (eptr == md->start_subject) prev_is_word = FALSE; else          if (eptr == md->start_subject) prev_is_word = FALSE; else
1725            {            {
1726            USPTR lastptr = eptr - 1;            USPTR lastptr = eptr - 1;
1727            while((*lastptr & 0xc0) == 0x80) lastptr--;            while((*lastptr & 0xc0) == 0x80) lastptr--;
1728            if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr;            if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr;
1729            GETCHAR(c, lastptr);            GETCHAR(c, lastptr);
1730    #ifdef SUPPORT_UCP
1731              if (md->use_ucp)
1732                {
1733                if (c == '_') prev_is_word = TRUE; else
1734                  {
1735                  int cat = UCD_CATEGORY(c);
1736                  prev_is_word = (cat == ucp_L || cat == ucp_N);
1737                  }
1738                }
1739              else
1740    #endif
1741            prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;            prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
1742            }            }
1743    
1744            /* Get status of next character */
1745    
1746          if (eptr >= md->end_subject)          if (eptr >= md->end_subject)
1747            {            {
1748            SCHECK_PARTIAL();            SCHECK_PARTIAL();
# Line 1729  for (;;) Line 1751  for (;;)
1751          else          else
1752            {            {
1753            GETCHAR(c, eptr);            GETCHAR(c, eptr);
1754    #ifdef SUPPORT_UCP
1755              if (md->use_ucp)
1756                {
1757                if (c == '_') cur_is_word = TRUE; else
1758                  {
1759                  int cat = UCD_CATEGORY(c);
1760                  cur_is_word = (cat == ucp_L || cat == ucp_N);
1761                  }
1762                }
1763              else
1764    #endif
1765            cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;            cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
1766            }            }
1767          }          }
1768        else        else
1769  #endif  #endif
1770    
1771        /* Not in UTF-8 mode */        /* Not in UTF-8 mode, but we may still have PCRE_UCP set, and for
1772          consistency with the behaviour of \w we do use it in this case. */
1773    
1774          {          {
1775            /* Get status of previous character */
1776    
1777          if (eptr == md->start_subject) prev_is_word = FALSE; else          if (eptr == md->start_subject) prev_is_word = FALSE; else
1778            {            {
1779            if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1;            if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1;
1780    #ifdef SUPPORT_UCP
1781              if (md->use_ucp)
1782                {
1783                c = eptr[-1];
1784                if (c == '_') prev_is_word = TRUE; else
1785                  {
1786                  int cat = UCD_CATEGORY(c);
1787                  prev_is_word = (cat == ucp_L || cat == ucp_N);
1788                  }
1789                }
1790              else
1791    #endif
1792            prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0);            prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0);
1793            }            }
1794    
1795            /* Get status of next character */
1796    
1797          if (eptr >= md->end_subject)          if (eptr >= md->end_subject)
1798            {            {
1799            SCHECK_PARTIAL();            SCHECK_PARTIAL();
1800            cur_is_word = FALSE;            cur_is_word = FALSE;
1801            }            }
1802          else cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0);          else
1803    #ifdef SUPPORT_UCP
1804            if (md->use_ucp)
1805              {
1806              c = *eptr;
1807              if (c == '_') cur_is_word = TRUE; else
1808                {
1809                int cat = UCD_CATEGORY(c);
1810                cur_is_word = (cat == ucp_L || cat == ucp_N);
1811                }
1812              }
1813            else
1814    #endif
1815            cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0);
1816          }          }
1817    
1818        /* Now see if the situation is what we want */        /* Now see if the situation is what we want */
# Line 2055  for (;;) Line 2119  for (;;)
2119               prop->chartype == ucp_Ll ||               prop->chartype == ucp_Ll ||
2120               prop->chartype == ucp_Lt) == (op == OP_NOTPROP))               prop->chartype == ucp_Lt) == (op == OP_NOTPROP))
2121            MRRETURN(MATCH_NOMATCH);            MRRETURN(MATCH_NOMATCH);
2122           break;          break;
2123    
2124          case PT_GC:          case PT_GC:
2125          if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP))          if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP))
# Line 2072  for (;;) Line 2136  for (;;)
2136            MRRETURN(MATCH_NOMATCH);            MRRETURN(MATCH_NOMATCH);
2137          break;          break;
2138    
2139            /* These are specials */
2140    
2141            case PT_ALNUM:
2142            if ((_pcre_ucp_gentype[prop->chartype] == ucp_L ||
2143                 _pcre_ucp_gentype[prop->chartype] == ucp_N) == (op == OP_NOTPROP))
2144              MRRETURN(MATCH_NOMATCH);
2145            break;
2146    
2147            case PT_SPACE:    /* Perl space */
2148            if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z ||
2149                 c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR)
2150                   == (op == OP_NOTPROP))
2151              MRRETURN(MATCH_NOMATCH);
2152            break;
2153    
2154            case PT_PXSPACE:  /* POSIX space */
2155            if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z ||
2156                 c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
2157                 c == CHAR_FF || c == CHAR_CR)
2158                   == (op == OP_NOTPROP))
2159              MRRETURN(MATCH_NOMATCH);
2160            break;
2161    
2162            case PT_WORD:
2163            if ((_pcre_ucp_gentype[prop->chartype] == ucp_L ||
2164                 _pcre_ucp_gentype[prop->chartype] == ucp_N ||
2165                 c == CHAR_UNDERSCORE) == (op == OP_NOTPROP))
2166              MRRETURN(MATCH_NOMATCH);
2167            break;
2168    
2169            /* This should never occur */
2170    
2171          default:          default:
2172          RRETURN(PCRE_ERROR_INTERNAL);          RRETURN(PCRE_ERROR_INTERNAL);
2173          }          }
# Line 3488  for (;;) Line 3584  for (;;)
3584              }              }
3585            break;            break;
3586    
3587              case PT_ALNUM:
3588              for (i = 1; i <= min; i++)
3589                {
3590                if (eptr >= md->end_subject)
3591                  {
3592                  SCHECK_PARTIAL();
3593                  MRRETURN(MATCH_NOMATCH);
3594                  }
3595                GETCHARINCTEST(c, eptr);
3596                prop_category = UCD_CATEGORY(c);
3597                if ((prop_category == ucp_L || prop_category == ucp_N)
3598                       == prop_fail_result)
3599                  MRRETURN(MATCH_NOMATCH);
3600                }
3601              break;
3602    
3603              case PT_SPACE:    /* Perl space */
3604              for (i = 1; i <= min; i++)
3605                {
3606                if (eptr >= md->end_subject)
3607                  {
3608                  SCHECK_PARTIAL();
3609                  MRRETURN(MATCH_NOMATCH);
3610                  }
3611                GETCHARINCTEST(c, eptr);
3612                prop_category = UCD_CATEGORY(c);
3613                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
3614                     c == CHAR_FF || c == CHAR_CR)
3615                       == prop_fail_result)
3616                  MRRETURN(MATCH_NOMATCH);
3617                }
3618              break;
3619    
3620              case PT_PXSPACE:  /* POSIX space */
3621              for (i = 1; i <= min; i++)
3622                {
3623                if (eptr >= md->end_subject)
3624                  {
3625                  SCHECK_PARTIAL();
3626                  MRRETURN(MATCH_NOMATCH);
3627                  }
3628                GETCHARINCTEST(c, eptr);
3629                prop_category = UCD_CATEGORY(c);
3630                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
3631                     c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
3632                       == prop_fail_result)
3633                  MRRETURN(MATCH_NOMATCH);
3634                }
3635              break;
3636    
3637              case PT_WORD:
3638              for (i = 1; i <= min; i++)
3639                {
3640                if (eptr >= md->end_subject)
3641                  {
3642                  SCHECK_PARTIAL();
3643                  MRRETURN(MATCH_NOMATCH);
3644                  }
3645                GETCHARINCTEST(c, eptr);
3646                prop_category = UCD_CATEGORY(c);
3647                if ((prop_category == ucp_L || prop_category == ucp_N ||
3648                     c == CHAR_UNDERSCORE)
3649                       == prop_fail_result)
3650                  MRRETURN(MATCH_NOMATCH);
3651                }
3652              break;
3653    
3654              /* This should not occur */
3655    
3656            default:            default:
3657            RRETURN(PCRE_ERROR_INTERNAL);            RRETURN(PCRE_ERROR_INTERNAL);
3658            }            }
# Line 4048  for (;;) Line 4213  for (;;)
4213                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4214                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4215                }                }
4216              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4217              if (prop_fail_result) MRRETURN(MATCH_NOMATCH);              if (prop_fail_result) MRRETURN(MATCH_NOMATCH);
4218              }              }
4219            /* Control never gets here */            /* Control never gets here */
# Line 4064  for (;;) Line 4229  for (;;)
4229                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4230                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4231                }                }
4232              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4233              prop_chartype = UCD_CHARTYPE(c);              prop_chartype = UCD_CHARTYPE(c);
4234              if ((prop_chartype == ucp_Lu ||              if ((prop_chartype == ucp_Lu ||
4235                   prop_chartype == ucp_Ll ||                   prop_chartype == ucp_Ll ||
# Line 4084  for (;;) Line 4249  for (;;)
4249                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4250                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4251                }                }
4252              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4253              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4254              if ((prop_category == prop_value) == prop_fail_result)              if ((prop_category == prop_value) == prop_fail_result)
4255                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
# Line 4102  for (;;) Line 4267  for (;;)
4267                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4268                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4269                }                }
4270              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4271              prop_chartype = UCD_CHARTYPE(c);              prop_chartype = UCD_CHARTYPE(c);
4272              if ((prop_chartype == prop_value) == prop_fail_result)              if ((prop_chartype == prop_value) == prop_fail_result)
4273                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
# Line 4120  for (;;) Line 4285  for (;;)
4285                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4286                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4287                }                }
4288              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4289              prop_script = UCD_SCRIPT(c);              prop_script = UCD_SCRIPT(c);
4290              if ((prop_script == prop_value) == prop_fail_result)              if ((prop_script == prop_value) == prop_fail_result)
4291                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4292              }              }
4293            /* Control never gets here */            /* Control never gets here */
4294    
4295              case PT_ALNUM:
4296              for (fi = min;; fi++)
4297                {
4298                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM59);
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                GETCHARINCTEST(c, eptr);
4307                prop_category = UCD_CATEGORY(c);
4308                if ((prop_category == ucp_L || prop_category == ucp_N)
4309                       == prop_fail_result)
4310                  MRRETURN(MATCH_NOMATCH);
4311                }
4312              /* Control never gets here */
4313    
4314              case PT_SPACE:    /* Perl space */
4315              for (fi = min;; fi++)
4316                {
4317                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM60);
4318                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4319                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4320                if (eptr >= md->end_subject)
4321                  {
4322                  SCHECK_PARTIAL();
4323                  MRRETURN(MATCH_NOMATCH);
4324                  }
4325                GETCHARINCTEST(c, eptr);
4326                prop_category = UCD_CATEGORY(c);
4327                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4328                     c == CHAR_FF || c == CHAR_CR)
4329                       == prop_fail_result)
4330                  MRRETURN(MATCH_NOMATCH);
4331                }
4332              /* Control never gets here */
4333    
4334              case PT_PXSPACE:  /* POSIX space */
4335              for (fi = min;; fi++)
4336                {
4337                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM61);
4338                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4339                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4340                if (eptr >= md->end_subject)
4341                  {
4342                  SCHECK_PARTIAL();
4343                  MRRETURN(MATCH_NOMATCH);
4344                  }
4345                GETCHARINCTEST(c, eptr);
4346                prop_category = UCD_CATEGORY(c);
4347                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4348                     c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
4349                       == prop_fail_result)
4350                  MRRETURN(MATCH_NOMATCH);
4351                }
4352              /* Control never gets here */
4353    
4354              case PT_WORD:
4355              for (fi = min;; fi++)
4356                {
4357                RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM62);
4358                if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4359                if (fi >= max) MRRETURN(MATCH_NOMATCH);
4360                if (eptr >= md->end_subject)
4361                  {
4362                  SCHECK_PARTIAL();
4363                  MRRETURN(MATCH_NOMATCH);
4364                  }
4365                GETCHARINCTEST(c, eptr);
4366                prop_category = UCD_CATEGORY(c);
4367                if ((prop_category == ucp_L ||
4368                     prop_category == ucp_N ||
4369                     c == CHAR_UNDERSCORE)
4370                       == prop_fail_result)
4371                  MRRETURN(MATCH_NOMATCH);
4372                }
4373              /* Control never gets here */
4374    
4375              /* This should never occur */
4376    
4377            default:            default:
4378            RRETURN(PCRE_ERROR_INTERNAL);            RRETURN(PCRE_ERROR_INTERNAL);
4379            }            }
# Line 4473  for (;;) Line 4720  for (;;)
4720                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4721                break;                break;
4722                }                }
4723              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4724              if (prop_fail_result) break;              if (prop_fail_result) break;
4725              eptr+= len;              eptr+= len;
4726              }              }
# Line 4488  for (;;) Line 4735  for (;;)
4735                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4736                break;                break;
4737                }                }
4738              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4739              prop_chartype = UCD_CHARTYPE(c);              prop_chartype = UCD_CHARTYPE(c);
4740              if ((prop_chartype == ucp_Lu ||              if ((prop_chartype == ucp_Lu ||
4741                   prop_chartype == ucp_Ll ||                   prop_chartype == ucp_Ll ||
# Line 4507  for (;;) Line 4754  for (;;)
4754                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4755                break;                break;
4756                }                }
4757              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4758              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4759              if ((prop_category == prop_value) == prop_fail_result)              if ((prop_category == prop_value) == prop_fail_result)
4760                break;                break;
# Line 4524  for (;;) Line 4771  for (;;)
4771                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4772                break;                break;
4773                }                }
4774              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4775              prop_chartype = UCD_CHARTYPE(c);              prop_chartype = UCD_CHARTYPE(c);
4776              if ((prop_chartype == prop_value) == prop_fail_result)              if ((prop_chartype == prop_value) == prop_fail_result)
4777                break;                break;
# Line 4541  for (;;) Line 4788  for (;;)
4788                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4789                break;                break;
4790                }                }
4791              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4792              prop_script = UCD_SCRIPT(c);              prop_script = UCD_SCRIPT(c);
4793              if ((prop_script == prop_value) == prop_fail_result)              if ((prop_script == prop_value) == prop_fail_result)
4794                break;                break;
4795              eptr+= len;              eptr+= len;
4796              }              }
4797            break;            break;
4798    
4799              case PT_ALNUM:
4800              for (i = min; i < max; i++)
4801                {
4802                int len = 1;
4803                if (eptr >= md->end_subject)
4804                  {
4805                  SCHECK_PARTIAL();
4806                  break;
4807                  }
4808                GETCHARLENTEST(c, eptr, len);
4809                prop_category = UCD_CATEGORY(c);
4810                if ((prop_category == ucp_L || prop_category == ucp_N)
4811                     == prop_fail_result)
4812                  break;
4813                eptr+= len;
4814                }
4815              break;
4816    
4817              case PT_SPACE:    /* Perl space */
4818              for (i = min; i < max; i++)
4819                {
4820                int len = 1;
4821                if (eptr >= md->end_subject)
4822                  {
4823                  SCHECK_PARTIAL();
4824                  break;
4825                  }
4826                GETCHARLENTEST(c, eptr, len);
4827                prop_category = UCD_CATEGORY(c);
4828                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4829                     c == CHAR_FF || c == CHAR_CR)
4830                     == prop_fail_result)
4831                  break;
4832                eptr+= len;
4833                }
4834              break;
4835    
4836              case PT_PXSPACE:  /* POSIX space */
4837              for (i = min; i < max; i++)
4838                {
4839                int len = 1;
4840                if (eptr >= md->end_subject)
4841                  {
4842                  SCHECK_PARTIAL();
4843                  break;
4844                  }
4845                GETCHARLENTEST(c, eptr, len);
4846                prop_category = UCD_CATEGORY(c);
4847                if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4848                     c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
4849                     == prop_fail_result)
4850                  break;
4851                eptr+= len;
4852                }
4853              break;
4854    
4855              case PT_WORD:
4856              for (i = min; i < max; i++)
4857                {
4858                int len = 1;
4859                if (eptr >= md->end_subject)
4860                  {
4861                  SCHECK_PARTIAL();
4862                  break;
4863                  }
4864                GETCHARLENTEST(c, eptr, len);
4865                prop_category = UCD_CATEGORY(c);
4866                if ((prop_category == ucp_L || prop_category == ucp_N ||
4867                     c == CHAR_UNDERSCORE) == prop_fail_result)
4868                  break;
4869                eptr+= len;
4870                }
4871              break;
4872    
4873              default:
4874              RRETURN(PCRE_ERROR_INTERNAL);
4875            }            }
4876    
4877          /* eptr is now past the end of the maximum run */          /* eptr is now past the end of the maximum run */
# Line 5133  switch (frame->Xwhere) Line 5457  switch (frame->Xwhere)
5457    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)
5458    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)
5459    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)
5460    LBL(53) LBL(54)    LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58)
5461  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
5462    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)
5463    LBL(32) LBL(34) LBL(42) LBL(46)    LBL(32) LBL(34) LBL(42) LBL(46)
5464  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
5465    LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45)    LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45)
5466      LBL(59) LBL(60) LBL(61) LBL(62)
5467  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
5468  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF8 */
5469    default:    default:
# Line 5342  end_subject = md->end_subject; Line 5667  end_subject = md->end_subject;
5667    
5668  md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;  md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
5669  utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0;  utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0;
5670    md->use_ucp = (re->options & PCRE_UCP) != 0;
5671  md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;  md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
5672    
5673  md->notbol = (options & PCRE_NOTBOL) != 0;  md->notbol = (options & PCRE_NOTBOL) != 0;
# Line 5722  for(;;) Line 6048  for(;;)
6048    
6049    /* 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
6050    first starting point for which a partial match was found. */    first starting point for which a partial match was found. */
6051    
6052    md->start_match_ptr = start_match;    md->start_match_ptr = start_match;
6053    md->start_used_ptr = start_match;    md->start_used_ptr = start_match;
6054    md->match_call_count = 0;    md->match_call_count = 0;
# Line 5732  for(;;) Line 6058  for(;;)
6058    
6059    switch(rc)    switch(rc)
6060      {      {
6061      /* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches      /* NOMATCH and PRUNE advance by one character. If MATCH_SKIP_ARG reaches
6062      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.
6063      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. */
6064    
6065      case MATCH_NOMATCH:      case MATCH_NOMATCH:
6066      case MATCH_PRUNE:      case MATCH_PRUNE:
6067      case MATCH_SKIP_ARG:      case MATCH_SKIP_ARG:
6068      case MATCH_THEN:      case MATCH_THEN:
6069      new_start_match = start_match + 1;      new_start_match = start_match + 1;
6070  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 5866  if (using_temporary_offsets) Line 6192  if (using_temporary_offsets)
6192    DPRINTF(("Freeing temporary memory\n"));    DPRINTF(("Freeing temporary memory\n"));
6193    (pcre_free)(md->offset_vector);    (pcre_free)(md->offset_vector);
6194    }    }
6195    
6196  /* For anything other than nomatch or partial match, just return the code. */  /* For anything other than nomatch or partial match, just return the code. */
6197    
6198  if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL)  if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL)
6199    {    {
6200    DPRINTF((">>>> error: returning %d\n", rc));    DPRINTF((">>>> error: returning %d\n", rc));
6201    return rc;    return rc;
6202    }    }
6203    
6204  /* Handle partial matches - disable any mark data */  /* Handle partial matches - disable any mark data */
6205    
6206  if (start_partial != NULL)  if (start_partial != NULL)
6207    {    {
6208    DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));    DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));
6209    md->mark = NULL;    md->mark = NULL;
6210    if (offsetcount > 1)    if (offsetcount > 1)
6211      {      {
6212      offsets[0] = start_partial - (USPTR)subject;      offsets[0] = start_partial - (USPTR)subject;
# Line 5888  if (start_partial != NULL) Line 6214  if (start_partial != NULL)
6214      }      }
6215    rc = PCRE_ERROR_PARTIAL;    rc = PCRE_ERROR_PARTIAL;
6216    }    }
6217    
6218  /* This is the classic nomatch case */  /* This is the classic nomatch case */
6219    
6220  else  else
6221    {    {
6222    DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n"));    DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n"));
6223    rc = PCRE_ERROR_NOMATCH;    rc = PCRE_ERROR_NOMATCH;
6224    }    }
6225    
6226  /* Return the MARK data if it has been requested. */  /* Return the MARK data if it has been requested. */
6227    
6228  RETURN_MARK:  RETURN_MARK:
6229    
6230  if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)  if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)
6231    *(extra_data->mark) = (unsigned char *)(md->mark);    *(extra_data->mark) = (unsigned char *)(md->mark);
6232  return rc;  return rc;
6233  }  }
6234    
6235  /* End of pcre_exec.c */  /* End of pcre_exec.c */

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

  ViewVC Help
Powered by ViewVC 1.1.5