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

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

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

revision 768 by zherczeg, Sat Nov 26 12:48:56 2011 UTC revision 769 by zherczeg, Sun Nov 27 17:40:33 2011 UTC
# Line 88  register int branchlength = 0; Line 88  register int branchlength = 0;
88  register pcre_uchar *cc = (pcre_uchar *)code + 1 + LINK_SIZE;  register pcre_uchar *cc = (pcre_uchar *)code + 1 + LINK_SIZE;
89    
90  if (*code == OP_CBRA || *code == OP_SCBRA ||  if (*code == OP_CBRA || *code == OP_SCBRA ||
91      *code == OP_CBRAPOS || *code == OP_SCBRAPOS) cc += 2;      *code == OP_CBRAPOS || *code == OP_SCBRAPOS) cc += IMM2_SIZE;
92    
93  /* Scan along the opcodes for this branch. If we get to the end of the  /* Scan along the opcodes for this branch. If we get to the end of the
94  branch, check the length against that of the other branches. */  branch, check the length against that of the other branches. */
# Line 243  for (;;) Line 243  for (;;)
243      case OP_NOTEXACT:      case OP_NOTEXACT:
244      case OP_NOTEXACTI:      case OP_NOTEXACTI:
245      branchlength += GET2(cc,1);      branchlength += GET2(cc,1);
246      cc += 4;      cc += 2 + IMM2_SIZE;
247  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
248      if (utf8 && cc[-1] >= 0xc0) cc += PRIV(utf8_table4)[cc[-1] & 0x3f];      if (utf8 && cc[-1] >= 0xc0) cc += PRIV(utf8_table4)[cc[-1] & 0x3f];
249  #endif  #endif
# Line 251  for (;;) Line 251  for (;;)
251    
252      case OP_TYPEEXACT:      case OP_TYPEEXACT:
253      branchlength += GET2(cc,1);      branchlength += GET2(cc,1);
254      cc += (cc[3] == OP_PROP || cc[3] == OP_NOTPROP)? 6 : 4;      cc += 2 + IMM2_SIZE + ((cc[1 + IMM2_SIZE] == OP_PROP
255          || cc[1 + IMM2_SIZE] == OP_NOTPROP)? 2 : 0);
256      break;      break;
257    
258      /* Handle single-char non-literal matchers */      /* Handle single-char non-literal matchers */
# Line 314  for (;;) Line 315  for (;;)
315      case OP_TYPEUPTO:      case OP_TYPEUPTO:
316      case OP_TYPEMINUPTO:      case OP_TYPEMINUPTO:
317      case OP_TYPEPOSUPTO:      case OP_TYPEPOSUPTO:
318      if (cc[3] == OP_PROP || cc[3] == OP_NOTPROP) cc += 2;      if (cc[1 + IMM2_SIZE] == OP_PROP
319          || cc[1 + IMM2_SIZE] == OP_NOTPROP) cc += 2;
320      cc += PRIV(OP_lengths)[op];      cc += PRIV(OP_lengths)[op];
321      break;      break;
322    
# Line 347  for (;;) Line 349  for (;;)
349        case OP_CRRANGE:        case OP_CRRANGE:
350        case OP_CRMINRANGE:        case OP_CRMINRANGE:
351        branchlength += GET2(cc,1);        branchlength += GET2(cc,1);
352        cc += 5;        cc += 1 + 2 * IMM2_SIZE;
353        break;        break;
354    
355        default:        default:
# Line 386  for (;;) Line 388  for (;;)
388          }          }
389        }        }
390      else d = 0;      else d = 0;
391      cc += 3;      cc += 1 + IMM2_SIZE;
392    
393      /* Handle repeated back references */      /* Handle repeated back references */
394    
# Line 409  for (;;) Line 411  for (;;)
411        case OP_CRRANGE:        case OP_CRRANGE:
412        case OP_CRMINRANGE:        case OP_CRMINRANGE:
413        min = GET2(cc, 1);        min = GET2(cc, 1);
414        cc += 5;        cc += 1 + 2 * IMM2_SIZE;
415        break;        break;
416    
417        default:        default:
# Line 701  do Line 703  do
703    const pcre_uchar *tcode = code + 1 + LINK_SIZE;    const pcre_uchar *tcode = code + 1 + LINK_SIZE;
704    
705    if (*code == OP_CBRA || *code == OP_SCBRA ||    if (*code == OP_CBRA || *code == OP_SCBRA ||
706        *code == OP_CBRAPOS || *code == OP_SCBRAPOS) tcode += 2;        *code == OP_CBRAPOS || *code == OP_SCBRAPOS) tcode += IMM2_SIZE;
707    
708    while (try_next)    /* Loop for items in this branch */    while (try_next)    /* Loop for items in this branch */
709      {      {
# Line 904  do Line 906  do
906        case OP_UPTO:        case OP_UPTO:
907        case OP_MINUPTO:        case OP_MINUPTO:
908        case OP_POSUPTO:        case OP_POSUPTO:
909        tcode = set_table_bit(start_bits, tcode + 3, FALSE, cd, utf8);        tcode = set_table_bit(start_bits, tcode + 1 + IMM2_SIZE, FALSE, cd, utf8);
910        break;        break;
911    
912        case OP_UPTOI:        case OP_UPTOI:
913        case OP_MINUPTOI:        case OP_MINUPTOI:
914        case OP_POSUPTOI:        case OP_POSUPTOI:
915        tcode = set_table_bit(start_bits, tcode + 3, TRUE, cd, utf8);        tcode = set_table_bit(start_bits, tcode + 1 + IMM2_SIZE, TRUE, cd, utf8);
916        break;        break;
917    
918        /* At least one single char sets the bit and stops */        /* At least one single char sets the bit and stops */
919    
920        case OP_EXACT:        case OP_EXACT:
921        tcode += 2;        tcode += IMM2_SIZE;
922        /* Fall through */        /* Fall through */
923        case OP_CHAR:        case OP_CHAR:
924        case OP_PLUS:        case OP_PLUS:
# Line 927  do Line 929  do
929        break;        break;
930    
931        case OP_EXACTI:        case OP_EXACTI:
932        tcode += 2;        tcode += IMM2_SIZE;
933        /* Fall through */        /* Fall through */
934        case OP_CHARI:        case OP_CHARI:
935        case OP_PLUSI:        case OP_PLUSI:
# Line 1026  do Line 1028  do
1028        break;        break;
1029    
1030        case OP_TYPEEXACT:        case OP_TYPEEXACT:
1031        tcode += 3;        tcode += 1 + IMM2_SIZE;
1032        break;        break;
1033    
1034        /* Zero or more repeats of character types set the bits and then        /* Zero or more repeats of character types set the bits and then
# Line 1035  do Line 1037  do
1037        case OP_TYPEUPTO:        case OP_TYPEUPTO:
1038        case OP_TYPEMINUPTO:        case OP_TYPEMINUPTO:
1039        case OP_TYPEPOSUPTO:        case OP_TYPEPOSUPTO:
1040        tcode += 2;               /* Fall through */        tcode += IMM2_SIZE;  /* Fall through */
1041    
1042        case OP_TYPESTAR:        case OP_TYPESTAR:
1043        case OP_TYPEMINSTAR:        case OP_TYPEMINSTAR:
# Line 1178  do Line 1180  do
1180    
1181            case OP_CRRANGE:            case OP_CRRANGE:
1182            case OP_CRMINRANGE:            case OP_CRMINRANGE:
1183            if (((tcode[1] << 8) + tcode[2]) == 0) tcode += 5;            if (GET2(tcode, 1) == 0) tcode += 1 + 2 * IMM2_SIZE;
1184              else try_next = FALSE;              else try_next = FALSE;
1185            break;            break;
1186    

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

  ViewVC Help
Powered by ViewVC 1.1.5