/[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 1413 by ph10, Tue Nov 19 15:36:57 2013 UTC revision 1414 by zherczeg, Sun Dec 22 16:27:35 2013 UTC
# Line 879  do Line 879  do
879        case OP_SOM:        case OP_SOM:
880        case OP_THEN:        case OP_THEN:
881        case OP_THEN_ARG:        case OP_THEN_ARG:
 #if defined SUPPORT_UTF || !defined COMPILE_PCRE8  
       case OP_XCLASS:  
 #endif  
882        return SSB_FAIL;        return SSB_FAIL;
883    
884        /* We can ignore word boundary tests. */        /* We can ignore word boundary tests. */
# Line 1257  do Line 1254  do
1254        with a value >= 0xc4 is a potentially valid starter because it starts a        with a value >= 0xc4 is a potentially valid starter because it starts a
1255        character with a value > 255. */        character with a value > 255. */
1256    
1257    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
1258          case OP_XCLASS:
1259          if ((tcode[1 + LINK_SIZE] & XCL_HASPROP) != 0)
1260            return SSB_FAIL;
1261          /* All bits are set. */
1262          if ((tcode[1 + LINK_SIZE] & XCL_MAP) == 0 && (tcode[1 + LINK_SIZE] & XCL_NOT) != 0)
1263            return SSB_FAIL;
1264    #endif
1265          /* Fall through */
1266    
1267        case OP_NCLASS:        case OP_NCLASS:
1268  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
1269        if (utf)        if (utf)
# Line 1273  do Line 1280  do
1280        case OP_CLASS:        case OP_CLASS:
1281          {          {
1282          pcre_uint8 *map;          pcre_uint8 *map;
1283          tcode++;  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
1284          map = (pcre_uint8 *)tcode;          map = NULL;
1285            if (*tcode == OP_XCLASS)
1286              {
1287              if ((tcode[1 + LINK_SIZE] & XCL_MAP) != 0)
1288                map = (pcre_uint8 *)(tcode + 1 + LINK_SIZE + 1);
1289              tcode += GET(tcode, 1);
1290              }
1291            else
1292    #endif
1293              {
1294              tcode++;
1295              map = (pcre_uint8 *)tcode;
1296              tcode += 32 / sizeof(pcre_uchar);
1297              }
1298    
1299          /* In UTF-8 mode, the bits in a bit map correspond to character          /* In UTF-8 mode, the bits in a bit map correspond to character
1300          values, not to byte values. However, the bit map we are constructing is          values, not to byte values. However, the bit map we are constructing is
# Line 1282  do Line 1302  do
1302          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
1303          characters in the range 128 - 255. */          characters in the range 128 - 255. */
1304    
1305  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
1306          if (utf)          if (map != NULL)
1307    #endif
1308            {            {
1309            for (c = 0; c < 16; c++) start_bits[c] |= map[c];  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
1310            for (c = 128; c < 256; c++)            if (utf)
1311              {              {
1312              if ((map[c/8] && (1 << (c&7))) != 0)              for (c = 0; c < 16; c++) start_bits[c] |= map[c];
1313                for (c = 128; c < 256; c++)
1314                {                {
1315                int d = (c >> 6) | 0xc0;            /* Set bit for this starter */                if ((map[c/8] && (1 << (c&7))) != 0)
1316                start_bits[d/8] |= (1 << (d&7));    /* and then skip on to the */                  {
1317                c = (c & 0xc0) + 0x40 - 1;          /* next relevant character. */                  int d = (c >> 6) | 0xc0;            /* Set bit for this starter */
1318                    start_bits[d/8] |= (1 << (d&7));    /* and then skip on to the */
1319                    c = (c & 0xc0) + 0x40 - 1;          /* next relevant character. */
1320                    }
1321                }                }
1322              }              }
1323            }            else
         else  
1324  #endif  #endif
1325            {              {
1326            /* In non-UTF-8 mode, the two bit maps are completely compatible. */              /* In non-UTF-8 mode, the two bit maps are completely compatible. */
1327            for (c = 0; c < 32; c++) start_bits[c] |= map[c];              for (c = 0; c < 32; c++) start_bits[c] |= map[c];
1328                }
1329            }            }
1330    
1331          /* Advance past the bit map, and act on what follows. For a zero          /* Advance past the bit map, and act on what follows. For a zero
1332          minimum repeat, continue; otherwise stop processing. */          minimum repeat, continue; otherwise stop processing. */
1333    
         tcode += 32 / sizeof(pcre_uchar);  
1334          switch (*tcode)          switch (*tcode)
1335            {            {
1336            case OP_CRSTAR:            case OP_CRSTAR:

Legend:
Removed from v.1413  
changed lines
  Added in v.1414

  ViewVC Help
Powered by ViewVC 1.1.5