/[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 1055 by chpe, Tue Oct 16 15:53:30 2012 UTC revision 1155 by ph10, Sun Oct 21 17:13:28 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 191  if (caseless) Line 193  if (caseless)
193      PCRE_PUCHAR endptr = p + length;      PCRE_PUCHAR endptr = p + length;
194      while (p < endptr)      while (p < endptr)
195        {        {
196        unsigned int c, d;        pcre_uint32 c, d;
197        const ucd_record *ur;        const ucd_record *ur;
198        if (eptr >= md->end_subject) return -2;   /* Partial match */        if (eptr >= md->end_subject) return -2;   /* Partial match */
199        GETCHARINC(c, eptr);        GETCHARINC(c, eptr);
# 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 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 499  so they can be ordinary variables in all Line 504  so they can be ordinary variables in all
504    
505  register int  rrc;         /* Returns from recursive calls */  register int  rrc;         /* Returns from recursive calls */
506  register int  i;           /* Used for loops not involving calls to RMATCH() */  register int  i;           /* Used for loops not involving calls to RMATCH() */
507  register unsigned int c;   /* Character values not kept over RMATCH() calls */  register pcre_uint32 c;    /* Character values not kept over RMATCH() calls */
508  register BOOL utf;         /* Local copy of UTF flag for speed */  register BOOL utf;         /* Local copy of UTF flag for speed */
509    
510  BOOL minimize, possessive; /* Quantifier options */  BOOL minimize, possessive; /* Quantifier options */
# 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  int op;  pcre_uchar op;
638  int save_capture_last;  int save_capture_last;
639  int save_offset1, save_offset2, save_offset3;  int save_offset1, save_offset2, save_offset3;
640  int stacksave[REC_STACK_SAVE_MAX];  int stacksave[REC_STACK_SAVE_MAX];
# 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 3197  for (;;) Line 3202  for (;;)
3202    
3203        else        else
3204          {          {
3205          unsigned int dc;          pcre_uint32 dc;
3206          GETCHARINC(dc, eptr);          GETCHARINC(dc, eptr);
3207          ecode += length;          ecode += length;
3208    
# 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 3558  for (;;) Line 3572  for (;;)
3572  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3573      if (utf)      if (utf)
3574        {        {
3575        register unsigned int ch, och;        register pcre_uint32 ch, och;
3576    
3577        ecode++;        ecode++;
3578        GETCHARINC(ch, ecode);        GETCHARINC(ch, ecode);
# Line 3585  for (;;) Line 3599  for (;;)
3599      else      else
3600  #endif  #endif
3601        {        {
3602        register unsigned int ch = ecode[1];        register pcre_uint32 ch = ecode[1];
3603        c = *eptr++;        c = *eptr++;
3604        if (ch == c || (op == OP_NOTI && TABLE_GET(ch, md->fcc, ch) == c))        if (ch == c || (op == OP_NOTI && TABLE_GET(ch, md->fcc, ch) == c))
3605          RRETURN(MATCH_NOMATCH);          RRETURN(MATCH_NOMATCH);
# 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 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 6629  for(;;) Line 6658  for(;;)
6658    
6659      if (has_first_char)      if (has_first_char)
6660        {        {
6661          pcre_uchar smc;
6662    
6663        if (first_char != first_char2)        if (first_char != first_char2)
6664          while (start_match < end_subject &&          while (start_match < end_subject &&
6665              *start_match != first_char && *start_match != first_char2)            (smc = RAWUCHARTEST(start_match)) != first_char && smc != first_char2)
6666            start_match++;            start_match++;
6667        else        else
6668          while (start_match < end_subject && *start_match != first_char)          while (start_match < end_subject && RAWUCHARTEST(start_match) != first_char)
6669            start_match++;            start_match++;
6670        }        }
6671    
# Line 6666  for(;;) Line 6697  for(;;)
6697          if (start_match[-1] == CHAR_CR &&          if (start_match[-1] == CHAR_CR &&
6698               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&
6699               start_match < end_subject &&               start_match < end_subject &&
6700               *start_match == CHAR_NL)               RAWUCHARTEST(start_match) == CHAR_NL)
6701            start_match++;            start_match++;
6702          }          }
6703        }        }
# Line 6677  for(;;) Line 6708  for(;;)
6708        {        {
6709        while (start_match < end_subject)        while (start_match < end_subject)
6710          {          {
6711          register unsigned int c = *start_match;          register pcre_uint32 c = RAWUCHARTEST(start_match);
6712  #ifndef COMPILE_PCRE8  #ifndef COMPILE_PCRE8
6713          if (c > 255) c = 255;          if (c > 255) c = 255;
6714  #endif  #endif
# Line 6745  for(;;) Line 6776  for(;;)
6776            {            {
6777            while (p < end_subject)            while (p < end_subject)
6778              {              {
6779              register int pp = *p++;              register pcre_uint32 pp = RAWUCHARINCTEST(p);
6780              if (pp == req_char || pp == req_char2) { p--; break; }              if (pp == req_char || pp == req_char2) { p--; break; }
6781              }              }
6782            }            }
# Line 6753  for(;;) Line 6784  for(;;)
6784            {            {
6785            while (p < end_subject)            while (p < end_subject)
6786              {              {
6787              if (*p++ == req_char) { p--; break; }              if (RAWUCHARINCTEST(p) == req_char) { p--; break; }
6788              }              }
6789            }            }
6790    

Legend:
Removed from v.1055  
changed lines
  Added in v.1155

  ViewVC Help
Powered by ViewVC 1.1.5