/[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 93 by nigel, Sat Feb 24 21:41:42 2007 UTC revision 345 by ph10, Mon Apr 28 15:10:02 2008 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-2006 University of Cambridge             Copyright (c) 1997-2008 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 42  POSSIBILITY OF SUCH DAMAGE. Line 42  POSSIBILITY OF SUCH DAMAGE.
42  supporting functions. */  supporting functions. */
43    
44    
45    #ifdef HAVE_CONFIG_H
46    #include "config.h"
47    #endif
48    
49  #include "pcre_internal.h"  #include "pcre_internal.h"
50    
51    
# Line 213  do Line 217  do
217        tcode += 1 + LINK_SIZE;        tcode += 1 + LINK_SIZE;
218        break;        break;
219    
220          /* SKIPZERO skips the bracket. */
221    
222          case OP_SKIPZERO:
223          do tcode += GET(tcode,1); while (*tcode == OP_ALT);
224          tcode += 1 + LINK_SIZE;
225          break;
226    
227        /* Single-char * or ? sets the bit and tries the next item */        /* Single-char * or ? sets the bit and tries the next item */
228    
229        case OP_STAR:        case OP_STAR:
# Line 337  do Line 348  do
348        switch(tcode[1])        switch(tcode[1])
349          {          {
350          case OP_ANY:          case OP_ANY:
351            case OP_ALLANY:
352          return SSB_FAIL;          return SSB_FAIL;
353    
354          case OP_NOT_DIGIT:          case OP_NOT_DIGIT:
# Line 394  do Line 406  do
406        character with a value > 255. */        character with a value > 255. */
407    
408        case OP_NCLASS:        case OP_NCLASS:
409    #ifdef SUPPORT_UTF8
410        if (utf8)        if (utf8)
411          {          {
412          start_bits[24] |= 0xf0;              /* Bits for 0xc4 - 0xc8 */          start_bits[24] |= 0xf0;              /* Bits for 0xc4 - 0xc8 */
413          memset(start_bits+25, 0xff, 7);      /* Bits for 0xc9 - 0xff */          memset(start_bits+25, 0xff, 7);      /* Bits for 0xc9 - 0xff */
414          }          }
415    #endif
416        /* Fall through */        /* Fall through */
417    
418        case OP_CLASS:        case OP_CLASS:
# Line 411  do Line 425  do
425          value is > 127. In fact, there are only two possible starting bytes for          value is > 127. In fact, there are only two possible starting bytes for
426          characters in the range 128 - 255. */          characters in the range 128 - 255. */
427    
428    #ifdef SUPPORT_UTF8
429          if (utf8)          if (utf8)
430            {            {
431            for (c = 0; c < 16; c++) start_bits[c] |= tcode[c];            for (c = 0; c < 16; c++) start_bits[c] |= tcode[c];
# Line 428  do Line 443  do
443          /* In non-UTF-8 mode, the two bit maps are completely compatible. */          /* In non-UTF-8 mode, the two bit maps are completely compatible. */
444    
445          else          else
446    #endif
447            {            {
448            for (c = 0; c < 32; c++) start_bits[c] |= tcode[c];            for (c = 0; c < 32; c++) start_bits[c] |= tcode[c];
449            }            }
# Line 487  Returns:    pointer to a pcre_extra bloc Line 503  Returns:    pointer to a pcre_extra bloc
503              NULL on error or if no optimization possible              NULL on error or if no optimization possible
504  */  */
505    
506  PCRE_DATA_SCOPE pcre_extra *  PCRE_EXP_DEFN pcre_extra *
507  pcre_study(const pcre *external_re, int options, const char **errorptr)  pcre_study(const pcre *external_re, int options, const char **errorptr)
508  {  {
509  uschar start_bits[32];  uschar start_bits[32];
# Line 519  code = (uschar *)re + re->name_table_off Line 535  code = (uschar *)re + re->name_table_off
535  a multiline pattern that matches only at "line starts", no further processing  a multiline pattern that matches only at "line starts", no further processing
536  at present. */  at present. */
537    
538  if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)  if ((re->options & PCRE_ANCHORED) != 0 ||
539        (re->flags & (PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
540    return NULL;    return NULL;
541    
542  /* Set the character tables in the block that is passed around */  /* Set the character tables in the block that is passed around */

Legend:
Removed from v.93  
changed lines
  Added in v.345

  ViewVC Help
Powered by ViewVC 1.1.5