/[pcre]/code/branches/pcre16/pcre_dfa_exec.c
ViewVC logotype

Diff of /code/branches/pcre16/pcre_dfa_exec.c

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

revision 768 by zherczeg, Wed Nov 23 17:23:20 2011 UTC revision 769 by zherczeg, Sun Nov 27 17:40:33 2011 UTC
# Line 442  new_count = 0; Line 442  new_count = 0;
442    
443  first_op = this_start_code + 1 + LINK_SIZE +  first_op = this_start_code + 1 + LINK_SIZE +
444    ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA ||    ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA ||
445      *this_start_code == OP_CBRAPOS || *this_start_code == OP_SCBRAPOS)? 2:0);      *this_start_code == OP_CBRAPOS || *this_start_code == OP_SCBRAPOS)
446        ? IMM2_SIZE:0);
447    
448  /* The first thing in any (sub) pattern is a bracket of some sort. Push all  /* The first thing in any (sub) pattern is a bracket of some sort. Push all
449  the alternative states onto the list, and find out where the end is. This  the alternative states onto the list, and find out where the end is. This
# Line 542  else Line 543  else
543      {      {
544      int length = 1 + LINK_SIZE +      int length = 1 + LINK_SIZE +
545        ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA ||        ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA ||
546          *this_start_code == OP_CBRAPOS || *this_start_code == OP_SCBRAPOS)?          *this_start_code == OP_CBRAPOS || *this_start_code == OP_SCBRAPOS)
547          2:0);          ? IMM2_SIZE:0);
548      do      do
549        {        {
550        ADD_NEW((int)(end_code - start_code + length), 0);        ADD_NEW((int)(end_code - start_code + length), 0);
# Line 556  else Line 557  else
557    
558  workspace[0] = 0;    /* Bit indicating which vector is current */  workspace[0] = 0;    /* Bit indicating which vector is current */
559    
560  DPRINTF(("%.*sEnd state = %d\n", rlevel*2-2, SP, end_code - start_code));  DPRINTF(("%.*sEnd state = %d\n", rlevel*2-2, SP, (int)(end_code - start_code)));
561    
562  /* Loop for scanning the subject */  /* Loop for scanning the subject */
563    
# Line 816  for (;;) Line 817  for (;;)
817        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
818        case OP_CBRA:        case OP_CBRA:
819        case OP_SCBRA:        case OP_SCBRA:
820        ADD_ACTIVE((int)(code - start_code + 3 + LINK_SIZE),  0);        ADD_ACTIVE((int)(code - start_code + 1 + LINK_SIZE + IMM2_SIZE),  0);
821        code += GET(code, 1);        code += GET(code, 1);
822        while (*code == OP_ALT)        while (*code == OP_ALT)
823          {          {
# Line 1157  for (;;) Line 1158  for (;;)
1158                ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))                ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
1159            {            {
1160            if (++count >= GET2(code, 1))            if (++count >= GET2(code, 1))
1161              { ADD_NEW(state_offset + 4, 0); }              { ADD_NEW(state_offset + 1 + IMM2_SIZE + 1, 0); }
1162            else            else
1163              { ADD_NEW(state_offset, count); }              { ADD_NEW(state_offset, count); }
1164            }            }
# Line 1168  for (;;) Line 1169  for (;;)
1169        case OP_TYPEUPTO:        case OP_TYPEUPTO:
1170        case OP_TYPEMINUPTO:        case OP_TYPEMINUPTO:
1171        case OP_TYPEPOSUPTO:        case OP_TYPEPOSUPTO:
1172        ADD_ACTIVE(state_offset + 4, 0);        ADD_ACTIVE(state_offset + 2 + IMM2_SIZE, 0);
1173        count = current_state->count;  /* Number already matched */        count = current_state->count;  /* Number already matched */
1174        if (clen > 0)        if (clen > 0)
1175          {          {
# Line 1183  for (;;) Line 1184  for (;;)
1184              next_active_state--;              next_active_state--;
1185              }              }
1186            if (++count >= GET2(code, 1))            if (++count >= GET2(code, 1))
1187              { ADD_NEW(state_offset + 4, 0); }              { ADD_NEW(state_offset + 2 + IMM2_SIZE, 0); }
1188            else            else
1189              { ADD_NEW(state_offset, count); }              { ADD_NEW(state_offset, count); }
1190            }            }
# Line 1719  for (;;) Line 1720  for (;;)
1720        case OP_PROP_EXTRA + OP_TYPEMINUPTO:        case OP_PROP_EXTRA + OP_TYPEMINUPTO:
1721        case OP_PROP_EXTRA + OP_TYPEPOSUPTO:        case OP_PROP_EXTRA + OP_TYPEPOSUPTO:
1722        if (codevalue != OP_PROP_EXTRA + OP_TYPEEXACT)        if (codevalue != OP_PROP_EXTRA + OP_TYPEEXACT)
1723          { ADD_ACTIVE(state_offset + 6, 0); }          { ADD_ACTIVE(state_offset + 1 + IMM2_SIZE + 3, 0); }
1724        count = current_state->count;  /* Number already matched */        count = current_state->count;  /* Number already matched */
1725        if (clen > 0)        if (clen > 0)
1726          {          {
1727          BOOL OK;          BOOL OK;
1728          const ucd_record * prop = GET_UCD(c);          const ucd_record * prop = GET_UCD(c);
1729          switch(code[4])          switch(code[1 + IMM2_SIZE + 1])
1730            {            {
1731            case PT_ANY:            case PT_ANY:
1732            OK = TRUE;            OK = TRUE;
# Line 1737  for (;;) Line 1738  for (;;)
1738            break;            break;
1739    
1740            case PT_GC:            case PT_GC:
1741            OK = PRIV(ucp_gentype)[prop->chartype] == code[5];            OK = PRIV(ucp_gentype)[prop->chartype] == code[1 + IMM2_SIZE + 2];
1742            break;            break;
1743    
1744            case PT_PC:            case PT_PC:
1745            OK = prop->chartype == code[5];            OK = prop->chartype == code[1 + IMM2_SIZE + 2];
1746            break;            break;
1747    
1748            case PT_SC:            case PT_SC:
1749            OK = prop->script == code[5];            OK = prop->script == code[1 + IMM2_SIZE + 2];
1750            break;            break;
1751    
1752            /* These are specials for combination cases. */            /* These are specials for combination cases. */
# Line 1787  for (;;) Line 1788  for (;;)
1788              next_active_state--;              next_active_state--;
1789              }              }
1790            if (++count >= GET2(code, 1))            if (++count >= GET2(code, 1))
1791              { ADD_NEW(state_offset + 6, 0); }              { ADD_NEW(state_offset + 1 + IMM2_SIZE + 3, 0); }
1792            else            else
1793              { ADD_NEW(state_offset, count); }              { ADD_NEW(state_offset, count); }
1794            }            }
# Line 1800  for (;;) Line 1801  for (;;)
1801        case OP_EXTUNI_EXTRA + OP_TYPEMINUPTO:        case OP_EXTUNI_EXTRA + OP_TYPEMINUPTO:
1802        case OP_EXTUNI_EXTRA + OP_TYPEPOSUPTO:        case OP_EXTUNI_EXTRA + OP_TYPEPOSUPTO:
1803        if (codevalue != OP_EXTUNI_EXTRA + OP_TYPEEXACT)        if (codevalue != OP_EXTUNI_EXTRA + OP_TYPEEXACT)
1804          { ADD_ACTIVE(state_offset + 4, 0); }          { ADD_ACTIVE(state_offset + 2 + IMM2_SIZE, 0); }
1805        count = current_state->count;  /* Number already matched */        count = current_state->count;  /* Number already matched */
1806        if (clen > 0 && UCD_CATEGORY(c) != ucp_M)        if (clen > 0 && UCD_CATEGORY(c) != ucp_M)
1807          {          {
# Line 1821  for (;;) Line 1822  for (;;)
1822            nptr += ndlen;            nptr += ndlen;
1823            }            }
1824          if (++count >= GET2(code, 1))          if (++count >= GET2(code, 1))
1825            { ADD_NEW_DATA(-(state_offset + 4), 0, ncount); }            { ADD_NEW_DATA(-(state_offset + 2 + IMM2_SIZE), 0, ncount); }
1826          else          else
1827            { ADD_NEW_DATA(-state_offset, count, ncount); }            { ADD_NEW_DATA(-state_offset, count, ncount); }
1828          }          }
# Line 1834  for (;;) Line 1835  for (;;)
1835        case OP_ANYNL_EXTRA + OP_TYPEMINUPTO:        case OP_ANYNL_EXTRA + OP_TYPEMINUPTO:
1836        case OP_ANYNL_EXTRA + OP_TYPEPOSUPTO:        case OP_ANYNL_EXTRA + OP_TYPEPOSUPTO:
1837        if (codevalue != OP_ANYNL_EXTRA + OP_TYPEEXACT)        if (codevalue != OP_ANYNL_EXTRA + OP_TYPEEXACT)
1838          { ADD_ACTIVE(state_offset + 4, 0); }          { ADD_ACTIVE(state_offset + 2 + IMM2_SIZE, 0); }
1839        count = current_state->count;  /* Number already matched */        count = current_state->count;  /* Number already matched */
1840        if (clen > 0)        if (clen > 0)
1841          {          {
# Line 1861  for (;;) Line 1862  for (;;)
1862              next_active_state--;              next_active_state--;
1863              }              }
1864            if (++count >= GET2(code, 1))            if (++count >= GET2(code, 1))
1865              { ADD_NEW_DATA(-(state_offset + 4), 0, ncount); }              { ADD_NEW_DATA(-(state_offset + 2 + IMM2_SIZE), 0, ncount); }
1866            else            else
1867              { ADD_NEW_DATA(-state_offset, count, ncount); }              { ADD_NEW_DATA(-state_offset, count, ncount); }
1868            break;            break;
# Line 1878  for (;;) Line 1879  for (;;)
1879        case OP_VSPACE_EXTRA + OP_TYPEMINUPTO:        case OP_VSPACE_EXTRA + OP_TYPEMINUPTO:
1880        case OP_VSPACE_EXTRA + OP_TYPEPOSUPTO:        case OP_VSPACE_EXTRA + OP_TYPEPOSUPTO:
1881        if (codevalue != OP_VSPACE_EXTRA + OP_TYPEEXACT)        if (codevalue != OP_VSPACE_EXTRA + OP_TYPEEXACT)
1882          { ADD_ACTIVE(state_offset + 4, 0); }          { ADD_ACTIVE(state_offset + 2 + IMM2_SIZE, 0); }
1883        count = current_state->count;  /* Number already matched */        count = current_state->count;  /* Number already matched */
1884        if (clen > 0)        if (clen > 0)
1885          {          {
# Line 1907  for (;;) Line 1908  for (;;)
1908              next_active_state--;              next_active_state--;
1909              }              }
1910            if (++count >= GET2(code, 1))            if (++count >= GET2(code, 1))
1911              { ADD_NEW_DATA(-(state_offset + 4), 0, 0); }              { ADD_NEW_DATA(-(state_offset + 2 + IMM2_SIZE), 0, 0); }
1912            else            else
1913              { ADD_NEW_DATA(-state_offset, count, 0); }              { ADD_NEW_DATA(-state_offset, count, 0); }
1914            }            }
# Line 1920  for (;;) Line 1921  for (;;)
1921        case OP_HSPACE_EXTRA + OP_TYPEMINUPTO:        case OP_HSPACE_EXTRA + OP_TYPEMINUPTO:
1922        case OP_HSPACE_EXTRA + OP_TYPEPOSUPTO:        case OP_HSPACE_EXTRA + OP_TYPEPOSUPTO:
1923        if (codevalue != OP_HSPACE_EXTRA + OP_TYPEEXACT)        if (codevalue != OP_HSPACE_EXTRA + OP_TYPEEXACT)
1924          { ADD_ACTIVE(state_offset + 4, 0); }          { ADD_ACTIVE(state_offset + 2 + IMM2_SIZE, 0); }
1925        count = current_state->count;  /* Number already matched */        count = current_state->count;  /* Number already matched */
1926        if (clen > 0)        if (clen > 0)
1927          {          {
# Line 1962  for (;;) Line 1963  for (;;)
1963              next_active_state--;              next_active_state--;
1964              }              }
1965            if (++count >= GET2(code, 1))            if (++count >= GET2(code, 1))
1966              { ADD_NEW_DATA(-(state_offset + 4), 0, 0); }              { ADD_NEW_DATA(-(state_offset + 2 + IMM2_SIZE), 0, 0); }
1967            else            else
1968              { ADD_NEW_DATA(-state_offset, count, 0); }              { ADD_NEW_DATA(-state_offset, count, 0); }
1969            }            }
# Line 2352  for (;;) Line 2353  for (;;)
2353          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
2354            {            {
2355            if (++count >= GET2(code, 1))            if (++count >= GET2(code, 1))
2356              { ADD_NEW(state_offset + dlen + 3, 0); }              { ADD_NEW(state_offset + dlen + 1 + IMM2_SIZE, 0); }
2357            else            else
2358              { ADD_NEW(state_offset, count); }              { ADD_NEW(state_offset, count); }
2359            }            }
# Line 2375  for (;;) Line 2376  for (;;)
2376        case OP_NOTUPTO:        case OP_NOTUPTO:
2377        case OP_NOTMINUPTO:        case OP_NOTMINUPTO:
2378        case OP_NOTPOSUPTO:        case OP_NOTPOSUPTO:
2379        ADD_ACTIVE(state_offset + dlen + 3, 0);        ADD_ACTIVE(state_offset + dlen + 1 + IMM2_SIZE, 0);
2380        count = current_state->count;  /* Number already matched */        count = current_state->count;  /* Number already matched */
2381        if (clen > 0)        if (clen > 0)
2382          {          {
# Line 2401  for (;;) Line 2402  for (;;)
2402              next_active_state--;              next_active_state--;
2403              }              }
2404            if (++count >= GET2(code, 1))            if (++count >= GET2(code, 1))
2405              { ADD_NEW(state_offset + dlen + 3, 0); }              { ADD_NEW(state_offset + dlen + 1 + IMM2_SIZE, 0); }
2406            else            else
2407              { ADD_NEW(state_offset, count); }              { ADD_NEW(state_offset, count); }
2408            }            }
# Line 2474  for (;;) Line 2475  for (;;)
2475            case OP_CRMINRANGE:            case OP_CRMINRANGE:
2476            count = current_state->count;  /* Already matched */            count = current_state->count;  /* Already matched */
2477            if (count >= GET2(ecode, 1))            if (count >= GET2(ecode, 1))
2478              { ADD_ACTIVE(next_state_offset + 5, 0); }              { ADD_ACTIVE(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }
2479            if (isinclass)            if (isinclass)
2480              {              {
2481              int max = GET2(ecode, 3);              int max = GET2(ecode, 3);
2482              if (++count >= max && max != 0)   /* Max 0 => no limit */              if (++count >= max && max != 0)   /* Max 0 => no limit */
2483                { ADD_NEW(next_state_offset + 5, 0); }                { ADD_NEW(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }
2484              else              else
2485                { ADD_NEW(state_offset, count); }                { ADD_NEW(state_offset, count); }
2486              }              }

Legend:
Removed from v.768  
changed lines
  Added in v.769

  ViewVC Help
Powered by ViewVC 1.1.5