| 283 |
"(*VERB) with an argument is not supported", |
"(*VERB) with an argument is not supported", |
| 284 |
/* 60 */ |
/* 60 */ |
| 285 |
"(*VERB) not recognized", |
"(*VERB) not recognized", |
| 286 |
"number is too big" |
"number is too big" |
| 287 |
}; |
}; |
| 288 |
|
|
| 289 |
|
|
| 524 |
c = 0; |
c = 0; |
| 525 |
while ((digitab[ptr[1]] & ctype_digit) != 0) |
while ((digitab[ptr[1]] & ctype_digit) != 0) |
| 526 |
c = c * 10 + *(++ptr) - '0'; |
c = c * 10 + *(++ptr) - '0'; |
| 527 |
|
|
| 528 |
if (c < 0) |
if (c < 0) |
| 529 |
{ |
{ |
| 530 |
*errorcodeptr = ERR61; |
*errorcodeptr = ERR61; |
| 531 |
break; |
break; |
| 532 |
} |
} |
| 533 |
|
|
| 534 |
if (c == 0 || (braced && *(++ptr) != '}')) |
if (c == 0 || (braced && *(++ptr) != '}')) |
| 535 |
{ |
{ |
| 574 |
if (c < 0) |
if (c < 0) |
| 575 |
{ |
{ |
| 576 |
*errorcodeptr = ERR61; |
*errorcodeptr = ERR61; |
| 577 |
break; |
break; |
| 578 |
} |
} |
| 579 |
if (c < 10 || c <= bracount) |
if (c < 10 || c <= bracount) |
| 580 |
{ |
{ |
| 581 |
c = -(ESC_REF + c); |
c = -(ESC_REF + c); |
| 950 |
{ |
{ |
| 951 |
while (*(++ptr) != ']') |
while (*(++ptr) != ']') |
| 952 |
{ |
{ |
| 953 |
if (*ptr == 0) return -1; |
if (*ptr == 0) return -1; |
| 954 |
if (*ptr == '\\') |
if (*ptr == '\\') |
| 955 |
{ |
{ |
| 956 |
if (*(++ptr) == 0) return -1; |
if (*(++ptr) == 0) return -1; |
| 1106 |
{ |
{ |
| 1107 |
int d; |
int d; |
| 1108 |
register int op = *cc; |
register int op = *cc; |
|
|
|
| 1109 |
switch (op) |
switch (op) |
| 1110 |
{ |
{ |
| 1111 |
case OP_CBRA: |
case OP_CBRA: |
| 1194 |
|
|
| 1195 |
case OP_TYPEEXACT: |
case OP_TYPEEXACT: |
| 1196 |
branchlength += GET2(cc,1); |
branchlength += GET2(cc,1); |
| 1197 |
|
if (cc[3] == OP_PROP || cc[3] == OP_NOTPROP) cc += 2; |
| 1198 |
cc += 4; |
cc += 4; |
| 1199 |
break; |
break; |
| 1200 |
|
|
| 1303 |
code += _pcre_OP_lengths[c]; |
code += _pcre_OP_lengths[c]; |
| 1304 |
} |
} |
| 1305 |
|
|
| 1306 |
/* In UTF-8 mode, opcodes that are followed by a character may be followed by |
/* Otherwise, we can get the item's length from the table, except that for |
| 1307 |
a multi-byte character. The length in the table is a minimum, so we have to |
repeated character types, we have to test for \p and \P, which have an extra |
| 1308 |
arrange to skip the extra bytes. */ |
two bytes of parameters. */ |
| 1309 |
|
|
| 1310 |
else |
else |
| 1311 |
{ |
{ |
| 1312 |
|
switch(c) |
| 1313 |
|
{ |
| 1314 |
|
case OP_TYPESTAR: |
| 1315 |
|
case OP_TYPEMINSTAR: |
| 1316 |
|
case OP_TYPEPLUS: |
| 1317 |
|
case OP_TYPEMINPLUS: |
| 1318 |
|
case OP_TYPEQUERY: |
| 1319 |
|
case OP_TYPEMINQUERY: |
| 1320 |
|
case OP_TYPEPOSSTAR: |
| 1321 |
|
case OP_TYPEPOSPLUS: |
| 1322 |
|
case OP_TYPEPOSQUERY: |
| 1323 |
|
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2; |
| 1324 |
|
break; |
| 1325 |
|
|
| 1326 |
|
case OP_TYPEUPTO: |
| 1327 |
|
case OP_TYPEMINUPTO: |
| 1328 |
|
case OP_TYPEEXACT: |
| 1329 |
|
case OP_TYPEPOSUPTO: |
| 1330 |
|
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2; |
| 1331 |
|
break; |
| 1332 |
|
} |
| 1333 |
|
|
| 1334 |
|
/* Add in the fixed length from the table */ |
| 1335 |
|
|
| 1336 |
code += _pcre_OP_lengths[c]; |
code += _pcre_OP_lengths[c]; |
| 1337 |
|
|
| 1338 |
|
/* In UTF-8 mode, opcodes that are followed by a character may be followed by |
| 1339 |
|
a multi-byte character. The length in the table is a minimum, so we have to |
| 1340 |
|
arrange to skip the extra bytes. */ |
| 1341 |
|
|
| 1342 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1343 |
if (utf8) switch(c) |
if (utf8) switch(c) |
| 1344 |
{ |
{ |
| 1396 |
|
|
| 1397 |
if (c == OP_XCLASS) code += GET(code, 1); |
if (c == OP_XCLASS) code += GET(code, 1); |
| 1398 |
|
|
| 1399 |
/* Otherwise, we get the item's length from the table. In UTF-8 mode, opcodes |
/* Otherwise, we can get the item's length from the table, except that for |
| 1400 |
that are followed by a character may be followed by a multi-byte character. |
repeated character types, we have to test for \p and \P, which have an extra |
| 1401 |
The length in the table is a minimum, so we have to arrange to skip the extra |
two bytes of parameters. */ |
|
bytes. */ |
|
| 1402 |
|
|
| 1403 |
else |
else |
| 1404 |
{ |
{ |
| 1405 |
|
switch(c) |
| 1406 |
|
{ |
| 1407 |
|
case OP_TYPESTAR: |
| 1408 |
|
case OP_TYPEMINSTAR: |
| 1409 |
|
case OP_TYPEPLUS: |
| 1410 |
|
case OP_TYPEMINPLUS: |
| 1411 |
|
case OP_TYPEQUERY: |
| 1412 |
|
case OP_TYPEMINQUERY: |
| 1413 |
|
case OP_TYPEPOSSTAR: |
| 1414 |
|
case OP_TYPEPOSPLUS: |
| 1415 |
|
case OP_TYPEPOSQUERY: |
| 1416 |
|
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2; |
| 1417 |
|
break; |
| 1418 |
|
|
| 1419 |
|
case OP_TYPEPOSUPTO: |
| 1420 |
|
case OP_TYPEUPTO: |
| 1421 |
|
case OP_TYPEMINUPTO: |
| 1422 |
|
case OP_TYPEEXACT: |
| 1423 |
|
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2; |
| 1424 |
|
break; |
| 1425 |
|
} |
| 1426 |
|
|
| 1427 |
|
/* Add in the fixed length from the table */ |
| 1428 |
|
|
| 1429 |
code += _pcre_OP_lengths[c]; |
code += _pcre_OP_lengths[c]; |
| 1430 |
|
|
| 1431 |
|
/* In UTF-8 mode, opcodes that are followed by a character may be followed |
| 1432 |
|
by a multi-byte character. The length in the table is a minimum, so we have |
| 1433 |
|
to arrange to skip the extra bytes. */ |
| 1434 |
|
|
| 1435 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1436 |
if (utf8) switch(c) |
if (utf8) switch(c) |
| 1437 |
{ |
{ |
| 1530 |
/* Check for quantifiers after a class. XCLASS is used for classes that |
/* Check for quantifiers after a class. XCLASS is used for classes that |
| 1531 |
cannot be represented just by a bit map. This includes negated single |
cannot be represented just by a bit map. This includes negated single |
| 1532 |
high-valued characters. The length in _pcre_OP_lengths[] is zero; the |
high-valued characters. The length in _pcre_OP_lengths[] is zero; the |
| 1533 |
actual length is stored in the compiled code, so we must update "code" |
actual length is stored in the compiled code, so we must update "code" |
| 1534 |
here. */ |
here. */ |
| 1535 |
|
|
| 1536 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1597 |
case OP_TYPEEXACT: |
case OP_TYPEEXACT: |
| 1598 |
return FALSE; |
return FALSE; |
| 1599 |
|
|
| 1600 |
|
/* These are going to continue, as they may be empty, but we have to |
| 1601 |
|
fudge the length for the \p and \P cases. */ |
| 1602 |
|
|
| 1603 |
|
case OP_TYPESTAR: |
| 1604 |
|
case OP_TYPEMINSTAR: |
| 1605 |
|
case OP_TYPEPOSSTAR: |
| 1606 |
|
case OP_TYPEQUERY: |
| 1607 |
|
case OP_TYPEMINQUERY: |
| 1608 |
|
case OP_TYPEPOSQUERY: |
| 1609 |
|
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2; |
| 1610 |
|
break; |
| 1611 |
|
|
| 1612 |
|
/* Same for these */ |
| 1613 |
|
|
| 1614 |
|
case OP_TYPEUPTO: |
| 1615 |
|
case OP_TYPEMINUPTO: |
| 1616 |
|
case OP_TYPEPOSUPTO: |
| 1617 |
|
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2; |
| 1618 |
|
break; |
| 1619 |
|
|
| 1620 |
/* End of branch */ |
/* End of branch */ |
| 1621 |
|
|
| 1622 |
case OP_KET: |
case OP_KET: |
| 1779 |
uschar *save_hwm) |
uschar *save_hwm) |
| 1780 |
{ |
{ |
| 1781 |
uschar *ptr = group; |
uschar *ptr = group; |
| 1782 |
|
|
| 1783 |
while ((ptr = (uschar *)find_recurse(ptr, utf8)) != NULL) |
while ((ptr = (uschar *)find_recurse(ptr, utf8)) != NULL) |
| 1784 |
{ |
{ |
| 1785 |
int offset; |
int offset; |
| 2749 |
else inescq = TRUE; |
else inescq = TRUE; |
| 2750 |
continue; |
continue; |
| 2751 |
} |
} |
| 2752 |
|
else if (-c == ESC_E) continue; /* Ignore orphan \E */ |
| 2753 |
|
|
| 2754 |
if (c < 0) |
if (c < 0) |
| 2755 |
{ |
{ |
| 2975 |
} |
} |
| 2976 |
|
|
| 2977 |
oldptr = ptr; |
oldptr = ptr; |
| 2978 |
|
|
| 2979 |
|
/* Remember \r or \n */ |
| 2980 |
|
|
| 2981 |
|
if (c == '\r' || c == '\n') cd->external_flags |= PCRE_HASCRORLF; |
| 2982 |
|
|
| 2983 |
|
/* Check for range */ |
| 2984 |
|
|
| 2985 |
if (!inescq && ptr[1] == '-') |
if (!inescq && ptr[1] == '-') |
| 2986 |
{ |
{ |
| 3049 |
|
|
| 3050 |
if (d == c) goto LONE_SINGLE_CHARACTER; /* A few lines below */ |
if (d == c) goto LONE_SINGLE_CHARACTER; /* A few lines below */ |
| 3051 |
|
|
| 3052 |
|
/* Remember \r or \n */ |
| 3053 |
|
|
| 3054 |
|
if (d == '\r' || d == '\n') cd->external_flags |= PCRE_HASCRORLF; |
| 3055 |
|
|
| 3056 |
/* In UTF-8 mode, if the upper limit is > 255, or > 127 for caseless |
/* In UTF-8 mode, if the upper limit is > 255, or > 127 for caseless |
| 3057 |
matching, we have to use an XCLASS with extra data items. Caseless |
matching, we have to use an XCLASS with extra data items. Caseless |
| 3058 |
matching for characters > 127 is available only if UCP support is |
matching for characters > 127 is available only if UCP support is |
| 3157 |
apparent range that isn't. */ |
apparent range that isn't. */ |
| 3158 |
|
|
| 3159 |
LONE_SINGLE_CHARACTER: |
LONE_SINGLE_CHARACTER: |
| 3160 |
|
|
| 3161 |
/* Handle a character that cannot go in the bit map */ |
/* Handle a character that cannot go in the bit map */ |
| 3162 |
|
|
| 3163 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 3205 |
*errorcodeptr = ERR6; |
*errorcodeptr = ERR6; |
| 3206 |
goto FAILED; |
goto FAILED; |
| 3207 |
} |
} |
| 3208 |
|
|
| 3209 |
|
|
| 3210 |
|
/* This code has been disabled because it would mean that \s counts as |
| 3211 |
|
an explicit \r or \n reference, and that's not really what is wanted. Now |
| 3212 |
|
we set the flag only if there is a literal "\r" or "\n" in the class. */ |
| 3213 |
|
|
| 3214 |
|
#if 0 |
| 3215 |
|
/* Remember whether \r or \n are in this class */ |
| 3216 |
|
|
| 3217 |
|
if (negate_class) |
| 3218 |
|
{ |
| 3219 |
|
if ((classbits[1] & 0x24) != 0x24) cd->external_flags |= PCRE_HASCRORLF; |
| 3220 |
|
} |
| 3221 |
|
else |
| 3222 |
|
{ |
| 3223 |
|
if ((classbits[1] & 0x24) != 0) cd->external_flags |= PCRE_HASCRORLF; |
| 3224 |
|
} |
| 3225 |
|
#endif |
| 3226 |
|
|
| 3227 |
|
|
| 3228 |
/* If class_charcount is 1, we saw precisely one character whose value is |
/* If class_charcount is 1, we saw precisely one character whose value is |
| 3229 |
less than 256. In non-UTF-8 mode we can always optimize. In UTF-8 mode, we |
less than 256. As long as there were no characters >= 128 and there was no |
| 3230 |
can optimize the negative case only if there were no characters >= 128 |
use of \p or \P, in other words, no use of any XCLASS features, we can |
| 3231 |
because OP_NOT and the related opcodes like OP_NOTSTAR operate on |
optimize. |
| 3232 |
single-bytes only. This is an historical hangover. Maybe one day we can |
|
| 3233 |
tidy these opcodes to handle multi-byte characters. |
In UTF-8 mode, we can optimize the negative case only if there were no |
| 3234 |
|
characters >= 128 because OP_NOT and the related opcodes like OP_NOTSTAR |
| 3235 |
|
operate on single-bytes only. This is an historical hangover. Maybe one day |
| 3236 |
|
we can tidy these opcodes to handle multi-byte characters. |
| 3237 |
|
|
| 3238 |
The optimization throws away the bit map. We turn the item into a |
The optimization throws away the bit map. We turn the item into a |
| 3239 |
1-character OP_CHAR[NC] if it's positive, or OP_NOT if it's negative. Note |
1-character OP_CHAR[NC] if it's positive, or OP_NOT if it's negative. Note |
| 3243 |
reqbyte, save the previous value for reinstating. */ |
reqbyte, save the previous value for reinstating. */ |
| 3244 |
|
|
| 3245 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 3246 |
if (class_charcount == 1 && |
if (class_charcount == 1 && !class_utf8 && |
| 3247 |
(!utf8 || |
(!utf8 || !negate_class || class_lastchar < 128)) |
|
(!class_utf8 && (!negate_class || class_lastchar < 128)))) |
|
|
|
|
| 3248 |
#else |
#else |
| 3249 |
if (class_charcount == 1) |
if (class_charcount == 1) |
| 3250 |
#endif |
#endif |
| 3516 |
/* All real repeats make it impossible to handle partial matching (maybe |
/* All real repeats make it impossible to handle partial matching (maybe |
| 3517 |
one day we will be able to remove this restriction). */ |
one day we will be able to remove this restriction). */ |
| 3518 |
|
|
| 3519 |
if (repeat_max != 1) cd->nopartial = TRUE; |
if (repeat_max != 1) cd->external_flags |= PCRE_NOPARTIAL; |
| 3520 |
|
|
| 3521 |
/* Combine the op_type with the repeat_type */ |
/* Combine the op_type with the repeat_type */ |
| 3522 |
|
|
| 3666 |
/* All real repeats make it impossible to handle partial matching (maybe |
/* All real repeats make it impossible to handle partial matching (maybe |
| 3667 |
one day we will be able to remove this restriction). */ |
one day we will be able to remove this restriction). */ |
| 3668 |
|
|
| 3669 |
if (repeat_max != 1) cd->nopartial = TRUE; |
if (repeat_max != 1) cd->external_flags |= PCRE_NOPARTIAL; |
| 3670 |
|
|
| 3671 |
if (repeat_min == 0 && repeat_max == -1) |
if (repeat_min == 0 && repeat_max == -1) |
| 3672 |
*code++ = OP_CRSTAR + repeat_type; |
*code++ = OP_CRSTAR + repeat_type; |
| 4663 |
|
|
| 4664 |
case 'J': /* Record that it changed in the external options */ |
case 'J': /* Record that it changed in the external options */ |
| 4665 |
*optset |= PCRE_DUPNAMES; |
*optset |= PCRE_DUPNAMES; |
| 4666 |
cd->external_options |= PCRE_JCHANGED; |
cd->external_flags |= PCRE_JCHANGED; |
| 4667 |
break; |
break; |
| 4668 |
|
|
| 4669 |
case 'i': *optset |= PCRE_CASELESS; break; |
case 'i': *optset |= PCRE_CASELESS; break; |
| 4854 |
goto FAILED; |
goto FAILED; |
| 4855 |
} |
} |
| 4856 |
|
|
| 4857 |
/* In the pre-compile phase, update the length by the length of the nested |
/* In the pre-compile phase, update the length by the length of the group, |
| 4858 |
group, less the brackets at either end. Then reduce the compiled code to |
less the brackets at either end. Then reduce the compiled code to just a |
| 4859 |
just the brackets so that it doesn't use much memory if it is duplicated by |
set of non-capturing brackets so that it doesn't use much memory if it is |
| 4860 |
a quantifier. */ |
duplicated by a quantifier.*/ |
| 4861 |
|
|
| 4862 |
if (lengthptr != NULL) |
if (lengthptr != NULL) |
| 4863 |
{ |
{ |
| 4867 |
goto FAILED; |
goto FAILED; |
| 4868 |
} |
} |
| 4869 |
*lengthptr += length_prevgroup - 2 - 2*LINK_SIZE; |
*lengthptr += length_prevgroup - 2 - 2*LINK_SIZE; |
| 4870 |
code++; |
*code++ = OP_BRA; |
| 4871 |
PUTINC(code, 0, 1 + LINK_SIZE); |
PUTINC(code, 0, 1 + LINK_SIZE); |
| 4872 |
*code++ = OP_KET; |
*code++ = OP_KET; |
| 4873 |
PUTINC(code, 0, 1 + LINK_SIZE); |
PUTINC(code, 0, 1 + LINK_SIZE); |
| 4874 |
|
break; /* No need to waste time with special character handling */ |
| 4875 |
} |
} |
| 4876 |
|
|
| 4877 |
/* Otherwise update the main code pointer to the end of the group. */ |
/* Otherwise update the main code pointer to the end of the group. */ |
| 4878 |
|
|
| 4879 |
else code = tempcode; |
code = tempcode; |
| 4880 |
|
|
| 4881 |
/* For a DEFINE group, required and first character settings are not |
/* For a DEFINE group, required and first character settings are not |
| 4882 |
relevant. */ |
relevant. */ |
| 5080 |
*code++ = ((options & PCRE_CASELESS) != 0)? OP_CHARNC : OP_CHAR; |
*code++ = ((options & PCRE_CASELESS) != 0)? OP_CHARNC : OP_CHAR; |
| 5081 |
for (c = 0; c < mclength; c++) *code++ = mcbuffer[c]; |
for (c = 0; c < mclength; c++) *code++ = mcbuffer[c]; |
| 5082 |
|
|
| 5083 |
|
/* Remember if \r or \n were seen */ |
| 5084 |
|
|
| 5085 |
|
if (mcbuffer[0] == '\r' || mcbuffer[0] == '\n') |
| 5086 |
|
cd->external_flags |= PCRE_HASCRORLF; |
| 5087 |
|
|
| 5088 |
/* Set the first and required bytes appropriately. If no previous first |
/* Set the first and required bytes appropriately. If no previous first |
| 5089 |
byte, set it from this character, but revert to none on a zero repeat. |
byte, set it from this character, but revert to none on a zero repeat. |
| 5090 |
Otherwise, leave the firstbyte value alone, and don't change it on a zero |
Otherwise, leave the firstbyte value alone, and don't change it on a zero |
| 5684 |
int length = 1; /* For final END opcode */ |
int length = 1; /* For final END opcode */ |
| 5685 |
int firstbyte, reqbyte, newline; |
int firstbyte, reqbyte, newline; |
| 5686 |
int errorcode = 0; |
int errorcode = 0; |
| 5687 |
|
int skipatstart = 0; |
| 5688 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 5689 |
BOOL utf8; |
BOOL utf8; |
| 5690 |
#endif |
#endif |
| 5763 |
cd->cbits = tables + cbits_offset; |
cd->cbits = tables + cbits_offset; |
| 5764 |
cd->ctypes = tables + ctypes_offset; |
cd->ctypes = tables + ctypes_offset; |
| 5765 |
|
|
| 5766 |
|
/* Check for newline settings at the start of the pattern, and remember the |
| 5767 |
|
offset for later. */ |
| 5768 |
|
|
| 5769 |
|
if (ptr[0] == '(' && ptr[1] == '*') |
| 5770 |
|
{ |
| 5771 |
|
int newnl = 0; |
| 5772 |
|
if (strncmp((char *)(ptr+2), "CR)", 3) == 0) |
| 5773 |
|
{ skipatstart = 5; newnl = PCRE_NEWLINE_CR; } |
| 5774 |
|
else if (strncmp((char *)(ptr+2), "LF)", 3) == 0) |
| 5775 |
|
{ skipatstart = 5; newnl = PCRE_NEWLINE_LF; } |
| 5776 |
|
else if (strncmp((char *)(ptr+2), "CRLF)", 5) == 0) |
| 5777 |
|
{ skipatstart = 7; newnl = PCRE_NEWLINE_CR + PCRE_NEWLINE_LF; } |
| 5778 |
|
else if (strncmp((char *)(ptr+2), "ANY)", 4) == 0) |
| 5779 |
|
{ skipatstart = 6; newnl = PCRE_NEWLINE_ANY; } |
| 5780 |
|
else if (strncmp((char *)(ptr+2), "ANYCRLF)", 8) == 0) |
| 5781 |
|
{ skipatstart = 10; newnl = PCRE_NEWLINE_ANYCRLF; } |
| 5782 |
|
if (skipatstart > 0) |
| 5783 |
|
options = (options & ~PCRE_NEWLINE_BITS) | newnl; |
| 5784 |
|
} |
| 5785 |
|
|
| 5786 |
/* Handle different types of newline. The three bits give seven cases. The |
/* Handle different types of newline. The three bits give seven cases. The |
| 5787 |
current code allows for fixed one- or two-byte sequences, plus "any" and |
current code allows for fixed one- or two-byte sequences, plus "any" and |
| 5788 |
"anycrlf". */ |
"anycrlf". */ |
| 5789 |
|
|
| 5790 |
switch (options & (PCRE_NEWLINE_CRLF | PCRE_NEWLINE_ANY)) |
switch (options & PCRE_NEWLINE_BITS) |
| 5791 |
{ |
{ |
| 5792 |
case 0: newline = NEWLINE; break; /* Compile-time default */ |
case 0: newline = NEWLINE; break; /* Build-time default */ |
| 5793 |
case PCRE_NEWLINE_CR: newline = '\r'; break; |
case PCRE_NEWLINE_CR: newline = '\r'; break; |
| 5794 |
case PCRE_NEWLINE_LF: newline = '\n'; break; |
case PCRE_NEWLINE_LF: newline = '\n'; break; |
| 5795 |
case PCRE_NEWLINE_CR+ |
case PCRE_NEWLINE_CR+ |
| 5852 |
cd->start_pattern = (const uschar *)pattern; |
cd->start_pattern = (const uschar *)pattern; |
| 5853 |
cd->end_pattern = (const uschar *)(pattern + strlen(pattern)); |
cd->end_pattern = (const uschar *)(pattern + strlen(pattern)); |
| 5854 |
cd->req_varyopt = 0; |
cd->req_varyopt = 0; |
|
cd->nopartial = FALSE; |
|
| 5855 |
cd->external_options = options; |
cd->external_options = options; |
| 5856 |
|
cd->external_flags = 0; |
| 5857 |
|
|
| 5858 |
/* Now do the pre-compile. On error, errorcode will be set non-zero, so we |
/* Now do the pre-compile. On error, errorcode will be set non-zero, so we |
| 5859 |
don't need to look at the result of the function here. The initial options have |
don't need to look at the result of the function here. The initial options have |
| 5861 |
found within the regex right at the beginning. Bringing initial option settings |
found within the regex right at the beginning. Bringing initial option settings |
| 5862 |
outside can help speed up starting point checks. */ |
outside can help speed up starting point checks. */ |
| 5863 |
|
|
| 5864 |
|
ptr += skipatstart; |
| 5865 |
code = cworkspace; |
code = cworkspace; |
| 5866 |
*code = OP_BRA; |
*code = OP_BRA; |
| 5867 |
(void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS, |
(void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS, |
| 5892 |
goto PCRE_EARLY_ERROR_RETURN; |
goto PCRE_EARLY_ERROR_RETURN; |
| 5893 |
} |
} |
| 5894 |
|
|
| 5895 |
/* Put in the magic number, and save the sizes, initial options, and character |
/* Put in the magic number, and save the sizes, initial options, internal |
| 5896 |
table pointer. NULL is used for the default character tables. The nullpad field |
flags, and character table pointer. NULL is used for the default character |
| 5897 |
is at the end; it's there to help in the case when a regex compiled on a system |
tables. The nullpad field is at the end; it's there to help in the case when a |
| 5898 |
with 4-byte pointers is run on another with 8-byte pointers. */ |
regex compiled on a system with 4-byte pointers is run on another with 8-byte |
| 5899 |
|
pointers. */ |
| 5900 |
|
|
| 5901 |
re->magic_number = MAGIC_NUMBER; |
re->magic_number = MAGIC_NUMBER; |
| 5902 |
re->size = size; |
re->size = size; |
| 5903 |
re->options = cd->external_options; |
re->options = cd->external_options; |
| 5904 |
|
re->flags = cd->external_flags; |
| 5905 |
re->dummy1 = 0; |
re->dummy1 = 0; |
| 5906 |
re->first_byte = 0; |
re->first_byte = 0; |
| 5907 |
re->req_byte = 0; |
re->req_byte = 0; |
| 5926 |
cd->start_code = codestart; |
cd->start_code = codestart; |
| 5927 |
cd->hwm = cworkspace; |
cd->hwm = cworkspace; |
| 5928 |
cd->req_varyopt = 0; |
cd->req_varyopt = 0; |
|
cd->nopartial = FALSE; |
|
| 5929 |
cd->had_accept = FALSE; |
cd->had_accept = FALSE; |
| 5930 |
|
|
| 5931 |
/* Set up a starting, non-extracting bracket, then compile the expression. On |
/* Set up a starting, non-extracting bracket, then compile the expression. On |
| 5932 |
error, errorcode will be set non-zero, so we don't need to look at the result |
error, errorcode will be set non-zero, so we don't need to look at the result |
| 5933 |
of the function here. */ |
of the function here. */ |
| 5934 |
|
|
| 5935 |
ptr = (const uschar *)pattern; |
ptr = (const uschar *)pattern + skipatstart; |
| 5936 |
code = (uschar *)codestart; |
code = (uschar *)codestart; |
| 5937 |
*code = OP_BRA; |
*code = OP_BRA; |
| 5938 |
(void)compile_regex(re->options, re->options & PCRE_IMS, &code, &ptr, |
(void)compile_regex(re->options, re->options & PCRE_IMS, &code, &ptr, |
| 5939 |
&errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, NULL); |
&errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, NULL); |
| 5940 |
re->top_bracket = cd->bracount; |
re->top_bracket = cd->bracount; |
| 5941 |
re->top_backref = cd->top_backref; |
re->top_backref = cd->top_backref; |
| 5942 |
|
re->flags = cd->external_flags; |
| 5943 |
|
|
|
if (cd->nopartial) re->options |= PCRE_NOPARTIAL; |
|
| 5944 |
if (cd->had_accept) reqbyte = -1; /* Must disable after (*ACCEPT) */ |
if (cd->had_accept) reqbyte = -1; /* Must disable after (*ACCEPT) */ |
| 5945 |
|
|
| 5946 |
/* If not reached end of pattern on success, there's an excess bracket. */ |
/* If not reached end of pattern on success, there's an excess bracket. */ |
| 6012 |
int ch = firstbyte & 255; |
int ch = firstbyte & 255; |
| 6013 |
re->first_byte = ((firstbyte & REQ_CASELESS) != 0 && |
re->first_byte = ((firstbyte & REQ_CASELESS) != 0 && |
| 6014 |
cd->fcc[ch] == ch)? ch : firstbyte; |
cd->fcc[ch] == ch)? ch : firstbyte; |
| 6015 |
re->options |= PCRE_FIRSTSET; |
re->flags |= PCRE_FIRSTSET; |
| 6016 |
} |
} |
| 6017 |
else if (is_startline(codestart, 0, cd->backref_map)) |
else if (is_startline(codestart, 0, cd->backref_map)) |
| 6018 |
re->options |= PCRE_STARTLINE; |
re->flags |= PCRE_STARTLINE; |
| 6019 |
} |
} |
| 6020 |
} |
} |
| 6021 |
|
|
| 6029 |
int ch = reqbyte & 255; |
int ch = reqbyte & 255; |
| 6030 |
re->req_byte = ((reqbyte & REQ_CASELESS) != 0 && |
re->req_byte = ((reqbyte & REQ_CASELESS) != 0 && |
| 6031 |
cd->fcc[ch] == ch)? (reqbyte & ~REQ_CASELESS) : reqbyte; |
cd->fcc[ch] == ch)? (reqbyte & ~REQ_CASELESS) : reqbyte; |
| 6032 |
re->options |= PCRE_REQCHSET; |
re->flags |= PCRE_REQCHSET; |
| 6033 |
} |
} |
| 6034 |
|
|
| 6035 |
/* Print out the compiled data if debugging is enabled. This is never the |
/* Print out the compiled data if debugging is enabled. This is never the |
| 6040 |
printf("Length = %d top_bracket = %d top_backref = %d\n", |
printf("Length = %d top_bracket = %d top_backref = %d\n", |
| 6041 |
length, re->top_bracket, re->top_backref); |
length, re->top_bracket, re->top_backref); |
| 6042 |
|
|
| 6043 |
if (re->options != 0) |
printf("Options=%08x\n", re->options); |
|
{ |
|
|
printf("%s%s%s%s%s%s%s%s%s\n", |
|
|
((re->options & PCRE_NOPARTIAL) != 0)? "nopartial " : "", |
|
|
((re->options & PCRE_ANCHORED) != 0)? "anchored " : "", |
|
|
((re->options & PCRE_CASELESS) != 0)? "caseless " : "", |
|
|
((re->options & PCRE_EXTENDED) != 0)? "extended " : "", |
|
|
((re->options & PCRE_MULTILINE) != 0)? "multiline " : "", |
|
|
((re->options & PCRE_DOTALL) != 0)? "dotall " : "", |
|
|
((re->options & PCRE_DOLLAR_ENDONLY) != 0)? "endonly " : "", |
|
|
((re->options & PCRE_EXTRA) != 0)? "extra " : "", |
|
|
((re->options & PCRE_UNGREEDY) != 0)? "ungreedy " : ""); |
|
|
} |
|
| 6044 |
|
|
| 6045 |
if ((re->options & PCRE_FIRSTSET) != 0) |
if ((re->flags & PCRE_FIRSTSET) != 0) |
| 6046 |
{ |
{ |
| 6047 |
int ch = re->first_byte & 255; |
int ch = re->first_byte & 255; |
| 6048 |
const char *caseless = ((re->first_byte & REQ_CASELESS) == 0)? |
const char *caseless = ((re->first_byte & REQ_CASELESS) == 0)? |
| 6051 |
else printf("First char = \\x%02x%s\n", ch, caseless); |
else printf("First char = \\x%02x%s\n", ch, caseless); |
| 6052 |
} |
} |
| 6053 |
|
|
| 6054 |
if ((re->options & PCRE_REQCHSET) != 0) |
if ((re->flags & PCRE_REQCHSET) != 0) |
| 6055 |
{ |
{ |
| 6056 |
int ch = re->req_byte & 255; |
int ch = re->req_byte & 255; |
| 6057 |
const char *caseless = ((re->req_byte & REQ_CASELESS) == 0)? |
const char *caseless = ((re->req_byte & REQ_CASELESS) == 0)? |