/[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 1102 by chpe, Tue Oct 16 15:56:34 2012 UTC revision 1236 by ph10, Sun Dec 30 17:09:59 2012 UTC
# Line 149  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;  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 197  if (caseless) Line 199  if (caseless)
199        GETCHARINC(c, eptr);        GETCHARINC(c, eptr);
200        GETCHARINC(d, p);        GETCHARINC(d, p);
201        ur = GET_UCD(d);        ur = GET_UCD(d);
202        if (c != d && c != d + ur->other_case)        if (c != d && c != d + ur->other_case)
203          {          {
204          const pcre_uint32 *pp = PRIV(ucd_caseless_sets) + ur->caseset;          const pcre_uint32 *pp = PRIV(ucd_caseless_sets) + ur->caseset;
205          for (;;)          for (;;)
206            {            {
207            if (c < *pp) return -1;            if (c < *pp) return -1;
# Line 292  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 401  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 414  typedef struct heapframe { Line 416  typedef struct heapframe {
416    int Xlength;    int Xlength;
417    int Xmax;    int Xmax;
418    int Xmin;    int Xmin;
419    int Xnumber;    unsigned int Xnumber;
420    int Xoffset;    int Xoffset;
421    int Xop;    unsigned int Xop;
422    int Xsave_capture_last;    int Xsave_capture_last;
423    int Xsave_offset1, Xsave_offset2, Xsave_offset3;    int Xsave_offset1, Xsave_offset2, Xsave_offset3;
424    int Xstacksave[REC_STACK_SAVE_MAX];    int Xstacksave[REC_STACK_SAVE_MAX];
# Line 619  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 630  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;  unsigned int 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 1311  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 1383  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 1743  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 2530  for (;;) Line 2532  for (;;)
2532        }        }
2533      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
2534        {        {
2535        const pcre_uint32 *cp;        const pcre_uint32 *cp;
2536        const ucd_record *prop = GET_UCD(c);        const ucd_record *prop = GET_UCD(c);
2537    
2538        switch(ecode[1])        switch(ecode[1])
# Line 2592  for (;;) Line 2594  for (;;)
2594          break;          break;
2595    
2596          case PT_CLIST:          case PT_CLIST:
2597          cp = PRIV(ucd_caseless_sets) + prop->caseset;          cp = PRIV(ucd_caseless_sets) + ecode[2];
2598          for (;;)          for (;;)
2599            {            {
2600            if (c < *cp)            if (c < *cp)
# Line 4201  for (;;) Line 4203  for (;;)
4203                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
4204              }              }
4205            break;            break;
4206    
4207            case PT_CLIST:            case PT_CLIST:
4208            for (i = 1; i <= min; i++)            for (i = 1; i <= min; i++)
4209              {              {
4210              const pcre_uint32 *cp;              const pcre_uint32 *cp;
4211              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
4212                {                {
# Line 4212  for (;;) Line 4214  for (;;)
4214                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
4215                }                }
4216              GETCHARINCTEST(c, eptr);              GETCHARINCTEST(c, eptr);
4217              cp = PRIV(ucd_caseless_sets) + UCD_CASESET(c);              cp = PRIV(ucd_caseless_sets) + prop_value;
4218              for (;;)              for (;;)
4219                {                {
4220                if (c < *cp)                if (c < *cp)
4221                  { if (prop_fail_result) break; else { RRETURN(MATCH_NOMATCH); } }                  { if (prop_fail_result) break; else { RRETURN(MATCH_NOMATCH); } }
4222                if (c == *cp++)                if (c == *cp++)
4223                  { if (prop_fail_result) { RRETURN(MATCH_NOMATCH); } else break; }                  { if (prop_fail_result) { RRETURN(MATCH_NOMATCH); } else break; }
4224                }                }
4225              }              }
4226            break;            break;
4227    
4228            /* This should not occur */            /* This should not occur */
4229    
4230            default:            default:
# Line 4952  for (;;) Line 4954  for (;;)
4954    
4955            case PT_CLIST:            case PT_CLIST:
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 4963  for (;;) Line 4965  for (;;)
4965                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
4966                }                }
4967              GETCHARINCTEST(c, eptr);              GETCHARINCTEST(c, eptr);
4968              cp = PRIV(ucd_caseless_sets) + UCD_CASESET(c);              cp = PRIV(ucd_caseless_sets) + prop_value;
4969              for (;;)              for (;;)
4970                {                {
4971                if (c < *cp)                if (c < *cp)
# Line 5443  for (;;) Line 5445  for (;;)
5445              eptr+= len;              eptr+= len;
5446              }              }
5447            break;            break;
5448    
5449            case PT_CLIST:            case PT_CLIST:
5450            for (i = min; i < max; i++)            for (i = min; i < max; i++)
5451              {              {
# Line 5455  for (;;) Line 5457  for (;;)
5457                break;                break;
5458                }                }
5459              GETCHARLENTEST(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
5460              cp = PRIV(ucd_caseless_sets) + UCD_CASESET(c);              cp = PRIV(ucd_caseless_sets) + prop_value;
5461              for (;;)              for (;;)
5462                {                {
5463                if (c < *cp)                if (c < *cp)
5464                  { if (prop_fail_result) break; else goto GOT_MAX; }                  { if (prop_fail_result) break; else goto GOT_MAX; }
5465                if (c == *cp++)                if (c == *cp++)
5466                  { if (prop_fail_result) goto GOT_MAX; else break; }                  { if (prop_fail_result) goto GOT_MAX; else break; }
5467                }                }
5468              eptr += len;              eptr += len;
5469              }              }
5470            GOT_MAX:            GOT_MAX:
5471            break;            break;
5472    
5473            default:            default:
# Line 6109  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 6296  if ((options & ~PUBLIC_EXEC_OPTIONS) != Line 6295  if ((options & ~PUBLIC_EXEC_OPTIONS) !=
6295  if (re == NULL || subject == NULL || (offsets == NULL && offsetcount > 0))  if (re == NULL || subject == NULL || (offsets == NULL && offsetcount > 0))
6296    return PCRE_ERROR_NULL;    return PCRE_ERROR_NULL;
6297  if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;  if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;
6298    if (length < 0) return PCRE_ERROR_BADLENGTH;
6299  if (start_offset < 0 || start_offset > length) return PCRE_ERROR_BADOFFSET;  if (start_offset < 0 || start_offset > length) return PCRE_ERROR_BADOFFSET;
6300    
6301  /* Check that the first field in the block is the magic number. If it is not,  /* Check that the first field in the block is the magic number. If it is not,
# Line 6362  if (extra_data != NULL Line 6362  if (extra_data != NULL
6362      && (extra_data->flags & (PCRE_EXTRA_EXECUTABLE_JIT |      && (extra_data->flags & (PCRE_EXTRA_EXECUTABLE_JIT |
6363                               PCRE_EXTRA_TABLES)) == PCRE_EXTRA_EXECUTABLE_JIT                               PCRE_EXTRA_TABLES)) == PCRE_EXTRA_EXECUTABLE_JIT
6364      && extra_data->executable_jit != NULL      && extra_data->executable_jit != NULL
6365      && (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)  
6366    {    {
6367    rc = PRIV(jit_exec)(re, extra_data, (const pcre_uchar *)subject, length,    rc = PRIV(jit_exec)(extra_data, (const pcre_uchar *)subject, length,
6368         start_offset, options, offsets, offsetcount);         start_offset, options, offsets, offsetcount);
6369    
6370    /* PCRE_ERROR_NULL means that the selected normal or partial matching    /* PCRE_ERROR_NULL means that the selected normal or partial matching
6371    mode is not compiled. In this case we simply fallback to interpreter. */    mode is not compiled. In this case we simply fallback to interpreter. */
6372    
6373    if (rc != PCRE_ERROR_NULL) return rc;    if (rc != PCRE_ERROR_JIT_BADOPTION) return rc;
6374    }    }
6375  #endif  #endif
6376    

Legend:
Removed from v.1102  
changed lines
  Added in v.1236

  ViewVC Help
Powered by ViewVC 1.1.5