| 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 |
| 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 |
|
|
| 398 |
character with a value > 255. */ |
character with a value > 255. */ |
| 399 |
|
|
| 400 |
case OP_NCLASS: |
case OP_NCLASS: |
| 401 |
|
#ifdef SUPPORT_UTF8 |
| 402 |
if (utf8) |
if (utf8) |
| 403 |
{ |
{ |
| 404 |
start_bits[24] |= 0xf0; /* Bits for 0xc4 - 0xc8 */ |
start_bits[24] |= 0xf0; /* Bits for 0xc4 - 0xc8 */ |
| 405 |
memset(start_bits+25, 0xff, 7); /* Bits for 0xc9 - 0xff */ |
memset(start_bits+25, 0xff, 7); /* Bits for 0xc9 - 0xff */ |
| 406 |
} |
} |
| 407 |
|
#endif |
| 408 |
/* Fall through */ |
/* Fall through */ |
| 409 |
|
|
| 410 |
case OP_CLASS: |
case OP_CLASS: |
| 417 |
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 |
| 418 |
characters in the range 128 - 255. */ |
characters in the range 128 - 255. */ |
| 419 |
|
|
| 420 |
|
#ifdef SUPPORT_UTF8 |
| 421 |
if (utf8) |
if (utf8) |
| 422 |
{ |
{ |
| 423 |
for (c = 0; c < 16; c++) start_bits[c] |= tcode[c]; |
for (c = 0; c < 16; c++) start_bits[c] |= tcode[c]; |
| 435 |
/* In non-UTF-8 mode, the two bit maps are completely compatible. */ |
/* In non-UTF-8 mode, the two bit maps are completely compatible. */ |
| 436 |
|
|
| 437 |
else |
else |
| 438 |
|
#endif |
| 439 |
{ |
{ |
| 440 |
for (c = 0; c < 32; c++) start_bits[c] |= tcode[c]; |
for (c = 0; c < 32; c++) start_bits[c] |= tcode[c]; |
| 441 |
} |
} |
| 495 |
NULL on error or if no optimization possible |
NULL on error or if no optimization possible |
| 496 |
*/ |
*/ |
| 497 |
|
|
| 498 |
PCRE_DATA_SCOPE pcre_extra * |
PCRE_EXP_DEFN pcre_extra * |
| 499 |
pcre_study(const pcre *external_re, int options, const char **errorptr) |
pcre_study(const pcre *external_re, int options, const char **errorptr) |
| 500 |
{ |
{ |
| 501 |
uschar start_bits[32]; |
uschar start_bits[32]; |
| 527 |
a multiline pattern that matches only at "line starts", no further processing |
a multiline pattern that matches only at "line starts", no further processing |
| 528 |
at present. */ |
at present. */ |
| 529 |
|
|
| 530 |
if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0) |
if ((re->options & PCRE_ANCHORED) != 0 || |
| 531 |
|
(re->flags & (PCRE_FIRSTSET|PCRE_STARTLINE)) != 0) |
| 532 |
return NULL; |
return NULL; |
| 533 |
|
|
| 534 |
/* Set the character tables in the block that is passed around */ |
/* Set the character tables in the block that is passed around */ |