| 282 |
"(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number", |
"(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number", |
| 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" |
| 287 |
}; |
}; |
| 288 |
|
|
| 289 |
|
|
| 440 |
|
|
| 441 |
Returns: zero or positive => a data character |
Returns: zero or positive => a data character |
| 442 |
negative => a special escape sequence |
negative => a special escape sequence |
| 443 |
on error, errorptr is set |
on error, errorcodeptr is set |
| 444 |
*/ |
*/ |
| 445 |
|
|
| 446 |
static int |
static int |
| 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) |
| 529 |
|
{ |
| 530 |
|
*errorcodeptr = ERR61; |
| 531 |
|
break; |
| 532 |
|
} |
| 533 |
|
|
| 534 |
if (c == 0 || (braced && *(++ptr) != '}')) |
if (c == 0 || (braced && *(++ptr) != '}')) |
| 535 |
{ |
{ |
| 536 |
*errorcodeptr = ERR57; |
*errorcodeptr = ERR57; |
| 537 |
return 0; |
break; |
| 538 |
} |
} |
| 539 |
|
|
| 540 |
if (negated) |
if (negated) |
| 542 |
if (c > bracount) |
if (c > bracount) |
| 543 |
{ |
{ |
| 544 |
*errorcodeptr = ERR15; |
*errorcodeptr = ERR15; |
| 545 |
return 0; |
break; |
| 546 |
} |
} |
| 547 |
c = bracount - (c - 1); |
c = bracount - (c - 1); |
| 548 |
} |
} |
| 571 |
c -= '0'; |
c -= '0'; |
| 572 |
while ((digitab[ptr[1]] & ctype_digit) != 0) |
while ((digitab[ptr[1]] & ctype_digit) != 0) |
| 573 |
c = c * 10 + *(++ptr) - '0'; |
c = c * 10 + *(++ptr) - '0'; |
| 574 |
|
if (c < 0) |
| 575 |
|
{ |
| 576 |
|
*errorcodeptr = ERR61; |
| 577 |
|
break; |
| 578 |
|
} |
| 579 |
if (c < 10 || c <= bracount) |
if (c < 10 || c <= bracount) |
| 580 |
{ |
{ |
| 581 |
c = -(ESC_REF + c); |
c = -(ESC_REF + c); |
| 671 |
if (c == 0) |
if (c == 0) |
| 672 |
{ |
{ |
| 673 |
*errorcodeptr = ERR2; |
*errorcodeptr = ERR2; |
| 674 |
return 0; |
break; |
| 675 |
} |
} |
| 676 |
|
|
| 677 |
#ifndef EBCDIC /* ASCII coding */ |
#ifndef EBCDIC /* ASCII coding */ |
| 950 |
{ |
{ |
| 951 |
while (*(++ptr) != ']') |
while (*(++ptr) != ']') |
| 952 |
{ |
{ |
| 953 |
|
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 |
{ |
{ |
| 1527 |
|
|
| 1528 |
switch (c) |
switch (c) |
| 1529 |
{ |
{ |
| 1530 |
/* Check for quantifiers after a class */ |
/* 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 |
| 1532 |
|
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" |
| 1534 |
|
here. */ |
| 1535 |
|
|
| 1536 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1537 |
case OP_XCLASS: |
case OP_XCLASS: |
| 1538 |
ccode = code + GET(code, 1); |
ccode = code += GET(code, 1); |
| 1539 |
goto CHECK_CLASS_REPEAT; |
goto CHECK_CLASS_REPEAT; |
| 1540 |
#endif |
#endif |
| 1541 |
|
|
| 2728 |
else inescq = TRUE; |
else inescq = TRUE; |
| 2729 |
continue; |
continue; |
| 2730 |
} |
} |
| 2731 |
|
else if (-c == ESC_E) continue; /* Ignore orphan \E */ |
| 2732 |
|
|
| 2733 |
if (c < 0) |
if (c < 0) |
| 2734 |
{ |
{ |
| 4803 |
goto FAILED; |
goto FAILED; |
| 4804 |
} |
} |
| 4805 |
|
|
| 4806 |
/* 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, |
| 4807 |
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 |
| 4808 |
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 |
| 4809 |
a quantifier. */ |
duplicated by a quantifier.*/ |
| 4810 |
|
|
| 4811 |
if (lengthptr != NULL) |
if (lengthptr != NULL) |
| 4812 |
{ |
{ |
| 4816 |
goto FAILED; |
goto FAILED; |
| 4817 |
} |
} |
| 4818 |
*lengthptr += length_prevgroup - 2 - 2*LINK_SIZE; |
*lengthptr += length_prevgroup - 2 - 2*LINK_SIZE; |
| 4819 |
code++; |
*code++ = OP_BRA; |
| 4820 |
PUTINC(code, 0, 1 + LINK_SIZE); |
PUTINC(code, 0, 1 + LINK_SIZE); |
| 4821 |
*code++ = OP_KET; |
*code++ = OP_KET; |
| 4822 |
PUTINC(code, 0, 1 + LINK_SIZE); |
PUTINC(code, 0, 1 + LINK_SIZE); |
| 4823 |
|
break; /* No need to waste time with special character handling */ |
| 4824 |
} |
} |
| 4825 |
|
|
| 4826 |
/* Otherwise update the main code pointer to the end of the group. */ |
/* Otherwise update the main code pointer to the end of the group. */ |
| 4827 |
|
|
| 4828 |
else code = tempcode; |
code = tempcode; |
| 4829 |
|
|
| 4830 |
/* For a DEFINE group, required and first character settings are not |
/* For a DEFINE group, required and first character settings are not |
| 4831 |
relevant. */ |
relevant. */ |