/[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 1092 by chpe, Tue Oct 16 15:55:55 2012 UTC revision 1187 by zherczeg, Mon Oct 29 11:30:45 2012 UTC
# Line 92  because the offset vector is always a mu Line 92  because the offset vector is always a mu
92  static const char rep_min[] = { 0, 0, 1, 1, 0, 0 };  static const char rep_min[] = { 0, 0, 1, 1, 0, 0 };
93  static const char rep_max[] = { 0, 0, 0, 0, 1, 1 };  static const char rep_max[] = { 0, 0, 0, 0, 1, 1 };
94    
   
   
95  #ifdef PCRE_DEBUG  #ifdef PCRE_DEBUG
96  /*************************************************  /*************************************************
97  *        Debugging function to print chars       *  *        Debugging function to print chars       *
# Line 114  Returns:     nothing Line 112  Returns:     nothing
112  static void  static void
113  pchars(const pcre_uchar *p, int length, BOOL is_subject, match_data *md)  pchars(const pcre_uchar *p, int length, BOOL is_subject, match_data *md)
114  {  {
115  unsigned int c;  pcre_uint32 c;
116    BOOL utf = md->utf;
117  if (is_subject && length > md->end_subject - p) length = md->end_subject - p;  if (is_subject && length > md->end_subject - p) length = md->end_subject - p;
118  while (length-- > 0)  while (length-- > 0)
119    if (isprint(c = *(p++))) printf("%c", c); else printf("\\x%02x", c);    if (isprint(c = RAWUCHARINCTEST(p))) printf("%c", (char)c); else printf("\\x{%02x}", c);
120  }  }
121  #endif  #endif
122    
# Line 150  match_ref(int offset, register PCRE_PUCH Line 149  match_ref(int offset, register PCRE_PUCH
149  {  {
150  PCRE_PUCHAR eptr_start = eptr;  PCRE_PUCHAR eptr_start = eptr;
151  register PCRE_PUCHAR p = md->start_subject + md->offset_vector[offset];  register PCRE_PUCHAR p = md->start_subject + md->offset_vector[offset];
152    #ifdef SUPPORT_UTF
153    BOOL utf = md->utf;
154    #endif
155    
156  #ifdef PCRE_DEBUG  #ifdef PCRE_DEBUG
157  if (eptr >= md->end_subject)  if (eptr >= md->end_subject)
# Line 177  if (caseless) Line 179  if (caseless)
179    {    {
180  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
181  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
182    if (md->utf)    if (utf)
183      {      {
184      /* Match characters up to the end of the reference. NOTE: the number of      /* Match characters up to the end of the reference. NOTE: the number of
185      data units matched may differ, because in UTF-8 there are some characters      data units matched may differ, because in UTF-8 there are some characters
# Line 217  if (caseless) Line 219  if (caseless)
219      {      {
220      while (length-- > 0)      while (length-- > 0)
221        {        {
222          pcre_uchar cc, cp;
223        if (eptr >= md->end_subject) return -2;   /* Partial match */        if (eptr >= md->end_subject) return -2;   /* Partial match */
224        if (TABLE_GET(*p, md->lcc, *p) != TABLE_GET(*eptr, md->lcc, *eptr)) return -1;        cc = RAWUCHARTEST(eptr);
225          cp = RAWUCHARTEST(p);
226          if (TABLE_GET(cp, md->lcc, cp) != TABLE_GET(cc, md->lcc, cc)) return -1;
227        p++;        p++;
228        eptr++;        eptr++;
229        }        }
# Line 233  else Line 238  else
238    while (length-- > 0)    while (length-- > 0)
239      {      {
240      if (eptr >= md->end_subject) return -2;   /* Partial match */      if (eptr >= md->end_subject) return -2;   /* Partial match */
241      if (*p++ != *eptr++) return -1;      if (RAWUCHARINCTEST(p) != RAWUCHARINCTEST(eptr)) return -1;
242      }      }
243    }    }
244    
# Line 289  enum { RM1=1, RM2,  RM3,  RM4,  RM5,  RM Line 294  enum { RM1=1, RM2,  RM3,  RM4,  RM5,  RM
294         RM31,  RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,         RM31,  RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,
295         RM41,  RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,         RM41,  RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,
296         RM51,  RM52, RM53, RM54, RM55, RM56, RM57, RM58, RM59, RM60,         RM51,  RM52, RM53, RM54, RM55, RM56, RM57, RM58, RM59, RM60,
297         RM61,  RM62, RM63, RM64, RM65, RM66 };         RM61,  RM62, RM63, RM64, RM65, RM66, RM67 };
298    
299  /* 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
300  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 307  actually used in this definition. */ Line 312  actually used in this definition. */
312    }    }
313  #define RRETURN(ra) \  #define RRETURN(ra) \
314    { \    { \
315    printf("match() returned %d from line %d ", ra, __LINE__); \    printf("match() returned %d from line %d\n", ra, __LINE__); \
316    return ra; \    return ra; \
317    }    }
318  #else  #else
# Line 398  typedef struct heapframe { Line 403  typedef struct heapframe {
403    
404  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
405    int Xprop_type;    int Xprop_type;
406    int Xprop_value;    unsigned int Xprop_value;
407    int Xprop_fail_result;    int Xprop_fail_result;
408    int Xoclength;    int Xoclength;
409    pcre_uchar Xocchars[6];    pcre_uchar Xocchars[6];
# Line 616  BOOL prev_is_word; Line 621  BOOL prev_is_word;
621    
622  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
623  int prop_type;  int prop_type;
624  int prop_value;  unsigned int prop_value;
625  int prop_fail_result;  int prop_fail_result;
626  int oclength;  int oclength;
627  pcre_uchar occhars[6];  pcre_uchar occhars[6];
# Line 627  int ctype; Line 632  int ctype;
632  int length;  int length;
633  int max;  int max;
634  int min;  int min;
635  int number;  unsigned int number;
636  int offset;  int offset;
637  pcre_uchar op;  pcre_uchar op;
638  int save_capture_last;  int save_capture_last;
# Line 748  for (;;) Line 753  for (;;)
753      unaltered. */      unaltered. */
754    
755      else if (rrc == MATCH_SKIP_ARG &&      else if (rrc == MATCH_SKIP_ARG &&
756          STRCMP_UC_UC(ecode + 2, md->start_match_ptr) == 0)          STRCMP_UC_UC_TEST(ecode + 2, md->start_match_ptr) == 0)
757        {        {
758        md->start_match_ptr = eptr;        md->start_match_ptr = eptr;
759        RRETURN(MATCH_SKIP);        RRETURN(MATCH_SKIP);
# Line 1308  for (;;) Line 1313  for (;;)
1313          }          }
1314        else        else
1315          {          {
1316          int recno = GET2(ecode, LINK_SIZE + 2);   /* Recursion group number*/          unsigned int recno = GET2(ecode, LINK_SIZE + 2);   /* Recursion group number*/
1317          condition = (recno == RREF_ANY || recno == md->recursive->group_num);          condition = (recno == RREF_ANY || recno == md->recursive->group_num);
1318    
1319          /* If the test is for recursion into a specific subpattern, and it is          /* If the test is for recursion into a specific subpattern, and it is
# Line 1380  for (;;) Line 1385  for (;;)
1385    
1386        if (!condition && condcode == OP_NCREF)        if (!condition && condcode == OP_NCREF)
1387          {          {
1388          int refno = offset >> 1;          unsigned int refno = offset >> 1;
1389          pcre_uchar *slotA = md->name_table;          pcre_uchar *slotA = md->name_table;
1390    
1391          for (i = 0; i < md->name_count; i++)          for (i = 0; i < md->name_count; i++)
# Line 1740  for (;;) Line 1745  for (;;)
1745      case OP_RECURSE:      case OP_RECURSE:
1746        {        {
1747        recursion_info *ri;        recursion_info *ri;
1748        int recno;        unsigned int recno;
1749    
1750        callpat = md->start_code + GET(ecode, 1);        callpat = md->start_code + GET(ecode, 1);
1751        recno = (callpat == md->start_code)? 0 :        recno = (callpat == md->start_code)? 0 :
# Line 2094  for (;;) Line 2099  for (;;)
2099              eptr + 1 >= md->end_subject &&              eptr + 1 >= md->end_subject &&
2100              NLBLOCK->nltype == NLTYPE_FIXED &&              NLBLOCK->nltype == NLTYPE_FIXED &&
2101              NLBLOCK->nllen == 2 &&              NLBLOCK->nllen == 2 &&
2102              *eptr == NLBLOCK->nl[0])              RAWUCHARTEST(eptr) == NLBLOCK->nl[0])
2103            {            {
2104            md->hitend = TRUE;            md->hitend = TRUE;
2105            if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);            if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);
# Line 2138  for (;;) Line 2143  for (;;)
2143            eptr + 1 >= md->end_subject &&            eptr + 1 >= md->end_subject &&
2144            NLBLOCK->nltype == NLTYPE_FIXED &&            NLBLOCK->nltype == NLTYPE_FIXED &&
2145            NLBLOCK->nllen == 2 &&            NLBLOCK->nllen == 2 &&
2146            *eptr == NLBLOCK->nl[0])            RAWUCHARTEST(eptr) == NLBLOCK->nl[0])
2147          {          {
2148          md->hitend = TRUE;          md->hitend = TRUE;
2149          if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);          if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);
# Line 2281  for (;;) Line 2286  for (;;)
2286          eptr + 1 >= md->end_subject &&          eptr + 1 >= md->end_subject &&
2287          NLBLOCK->nltype == NLTYPE_FIXED &&          NLBLOCK->nltype == NLTYPE_FIXED &&
2288          NLBLOCK->nllen == 2 &&          NLBLOCK->nllen == 2 &&
2289          *eptr == NLBLOCK->nl[0])          RAWUCHARTEST(eptr) == NLBLOCK->nl[0])
2290        {        {
2291        md->hitend = TRUE;        md->hitend = TRUE;
2292        if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);        if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);
# Line 2435  for (;;) Line 2440  for (;;)
2440          {          {
2441          SCHECK_PARTIAL();          SCHECK_PARTIAL();
2442          }          }
2443        else if (*eptr == CHAR_LF) eptr++;        else if (RAWUCHARTEST(eptr) == CHAR_LF) eptr++;
2444        break;        break;
2445    
2446        case CHAR_LF:        case CHAR_LF:
# Line 3145  for (;;) Line 3150  for (;;)
3150          CHECK_PARTIAL();             /* Not SCHECK_PARTIAL() */          CHECK_PARTIAL();             /* Not SCHECK_PARTIAL() */
3151          RRETURN(MATCH_NOMATCH);          RRETURN(MATCH_NOMATCH);
3152          }          }
3153        while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH);        while (length-- > 0) if (*ecode++ != RAWUCHARINC(eptr)) RRETURN(MATCH_NOMATCH);
3154        }        }
3155      else      else
3156  #endif  #endif
# Line 3185  for (;;) Line 3190  for (;;)
3190    
3191        if (fc < 128)        if (fc < 128)
3192          {          {
3193          if (md->lcc[fc]          pcre_uchar cc = RAWUCHAR(eptr);
3194              != TABLE_GET(*eptr, md->lcc, *eptr)) RRETURN(MATCH_NOMATCH);          if (md->lcc[fc] != TABLE_GET(cc, md->lcc, cc)) RRETURN(MATCH_NOMATCH);
3195          ecode++;          ecode++;
3196          eptr++;          eptr++;
3197          }          }
# Line 3307  for (;;) Line 3312  for (;;)
3312        if (length > 1)        if (length > 1)
3313          {          {
3314  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3315          unsigned int othercase;          pcre_uint32 othercase;
3316          if (op >= OP_STARI &&     /* Caseless */          if (op >= OP_STARI &&     /* Caseless */
3317              (othercase = UCD_OTHERCASE(fc)) != fc)              (othercase = UCD_OTHERCASE(fc)) != fc)
3318            oclength = PRIV(ord2utf)(othercase, occhars);            oclength = PRIV(ord2utf)(othercase, occhars);
# Line 3434  for (;;) Line 3439  for (;;)
3439    
3440        for (i = 1; i <= min; i++)        for (i = 1; i <= min; i++)
3441          {          {
3442            pcre_uchar cc;
3443    
3444          if (eptr >= md->end_subject)          if (eptr >= md->end_subject)
3445            {            {
3446            SCHECK_PARTIAL();            SCHECK_PARTIAL();
3447            RRETURN(MATCH_NOMATCH);            RRETURN(MATCH_NOMATCH);
3448            }            }
3449          if (fc != *eptr && foc != *eptr) RRETURN(MATCH_NOMATCH);          cc = RAWUCHARTEST(eptr);
3450            if (fc != cc && foc != cc) RRETURN(MATCH_NOMATCH);
3451          eptr++;          eptr++;
3452          }          }
3453        if (min == max) continue;        if (min == max) continue;
# Line 3447  for (;;) Line 3455  for (;;)
3455          {          {
3456          for (fi = min;; fi++)          for (fi = min;; fi++)
3457            {            {
3458              pcre_uchar cc;
3459    
3460            RMATCH(eptr, ecode, offset_top, md, eptrb, RM24);            RMATCH(eptr, ecode, offset_top, md, eptrb, RM24);
3461            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3462            if (fi >= max) RRETURN(MATCH_NOMATCH);            if (fi >= max) RRETURN(MATCH_NOMATCH);
# Line 3455  for (;;) Line 3465  for (;;)
3465              SCHECK_PARTIAL();              SCHECK_PARTIAL();
3466              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
3467              }              }
3468            if (fc != *eptr && foc != *eptr) RRETURN(MATCH_NOMATCH);            cc = RAWUCHARTEST(eptr);
3469              if (fc != cc && foc != cc) RRETURN(MATCH_NOMATCH);
3470            eptr++;            eptr++;
3471            }            }
3472          /* Control never gets here */          /* Control never gets here */
# Line 3465  for (;;) Line 3476  for (;;)
3476          pp = eptr;          pp = eptr;
3477          for (i = min; i < max; i++)          for (i = min; i < max; i++)
3478            {            {
3479              pcre_uchar cc;
3480    
3481            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
3482              {              {
3483              SCHECK_PARTIAL();              SCHECK_PARTIAL();
3484              break;              break;
3485              }              }
3486            if (fc != *eptr && foc != *eptr) break;            cc = RAWUCHARTEST(eptr);
3487              if (fc != cc && foc != cc) break;
3488            eptr++;            eptr++;
3489            }            }
3490    
# Line 3498  for (;;) Line 3512  for (;;)
3512            SCHECK_PARTIAL();            SCHECK_PARTIAL();
3513            RRETURN(MATCH_NOMATCH);            RRETURN(MATCH_NOMATCH);
3514            }            }
3515          if (fc != *eptr++) RRETURN(MATCH_NOMATCH);          if (fc != RAWUCHARINCTEST(eptr)) RRETURN(MATCH_NOMATCH);
3516          }          }
3517    
3518        if (min == max) continue;        if (min == max) continue;
# Line 3515  for (;;) Line 3529  for (;;)
3529              SCHECK_PARTIAL();              SCHECK_PARTIAL();
3530              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
3531              }              }
3532            if (fc != *eptr++) RRETURN(MATCH_NOMATCH);            if (fc != RAWUCHARINCTEST(eptr)) RRETURN(MATCH_NOMATCH);
3533            }            }
3534          /* Control never gets here */          /* Control never gets here */
3535          }          }
# Line 3529  for (;;) Line 3543  for (;;)
3543              SCHECK_PARTIAL();              SCHECK_PARTIAL();
3544              break;              break;
3545              }              }
3546            if (fc != *eptr) break;            if (fc != RAWUCHARTEST(eptr)) break;
3547            eptr++;            eptr++;
3548            }            }
3549          if (possessive) continue;          if (possessive) continue;
# Line 3699  for (;;) Line 3713  for (;;)
3713  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3714        if (utf)        if (utf)
3715          {          {
3716          register unsigned int d;          register pcre_uint32 d;
3717          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
3718            {            {
3719            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
# Line 3734  for (;;) Line 3748  for (;;)
3748  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3749          if (utf)          if (utf)
3750            {            {
3751            register unsigned int d;            register pcre_uint32 d;
3752            for (fi = min;; fi++)            for (fi = min;; fi++)
3753              {              {
3754              RMATCH(eptr, ecode, offset_top, md, eptrb, RM28);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM28);
# Line 3779  for (;;) Line 3793  for (;;)
3793  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3794          if (utf)          if (utf)
3795            {            {
3796            register unsigned int d;            register pcre_uint32 d;
3797            for (i = min; i < max; i++)            for (i = min; i < max; i++)
3798              {              {
3799              int len = 1;              int len = 1;
# Line 3836  for (;;) Line 3850  for (;;)
3850  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3851        if (utf)        if (utf)
3852          {          {
3853          register unsigned int d;          register pcre_uint32 d;
3854          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
3855            {            {
3856            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
# Line 3870  for (;;) Line 3884  for (;;)
3884  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3885          if (utf)          if (utf)
3886            {            {
3887            register unsigned int d;            register pcre_uint32 d;
3888            for (fi = min;; fi++)            for (fi = min;; fi++)
3889              {              {
3890              RMATCH(eptr, ecode, offset_top, md, eptrb, RM32);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM32);
# Line 3914  for (;;) Line 3928  for (;;)
3928  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3929          if (utf)          if (utf)
3930            {            {
3931            register unsigned int d;            register pcre_uint32 d;
3932            for (i = min; i < max; i++)            for (i = min; i < max; i++)
3933              {              {
3934              int len = 1;              int len = 1;
# Line 4270  for (;;) Line 4284  for (;;)
4284                eptr + 1 >= md->end_subject &&                eptr + 1 >= md->end_subject &&
4285                NLBLOCK->nltype == NLTYPE_FIXED &&                NLBLOCK->nltype == NLTYPE_FIXED &&
4286                NLBLOCK->nllen == 2 &&                NLBLOCK->nllen == 2 &&
4287                *eptr == NLBLOCK->nl[0])                RAWUCHAR(eptr) == NLBLOCK->nl[0])
4288              {              {
4289              md->hitend = TRUE;              md->hitend = TRUE;
4290              if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);              if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);
# Line 4312  for (;;) Line 4326  for (;;)
4326              default: RRETURN(MATCH_NOMATCH);              default: RRETURN(MATCH_NOMATCH);
4327    
4328              case CHAR_CR:              case CHAR_CR:
4329              if (eptr < md->end_subject && *eptr == CHAR_LF) eptr++;              if (eptr < md->end_subject && RAWUCHAR(eptr) == CHAR_LF) eptr++;
4330              break;              break;
4331    
4332              case CHAR_LF:              case CHAR_LF:
# Line 4416  for (;;) Line 4430  for (;;)
4430          case OP_DIGIT:          case OP_DIGIT:
4431          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
4432            {            {
4433              pcre_uchar cc;
4434    
4435            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
4436              {              {
4437              SCHECK_PARTIAL();              SCHECK_PARTIAL();
4438              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4439              }              }
4440            if (*eptr >= 128 || (md->ctypes[*eptr] & ctype_digit) == 0)            cc = RAWUCHAR(eptr);
4441              if (cc >= 128 || (md->ctypes[cc] & ctype_digit) == 0)
4442              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4443            eptr++;            eptr++;
4444            /* No need to skip more bytes - we know it's a 1-byte character */            /* No need to skip more bytes - we know it's a 1-byte character */
# Line 4431  for (;;) Line 4448  for (;;)
4448          case OP_NOT_WHITESPACE:          case OP_NOT_WHITESPACE:
4449          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
4450            {            {
4451              pcre_uchar cc;
4452    
4453            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
4454              {              {
4455              SCHECK_PARTIAL();              SCHECK_PARTIAL();
4456              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4457              }              }
4458            if (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0)            cc = RAWUCHAR(eptr);
4459              if (cc < 128 && (md->ctypes[cc] & ctype_space) != 0)
4460              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4461            eptr++;            eptr++;
4462            ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);            ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);
# Line 4446  for (;;) Line 4466  for (;;)
4466          case OP_WHITESPACE:          case OP_WHITESPACE:
4467          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
4468            {            {
4469              pcre_uchar cc;
4470    
4471            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
4472              {              {
4473              SCHECK_PARTIAL();              SCHECK_PARTIAL();
4474              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4475              }              }
4476            if (*eptr >= 128 || (md->ctypes[*eptr] & ctype_space) == 0)            cc = RAWUCHAR(eptr);
4477              if (cc >= 128 || (md->ctypes[cc] & ctype_space) == 0)
4478              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4479            eptr++;            eptr++;
4480            /* No need to skip more bytes - we know it's a 1-byte character */            /* No need to skip more bytes - we know it's a 1-byte character */
# Line 4461  for (;;) Line 4484  for (;;)
4484          case OP_NOT_WORDCHAR:          case OP_NOT_WORDCHAR:
4485          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
4486            {            {
4487              pcre_uchar cc;
4488    
4489            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
4490              {              {
4491              SCHECK_PARTIAL();              SCHECK_PARTIAL();
4492              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4493              }              }
4494            if (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0)            cc = RAWUCHAR(eptr);
4495              if (cc < 128 && (md->ctypes[cc] & ctype_word) != 0)
4496              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4497            eptr++;            eptr++;
4498            ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);            ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++);
# Line 4476  for (;;) Line 4502  for (;;)
4502          case OP_WORDCHAR:          case OP_WORDCHAR:
4503          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
4504            {            {
4505              pcre_uchar cc;
4506    
4507            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
4508              {              {
4509              SCHECK_PARTIAL();              SCHECK_PARTIAL();
4510              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4511              }              }
4512            if (*eptr >= 128 || (md->ctypes[*eptr] & ctype_word) == 0)            cc = RAWUCHAR(eptr);
4513              if (cc >= 128 || (md->ctypes[cc] & ctype_word) == 0)
4514              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
4515            eptr++;            eptr++;
4516            /* No need to skip more bytes - we know it's a 1-byte character */            /* No need to skip more bytes - we know it's a 1-byte character */
# Line 4927  for (;;) Line 4956  for (;;)
4956            for (fi = min;; fi++)            for (fi = min;; fi++)
4957              {              {
4958              const pcre_uint32 *cp;              const pcre_uint32 *cp;
4959              RMATCH(eptr, ecode, offset_top, md, eptrb, RM62);              RMATCH(eptr, ecode, offset_top, md, eptrb, RM67);
4960              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4961              if (fi >= max) RRETURN(MATCH_NOMATCH);              if (fi >= max) RRETURN(MATCH_NOMATCH);
4962              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
# Line 5028  for (;;) Line 5057  for (;;)
5057                {                {
5058                default: RRETURN(MATCH_NOMATCH);                default: RRETURN(MATCH_NOMATCH);
5059                case CHAR_CR:                case CHAR_CR:
5060                if (eptr < md->end_subject && *eptr == CHAR_LF) eptr++;                if (eptr < md->end_subject && RAWUCHAR(eptr) == CHAR_LF) eptr++;
5061                break;                break;
5062    
5063                case CHAR_LF:                case CHAR_LF:
# Line 5532  for (;;) Line 5561  for (;;)
5561                    eptr + 1 >= md->end_subject &&                    eptr + 1 >= md->end_subject &&
5562                    NLBLOCK->nltype == NLTYPE_FIXED &&                    NLBLOCK->nltype == NLTYPE_FIXED &&
5563                    NLBLOCK->nllen == 2 &&                    NLBLOCK->nllen == 2 &&
5564                    *eptr == NLBLOCK->nl[0])                    RAWUCHAR(eptr) == NLBLOCK->nl[0])
5565                  {                  {
5566                  md->hitend = TRUE;                  md->hitend = TRUE;
5567                  if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);                  if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);
# Line 5558  for (;;) Line 5587  for (;;)
5587                    eptr + 1 >= md->end_subject &&                    eptr + 1 >= md->end_subject &&
5588                    NLBLOCK->nltype == NLTYPE_FIXED &&                    NLBLOCK->nltype == NLTYPE_FIXED &&
5589                    NLBLOCK->nllen == 2 &&                    NLBLOCK->nllen == 2 &&
5590                    *eptr == NLBLOCK->nl[0])                    RAWUCHAR(eptr) == NLBLOCK->nl[0])
5591                  {                  {
5592                  md->hitend = TRUE;                  md->hitend = TRUE;
5593                  if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);                  if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);
# Line 5615  for (;;) Line 5644  for (;;)
5644              if (c == CHAR_CR)              if (c == CHAR_CR)
5645                {                {
5646                if (++eptr >= md->end_subject) break;                if (++eptr >= md->end_subject) break;
5647                if (*eptr == CHAR_LF) eptr++;                if (RAWUCHAR(eptr) == CHAR_LF) eptr++;
5648                }                }
5649              else              else
5650                {                {
# Line 5783  for (;;) Line 5812  for (;;)
5812            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
5813            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
5814            BACKCHAR(eptr);            BACKCHAR(eptr);
5815            if (ctype == OP_ANYNL && eptr > pp  && *eptr == CHAR_NL &&            if (ctype == OP_ANYNL && eptr > pp  && RAWUCHAR(eptr) == CHAR_NL &&
5816                eptr[-1] == CHAR_CR) eptr--;                RAWUCHAR(eptr - 1) == CHAR_CR) eptr--;
5817            }            }
5818          }          }
5819        else        else
# Line 6082  switch (frame->Xwhere) Line 6111  switch (frame->Xwhere)
6111    LBL(32) LBL(34) LBL(42) LBL(46)    LBL(32) LBL(34) LBL(42) LBL(46)
6112  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
6113    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)
6114    LBL(59) LBL(60) LBL(61) LBL(62)    LBL(59) LBL(60) LBL(61) LBL(62) LBL(67)
6115  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
6116  #endif  /* SUPPORT_UTF */  #endif  /* SUPPORT_UTF */
6117    default:    default:
6118    DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere));    DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere));
   
 printf("+++jump error in pcre match: label %d non-existent\n", frame->Xwhere);  
   
6119    return PCRE_ERROR_INTERNAL;    return PCRE_ERROR_INTERNAL;
6120    }    }
6121  #undef LBL  #undef LBL
# Line 6335  if (extra_data != NULL Line 6361  if (extra_data != NULL
6361      && (extra_data->flags & (PCRE_EXTRA_EXECUTABLE_JIT |      && (extra_data->flags & (PCRE_EXTRA_EXECUTABLE_JIT |
6362                               PCRE_EXTRA_TABLES)) == PCRE_EXTRA_EXECUTABLE_JIT                               PCRE_EXTRA_TABLES)) == PCRE_EXTRA_EXECUTABLE_JIT
6363      && extra_data->executable_jit != NULL      && extra_data->executable_jit != NULL
6364      && (options & ~(PCRE_NO_UTF8_CHECK | PCRE_NOTBOL | PCRE_NOTEOL |      && (options & ~PUBLIC_JIT_EXEC_OPTIONS) == 0)
                     PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART |  
                     PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD)) == 0)  
6365    {    {
6366    rc = PRIV(jit_exec)(re, extra_data, (const pcre_uchar *)subject, length,    rc = PRIV(jit_exec)(extra_data, (const pcre_uchar *)subject, length,
6367         start_offset, options, offsets, offsetcount);         start_offset, options, offsets, offsetcount);
6368    
6369    /* PCRE_ERROR_NULL means that the selected normal or partial matching    /* PCRE_ERROR_NULL means that the selected normal or partial matching
6370    mode is not compiled. In this case we simply fallback to interpreter. */    mode is not compiled. In this case we simply fallback to interpreter. */
6371    
6372    if (rc != PCRE_ERROR_NULL) return rc;    if (rc != PCRE_ERROR_JIT_BADOPTION) return rc;
6373    }    }
6374  #endif  #endif
6375    
# Line 6629  for(;;) Line 6653  for(;;)
6653    
6654      if (has_first_char)      if (has_first_char)
6655        {        {
6656          pcre_uchar smc;
6657    
6658        if (first_char != first_char2)        if (first_char != first_char2)
6659          while (start_match < end_subject &&          while (start_match < end_subject &&
6660              *start_match != first_char && *start_match != first_char2)            (smc = RAWUCHARTEST(start_match)) != first_char && smc != first_char2)
6661            start_match++;            start_match++;
6662        else        else
6663          while (start_match < end_subject && *start_match != first_char)          while (start_match < end_subject && RAWUCHARTEST(start_match) != first_char)
6664            start_match++;            start_match++;
6665        }        }
6666    
# Line 6666  for(;;) Line 6692  for(;;)
6692          if (start_match[-1] == CHAR_CR &&          if (start_match[-1] == CHAR_CR &&
6693               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&
6694               start_match < end_subject &&               start_match < end_subject &&
6695               *start_match == CHAR_NL)               RAWUCHARTEST(start_match) == CHAR_NL)
6696            start_match++;            start_match++;
6697          }          }
6698        }        }
# Line 6677  for(;;) Line 6703  for(;;)
6703        {        {
6704        while (start_match < end_subject)        while (start_match < end_subject)
6705          {          {
6706          register unsigned int c = *start_match;          register pcre_uint32 c = RAWUCHARTEST(start_match);
6707  #ifndef COMPILE_PCRE8  #ifndef COMPILE_PCRE8
6708          if (c > 255) c = 255;          if (c > 255) c = 255;
6709  #endif  #endif
# Line 6745  for(;;) Line 6771  for(;;)
6771            {            {
6772            while (p < end_subject)            while (p < end_subject)
6773              {              {
6774              register pcre_uint32 pp = *p++;              register pcre_uint32 pp = RAWUCHARINCTEST(p);
6775              if (pp == req_char || pp == req_char2) { p--; break; }              if (pp == req_char || pp == req_char2) { p--; break; }
6776              }              }
6777            }            }
# Line 6753  for(;;) Line 6779  for(;;)
6779            {            {
6780            while (p < end_subject)            while (p < end_subject)
6781              {              {
6782              if (*p++ == req_char) { p--; break; }              if (RAWUCHARINCTEST(p) == req_char) { p--; break; }
6783              }              }
6784            }            }
6785    

Legend:
Removed from v.1092  
changed lines
  Added in v.1187

  ViewVC Help
Powered by ViewVC 1.1.5