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

Diff of /code/trunk/pcre_study.c

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

revision 469 by ph10, Mon Oct 19 14:38:48 2009 UTC revision 512 by ph10, Tue Mar 30 11:11:52 2010 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2009 University of Cambridge             Copyright (c) 1997-2010 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 96  for (;;) Line 96  for (;;)
96    
97    switch (op)    switch (op)
98      {      {
99        case OP_COND:
100        case OP_SCOND:
101    
102        /* If there is only one branch in a condition, the implied branch has zero
103        length, so we don't add anything. This covers the DEFINE "condition"
104        automatically. */
105    
106        cs = cc + GET(cc, 1);
107        if (*cs != OP_ALT)
108          {
109          cc = cs + 1 + LINK_SIZE;
110          break;
111          }
112    
113        /* Otherwise we can fall through and treat it the same as any other
114        subpattern. */
115    
116      case OP_CBRA:      case OP_CBRA:
117      case OP_SCBRA:      case OP_SCBRA:
118      case OP_BRA:      case OP_BRA:
119      case OP_SBRA:      case OP_SBRA:
120      case OP_ONCE:      case OP_ONCE:
     case OP_COND:  
     case OP_SCOND:  
121      d = find_minlength(cc, startcode, options);      d = find_minlength(cc, startcode, options);
122      if (d < 0) return d;      if (d < 0) return d;
123      branchlength += d;      branchlength += d;
# Line 398  for (;;) Line 413  for (;;)
413  #endif  #endif
414      break;      break;
415    
416        /* Skip these, but we need to add in the name length. */
417    
418        case OP_MARK:
419        case OP_PRUNE_ARG:
420        case OP_SKIP_ARG:
421        case OP_THEN_ARG:
422        cc += _pcre_OP_lengths[op] + cc[1];
423        break;
424    
425      /* For the record, these are the opcodes that are matched by "default":      /* For the record, these are the opcodes that are matched by "default":
426      OP_ACCEPT, OP_CLOSE, OP_COMMIT, OP_FAIL, OP_PRUNE, OP_SET_SOM, OP_SKIP,      OP_ACCEPT, OP_CLOSE, OP_COMMIT, OP_FAIL, OP_PRUNE, OP_SET_SOM, OP_SKIP,
427      OP_THEN. */      OP_THEN. */
# Line 429  Returns: nothing Line 453  Returns: nothing
453  */  */
454    
455  static void  static void
456  set_bit(uschar *start_bits, unsigned int c, BOOL caseless, compile_data *cd)  set_table_bit(uschar *start_bits, unsigned int c, BOOL caseless,
457      compile_data *cd)
458  {  {
459  start_bits[c/8] |= (1 << (c&7));  start_bits[c/8] |= (1 << (c&7));
460  if (caseless && (cd->ctypes[c] & ctype_letter) != 0)  if (caseless && (cd->ctypes[c] & ctype_letter) != 0)
# Line 591  do Line 616  do
616        case OP_QUERY:        case OP_QUERY:
617        case OP_MINQUERY:        case OP_MINQUERY:
618        case OP_POSQUERY:        case OP_POSQUERY:
619        set_bit(start_bits, tcode[1], caseless, cd);        set_table_bit(start_bits, tcode[1], caseless, cd);
620        tcode += 2;        tcode += 2;
621  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
622        if (utf8 && tcode[-1] >= 0xc0)        if (utf8 && tcode[-1] >= 0xc0)
# Line 604  do Line 629  do
629        case OP_UPTO:        case OP_UPTO:
630        case OP_MINUPTO:        case OP_MINUPTO:
631        case OP_POSUPTO:        case OP_POSUPTO:
632        set_bit(start_bits, tcode[3], caseless, cd);        set_table_bit(start_bits, tcode[3], caseless, cd);
633        tcode += 4;        tcode += 4;
634  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
635        if (utf8 && tcode[-1] >= 0xc0)        if (utf8 && tcode[-1] >= 0xc0)
# Line 622  do Line 647  do
647        case OP_PLUS:        case OP_PLUS:
648        case OP_MINPLUS:        case OP_MINPLUS:
649        case OP_POSPLUS:        case OP_POSPLUS:
650        set_bit(start_bits, tcode[1], caseless, cd);        set_table_bit(start_bits, tcode[1], caseless, cd);
651        try_next = FALSE;        try_next = FALSE;
652        break;        break;
653    

Legend:
Removed from v.469  
changed lines
  Added in v.512

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12