/[pcre]/code/trunk/pcre_dfa_exec.c
ViewVC logotype

Diff of /code/trunk/pcre_dfa_exec.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1365 by ph10, Sun Oct 6 18:33:56 2013 UTC revision 1425 by ph10, Tue Dec 31 17:44:40 2013 UTC
# Line 151  static const pcre_uint8 coptable[] = { Line 151  static const pcre_uint8 coptable[] = {
151    /* Character class & ref repeats                                         */    /* Character class & ref repeats                                         */
152    0, 0, 0, 0, 0, 0,              /* *, *?, +, +?, ?, ??                    */    0, 0, 0, 0, 0, 0,              /* *, *?, +, +?, ?, ??                    */
153    0, 0,                          /* CRRANGE, CRMINRANGE                    */    0, 0,                          /* CRRANGE, CRMINRANGE                    */
154      0, 0, 0, 0,                    /* Possessive *+, ++, ?+, CRPOSRANGE      */
155    0,                             /* CLASS                                  */    0,                             /* CLASS                                  */
156    0,                             /* NCLASS                                 */    0,                             /* NCLASS                                 */
157    0,                             /* XCLASS - variable length               */    0,                             /* XCLASS - variable length               */
# Line 222  static const pcre_uint8 poptable[] = { Line 223  static const pcre_uint8 poptable[] = {
223    /* Character class & ref repeats                                         */    /* Character class & ref repeats                                         */
224    1, 1, 1, 1, 1, 1,              /* *, *?, +, +?, ?, ??                    */    1, 1, 1, 1, 1, 1,              /* *, *?, +, +?, ?, ??                    */
225    1, 1,                          /* CRRANGE, CRMINRANGE                    */    1, 1,                          /* CRRANGE, CRMINRANGE                    */
226      1, 1, 1, 1,                    /* Possessive *+, ++, ?+, CRPOSRANGE      */
227    1,                             /* CLASS                                  */    1,                             /* CLASS                                  */
228    1,                             /* NCLASS                                 */    1,                             /* NCLASS                                 */
229    1,                             /* XCLASS - variable length               */    1,                             /* XCLASS - variable length               */
# Line 1101  for (;;) Line 1103  for (;;)
1103            /* Perl space used to exclude VT, but from Perl 5.18 it is included,            /* Perl space used to exclude VT, but from Perl 5.18 it is included,
1104            which means that Perl space and POSIX space are now identical. PCRE            which means that Perl space and POSIX space are now identical. PCRE
1105            was changed at release 8.34. */            was changed at release 8.34. */
1106    
1107            case PT_SPACE:    /* Perl space */            case PT_SPACE:    /* Perl space */
1108            case PT_PXSPACE:  /* POSIX space */            case PT_PXSPACE:  /* POSIX space */
1109            OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||            switch(c)
1110                 c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||              {
1111                 c == CHAR_FF || c == CHAR_CR;              HSPACE_CASES:
1112                VSPACE_CASES:
1113                OK = TRUE;
1114                break;
1115    
1116                default:
1117                OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z;
1118                break;
1119                }
1120            break;            break;
1121    
1122            case PT_WORD:            case PT_WORD:
# Line 1351  for (;;) Line 1361  for (;;)
1361            /* Perl space used to exclude VT, but from Perl 5.18 it is included,            /* Perl space used to exclude VT, but from Perl 5.18 it is included,
1362            which means that Perl space and POSIX space are now identical. PCRE            which means that Perl space and POSIX space are now identical. PCRE
1363            was changed at release 8.34. */            was changed at release 8.34. */
1364    
1365            case PT_SPACE:    /* Perl space */            case PT_SPACE:    /* Perl space */
1366            case PT_PXSPACE:  /* POSIX space */            case PT_PXSPACE:  /* POSIX space */
1367            OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||            switch(c)
1368                 c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||              {
1369                 c == CHAR_FF || c == CHAR_CR;              HSPACE_CASES:
1370                VSPACE_CASES:
1371                OK = TRUE;
1372                break;
1373    
1374                default:
1375                OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z;
1376                break;
1377                }
1378            break;            break;
1379    
1380            case PT_WORD:            case PT_WORD:
# Line 1455  for (;;) Line 1473  for (;;)
1473            goto ANYNL01;            goto ANYNL01;
1474    
1475            case CHAR_CR:            case CHAR_CR:
1476            if (ptr + 1 < end_subject && RAWUCHARTEST(ptr + 1) == CHAR_LF) ncount = 1;            if (ptr + 1 < end_subject && ptr[1] == CHAR_LF) ncount = 1;
1477            /* Fall through */            /* Fall through */
1478    
1479            ANYNL01:            ANYNL01:
# Line 1595  for (;;) Line 1613  for (;;)
1613            /* Perl space used to exclude VT, but from Perl 5.18 it is included,            /* Perl space used to exclude VT, but from Perl 5.18 it is included,
1614            which means that Perl space and POSIX space are now identical. PCRE            which means that Perl space and POSIX space are now identical. PCRE
1615            was changed at release 8.34. */            was changed at release 8.34. */
1616    
1617            case PT_SPACE:    /* Perl space */            case PT_SPACE:    /* Perl space */
1618            case PT_PXSPACE:  /* POSIX space */            case PT_PXSPACE:  /* POSIX space */
1619            OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||            switch(c)
1620                 c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||              {
1621                 c == CHAR_FF || c == CHAR_CR;              HSPACE_CASES:
1622                VSPACE_CASES:
1623                OK = TRUE;
1624                break;
1625    
1626                default:
1627                OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z;
1628                break;
1629                }
1630            break;            break;
1631    
1632            case PT_WORD:            case PT_WORD:
# Line 1716  for (;;) Line 1742  for (;;)
1742            goto ANYNL02;            goto ANYNL02;
1743    
1744            case CHAR_CR:            case CHAR_CR:
1745            if (ptr + 1 < end_subject && RAWUCHARTEST(ptr + 1) == CHAR_LF) ncount = 1;            if (ptr + 1 < end_subject && ptr[1] == CHAR_LF) ncount = 1;
1746            /* Fall through */            /* Fall through */
1747    
1748            ANYNL02:            ANYNL02:
# Line 1864  for (;;) Line 1890  for (;;)
1890            /* Perl space used to exclude VT, but from Perl 5.18 it is included,            /* Perl space used to exclude VT, but from Perl 5.18 it is included,
1891            which means that Perl space and POSIX space are now identical. PCRE            which means that Perl space and POSIX space are now identical. PCRE
1892            was changed at release 8.34. */            was changed at release 8.34. */
1893    
1894            case PT_SPACE:    /* Perl space */            case PT_SPACE:    /* Perl space */
1895            case PT_PXSPACE:  /* POSIX space */            case PT_PXSPACE:  /* POSIX space */
1896            OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||            switch(c)
1897                 c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||              {
1898                 c == CHAR_FF || c == CHAR_CR;              HSPACE_CASES:
1899                VSPACE_CASES:
1900                OK = TRUE;
1901                break;
1902    
1903                default:
1904                OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z;
1905                break;
1906                }
1907            break;            break;
1908    
1909            case PT_WORD:            case PT_WORD:
# Line 1978  for (;;) Line 2012  for (;;)
2012            goto ANYNL03;            goto ANYNL03;
2013    
2014            case CHAR_CR:            case CHAR_CR:
2015            if (ptr + 1 < end_subject && RAWUCHARTEST(ptr + 1) == CHAR_LF) ncount = 1;            if (ptr + 1 < end_subject && ptr[1] == CHAR_LF) ncount = 1;
2016            /* Fall through */            /* Fall through */
2017    
2018            ANYNL03:            ANYNL03:
# Line 2176  for (;;) Line 2210  for (;;)
2210            if ((md->moptions & PCRE_PARTIAL_HARD) != 0)            if ((md->moptions & PCRE_PARTIAL_HARD) != 0)
2211              reset_could_continue = TRUE;              reset_could_continue = TRUE;
2212            }            }
2213          else if (RAWUCHARTEST(ptr + 1) == CHAR_LF)          else if (ptr[1] == CHAR_LF)
2214            {            {
2215            ADD_NEW_DATA(-(state_offset + 1), 0, 1);            ADD_NEW_DATA(-(state_offset + 1), 0, 1);
2216            }            }
# Line 2537  for (;;) Line 2571  for (;;)
2571            {            {
2572            case OP_CRSTAR:            case OP_CRSTAR:
2573            case OP_CRMINSTAR:            case OP_CRMINSTAR:
2574              case OP_CRPOSSTAR:
2575            ADD_ACTIVE(next_state_offset + 1, 0);            ADD_ACTIVE(next_state_offset + 1, 0);
2576            if (isinclass) { ADD_NEW(state_offset, 0); }            if (isinclass)
2577                {
2578                if (*ecode == OP_CRPOSSTAR)
2579                  {
2580                  active_count--;           /* Remove non-match possibility */
2581                  next_active_state--;
2582                  }
2583                ADD_NEW(state_offset, 0);
2584                }
2585            break;            break;
2586    
2587            case OP_CRPLUS:            case OP_CRPLUS:
2588            case OP_CRMINPLUS:            case OP_CRMINPLUS:
2589              case OP_CRPOSPLUS:
2590            count = current_state->count;  /* Already matched */            count = current_state->count;  /* Already matched */
2591            if (count > 0) { ADD_ACTIVE(next_state_offset + 1, 0); }            if (count > 0) { ADD_ACTIVE(next_state_offset + 1, 0); }
2592            if (isinclass) { count++; ADD_NEW(state_offset, count); }            if (isinclass)
2593                {
2594                if (count > 0 && *ecode == OP_CRPOSPLUS)
2595                  {
2596                  active_count--;           /* Remove non-match possibility */
2597                  next_active_state--;
2598                  }
2599                count++;
2600                ADD_NEW(state_offset, count);
2601                }
2602            break;            break;
2603    
2604            case OP_CRQUERY:            case OP_CRQUERY:
2605            case OP_CRMINQUERY:            case OP_CRMINQUERY:
2606              case OP_CRPOSQUERY:
2607            ADD_ACTIVE(next_state_offset + 1, 0);            ADD_ACTIVE(next_state_offset + 1, 0);
2608            if (isinclass) { ADD_NEW(next_state_offset + 1, 0); }            if (isinclass)
2609                {
2610                if (*ecode == OP_CRPOSQUERY)
2611                  {
2612                  active_count--;           /* Remove non-match possibility */
2613                  next_active_state--;
2614                  }
2615                ADD_NEW(next_state_offset + 1, 0);
2616                }
2617            break;            break;
2618    
2619            case OP_CRRANGE:            case OP_CRRANGE:
2620            case OP_CRMINRANGE:            case OP_CRMINRANGE:
2621              case OP_CRPOSRANGE:
2622            count = current_state->count;  /* Already matched */            count = current_state->count;  /* Already matched */
2623            if (count >= (int)GET2(ecode, 1))            if (count >= (int)GET2(ecode, 1))
2624              { ADD_ACTIVE(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }              { ADD_ACTIVE(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }
2625            if (isinclass)            if (isinclass)
2626              {              {
2627              int max = (int)GET2(ecode, 1 + IMM2_SIZE);              int max = (int)GET2(ecode, 1 + IMM2_SIZE);
2628                if (*ecode == OP_CRPOSRANGE)
2629                  {
2630                  active_count--;           /* Remove non-match possibility */
2631                  next_active_state--;
2632                  }
2633              if (++count >= max && max != 0)   /* Max 0 => no limit */              if (++count >= max && max != 0)   /* Max 0 => no limit */
2634                { ADD_NEW(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }                { ADD_NEW(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }
2635              else              else
# Line 2664  for (;;) Line 2732  for (;;)
2732          /* Back reference conditions and duplicate named recursion conditions          /* Back reference conditions and duplicate named recursion conditions
2733          are not supported */          are not supported */
2734    
2735          if (condcode == OP_CREF || condcode == OP_DNCREF ||          if (condcode == OP_CREF || condcode == OP_DNCREF ||
2736              condcode == OP_DNRREF)              condcode == OP_DNRREF)
2737            return PCRE_ERROR_DFA_UCOND;            return PCRE_ERROR_DFA_UCOND;
2738    
# Line 3406  for (;;) Line 3474  for (;;)
3474            {            {
3475            pcre_uchar csc;            pcre_uchar csc;
3476            while (current_subject < end_subject &&            while (current_subject < end_subject &&
3477                   (csc = RAWUCHARTEST(current_subject)) != first_char && csc != first_char2)                   (csc = *current_subject) != first_char && csc != first_char2)
3478              current_subject++;              current_subject++;
3479            }            }
3480          else          else
3481            while (current_subject < end_subject &&            while (current_subject < end_subject &&
3482                   RAWUCHARTEST(current_subject) != first_char)                   *current_subject != first_char)
3483              current_subject++;              current_subject++;
3484          }          }
3485    
# Line 3441  for (;;) Line 3509  for (;;)
3509            ANYCRLF, and we are now at a LF, advance the match position by one            ANYCRLF, and we are now at a LF, advance the match position by one
3510            more character. */            more character. */
3511    
3512            if (RAWUCHARTEST(current_subject - 1) == CHAR_CR &&            if (current_subject[-1] == CHAR_CR &&
3513                 (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&                 (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&
3514                 current_subject < end_subject &&                 current_subject < end_subject && *current_subject == CHAR_NL)
                RAWUCHARTEST(current_subject) == CHAR_NL)  
3515              current_subject++;              current_subject++;
3516            }            }
3517          }          }
# Line 3455  for (;;) Line 3522  for (;;)
3522          {          {
3523          while (current_subject < end_subject)          while (current_subject < end_subject)
3524            {            {
3525            register pcre_uint32 c = RAWUCHARTEST(current_subject);            register pcre_uint32 c = *current_subject;
3526  #ifndef COMPILE_PCRE8  #ifndef COMPILE_PCRE8
3527            if (c > 255) c = 255;            if (c > 255) c = 255;
3528  #endif  #endif
# Line 3521  for (;;) Line 3588  for (;;)
3588              {              {
3589              while (p < end_subject)              while (p < end_subject)
3590                {                {
3591                register pcre_uint32 pp = RAWUCHARINCTEST(p);                register pcre_uint32 pp = *p++;
3592                if (pp == req_char || pp == req_char2) { p--; break; }                if (pp == req_char || pp == req_char2) { p--; break; }
3593                }                }
3594              }              }
# Line 3529  for (;;) Line 3596  for (;;)
3596              {              {
3597              while (p < end_subject)              while (p < end_subject)
3598                {                {
3599                if (RAWUCHARINCTEST(p) == req_char) { p--; break; }                if (*p++ == req_char) { p--; break; }
3600                }                }
3601              }              }
3602    
# Line 3597  for (;;) Line 3664  for (;;)
3664    not contain any explicit matches for \r or \n, and the newline option is CRLF    not contain any explicit matches for \r or \n, and the newline option is CRLF
3665    or ANY or ANYCRLF, advance the match position by one more character. */    or ANY or ANYCRLF, advance the match position by one more character. */
3666    
3667    if (RAWUCHARTEST(current_subject - 1) == CHAR_CR &&    if (current_subject[-1] == CHAR_CR &&
3668        current_subject < end_subject &&        current_subject < end_subject &&
3669        RAWUCHARTEST(current_subject) == CHAR_NL &&        *current_subject == CHAR_NL &&
3670        (re->flags & PCRE_HASCRORLF) == 0 &&        (re->flags & PCRE_HASCRORLF) == 0 &&
3671          (md->nltype == NLTYPE_ANY ||          (md->nltype == NLTYPE_ANY ||
3672           md->nltype == NLTYPE_ANYCRLF ||           md->nltype == NLTYPE_ANYCRLF ||

Legend:
Removed from v.1365  
changed lines
  Added in v.1425

  ViewVC Help
Powered by ViewVC 1.1.5