| 582 |
#endif |
#endif |
| 583 |
|
|
| 584 |
|
|
|
/* These are the public options that can change during matching. */ |
|
|
|
|
|
#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL) |
|
|
|
|
| 585 |
/* Private flags containing information about the compiled regex. They used to |
/* Private flags containing information about the compiled regex. They used to |
| 586 |
live at the top end of the options word, but that got almost full, so now they |
live at the top end of the options word, but that got almost full, so now they |
| 587 |
are in a 16-bit flags word. From release 8.00, PCRE_NOPARTIAL is unused, as |
are in a 16-bit flags word. From release 8.00, PCRE_NOPARTIAL is unused, as |
| 1321 |
|
|
| 1322 |
/* The following sets of 13 opcodes must always be kept in step because |
/* The following sets of 13 opcodes must always be kept in step because |
| 1323 |
the offset from the first one is used to generate the others. */ |
the offset from the first one is used to generate the others. */ |
| 1324 |
|
|
| 1325 |
/**** Single characters, caseful, must precede the caseless ones ****/ |
/**** Single characters, caseful, must precede the caseless ones ****/ |
| 1326 |
|
|
| 1327 |
OP_STAR, /* 33 The maximizing and minimizing versions of */ |
OP_STAR, /* 33 The maximizing and minimizing versions of */ |
| 1341 |
OP_POSUPTO, /* 45 Possessified upto, caseful */ |
OP_POSUPTO, /* 45 Possessified upto, caseful */ |
| 1342 |
|
|
| 1343 |
/**** Single characters, caseless, must follow the caseful ones */ |
/**** Single characters, caseless, must follow the caseful ones */ |
| 1344 |
|
|
| 1345 |
OP_STARI, /* 46 */ |
OP_STARI, /* 46 */ |
| 1346 |
OP_MINSTARI, /* 47 */ |
OP_MINSTARI, /* 47 */ |
| 1347 |
OP_PLUSI, /* 48 */ |
OP_PLUSI, /* 48 */ |
| 1378 |
OP_NOTPOSUPTO, /* 71 */ |
OP_NOTPOSUPTO, /* 71 */ |
| 1379 |
|
|
| 1380 |
/**** Negated single character, caseless; must follow the caseful ones ****/ |
/**** Negated single character, caseless; must follow the caseful ones ****/ |
| 1381 |
|
|
| 1382 |
OP_NOTSTARI, /* 72 */ |
OP_NOTSTARI, /* 72 */ |
| 1383 |
OP_NOTMINSTARI, /* 73 */ |
OP_NOTMINSTARI, /* 73 */ |
| 1384 |
OP_NOTPLUSI, /* 74 */ |
OP_NOTPLUSI, /* 74 */ |
| 1396 |
OP_NOTPOSUPTOI, /* 84 */ |
OP_NOTPOSUPTOI, /* 84 */ |
| 1397 |
|
|
| 1398 |
/**** Character types ****/ |
/**** Character types ****/ |
| 1399 |
|
|
| 1400 |
OP_TYPESTAR, /* 85 The maximizing and minimizing versions of */ |
OP_TYPESTAR, /* 85 The maximizing and minimizing versions of */ |
| 1401 |
OP_TYPEMINSTAR, /* 86 these six opcodes must come in pairs, with */ |
OP_TYPEMINSTAR, /* 86 these six opcodes must come in pairs, with */ |
| 1402 |
OP_TYPEPLUS, /* 87 the minimizing one second. These codes must */ |
OP_TYPEPLUS, /* 87 the minimizing one second. These codes must */ |
| 1414 |
OP_TYPEPOSUPTO, /* 97 */ |
OP_TYPEPOSUPTO, /* 97 */ |
| 1415 |
|
|
| 1416 |
/* These are used for character classes and back references; only the |
/* These are used for character classes and back references; only the |
| 1417 |
first six are the same as the sets above. */ |
first six are the same as the sets above. */ |
| 1418 |
|
|
| 1419 |
OP_CRSTAR, /* 98 The maximizing and minimizing versions of */ |
OP_CRSTAR, /* 98 The maximizing and minimizing versions of */ |
| 1420 |
OP_CRMINSTAR, /* 99 all these opcodes must come in pairs, with */ |
OP_CRMINSTAR, /* 99 all these opcodes must come in pairs, with */ |
| 1443 |
OP_KET, /* 114 End of group that doesn't have an unbounded repeat */ |
OP_KET, /* 114 End of group that doesn't have an unbounded repeat */ |
| 1444 |
OP_KETRMAX, /* 115 These two must remain together and in this */ |
OP_KETRMAX, /* 115 These two must remain together and in this */ |
| 1445 |
OP_KETRMIN, /* 116 order. They are for groups the repeat for ever. */ |
OP_KETRMIN, /* 116 order. They are for groups the repeat for ever. */ |
| 1446 |
|
OP_KETRPOS, /* 117 Possessive unlimited repeat. */ |
| 1447 |
|
|
| 1448 |
/* The assertions must come before BRA, CBRA, ONCE, and COND.*/ |
/* The assertions must come before BRA, CBRA, ONCE, and COND.*/ |
| 1449 |
|
|
| 1450 |
OP_ASSERT, /* 117 Positive lookahead */ |
OP_ASSERT, /* 118 Positive lookahead */ |
| 1451 |
OP_ASSERT_NOT, /* 118 Negative lookahead */ |
OP_ASSERT_NOT, /* 119 Negative lookahead */ |
| 1452 |
OP_ASSERTBACK, /* 119 Positive lookbehind */ |
OP_ASSERTBACK, /* 120 Positive lookbehind */ |
| 1453 |
OP_ASSERTBACK_NOT, /* 120 Negative lookbehind */ |
OP_ASSERTBACK_NOT, /* 121 Negative lookbehind */ |
| 1454 |
OP_REVERSE, /* 121 Move pointer back - used in lookbehind assertions */ |
OP_REVERSE, /* 122 Move pointer back - used in lookbehind assertions */ |
| 1455 |
|
|
| 1456 |
/* ONCE, BRA, CBRA, and COND must come after the assertions, with ONCE first, |
/* ONCE, BRA, BRAPOS, CBRA, CBRAPOS, and COND must come after the assertions, |
| 1457 |
as there's a test for >= ONCE for a subpattern that isn't an assertion. */ |
with ONCE first, as there's a test for >= ONCE for a subpattern that isn't an |
| 1458 |
|
assertion. The POS versions must immediately follow the non-POS versions in |
| 1459 |
OP_ONCE, /* 122 Atomic group */ |
each case. */ |
| 1460 |
OP_BRA, /* 123 Start of non-capturing bracket */ |
|
| 1461 |
OP_CBRA, /* 124 Start of capturing bracket */ |
OP_ONCE, /* 123 Atomic group */ |
| 1462 |
OP_COND, /* 125 Conditional group */ |
OP_BRA, /* 124 Start of non-capturing bracket */ |
| 1463 |
|
OP_BRAPOS, /* 125 Ditto, with unlimited, possessive repeat */ |
| 1464 |
|
OP_CBRA, /* 126 Start of capturing bracket */ |
| 1465 |
|
OP_CBRAPOS, /* 127 Ditto, with unlimited, possessive repeat */ |
| 1466 |
|
OP_COND, /* 128 Conditional group */ |
| 1467 |
|
|
| 1468 |
/* These three must follow the previous three, in the same order. There's a |
/* These five must follow the previous five, in the same order. There's a |
| 1469 |
check for >= SBRA to distinguish the two sets. */ |
check for >= SBRA to distinguish the two sets. */ |
| 1470 |
|
|
| 1471 |
OP_SBRA, /* 126 Start of non-capturing bracket, check empty */ |
OP_SBRA, /* 129 Start of non-capturing bracket, check empty */ |
| 1472 |
OP_SCBRA, /* 127 Start of capturing bracket, check empty */ |
OP_SBRAPOS, /* 130 Ditto, with unlimited, possessive repeat */ |
| 1473 |
OP_SCOND, /* 128 Conditional group, check empty */ |
OP_SCBRA, /* 131 Start of capturing bracket, check empty */ |
| 1474 |
|
OP_SCBRAPOS, /* 132 Ditto, with unlimited, possessive repeat */ |
| 1475 |
|
OP_SCOND, /* 133 Conditional group, check empty */ |
| 1476 |
|
|
| 1477 |
/* The next two pairs must (respectively) be kept together. */ |
/* The next two pairs must (respectively) be kept together. */ |
| 1478 |
|
|
| 1479 |
OP_CREF, /* 129 Used to hold a capture number as condition */ |
OP_CREF, /* 134 Used to hold a capture number as condition */ |
| 1480 |
OP_NCREF, /* 130 Same, but generated by a name reference*/ |
OP_NCREF, /* 135 Same, but generated by a name reference*/ |
| 1481 |
OP_RREF, /* 131 Used to hold a recursion number as condition */ |
OP_RREF, /* 136 Used to hold a recursion number as condition */ |
| 1482 |
OP_NRREF, /* 132 Same, but generated by a name reference*/ |
OP_NRREF, /* 137 Same, but generated by a name reference*/ |
| 1483 |
OP_DEF, /* 133 The DEFINE condition */ |
OP_DEF, /* 138 The DEFINE condition */ |
| 1484 |
|
|
| 1485 |
OP_BRAZERO, /* 134 These two must remain together and in this */ |
OP_BRAZERO, /* 139 These two must remain together and in this */ |
| 1486 |
OP_BRAMINZERO, /* 135 order. */ |
OP_BRAMINZERO, /* 140 order. */ |
| 1487 |
|
OP_BRAPOSZERO, /* 141 */ |
| 1488 |
|
|
| 1489 |
/* These are backtracking control verbs */ |
/* These are backtracking control verbs */ |
| 1490 |
|
|
| 1491 |
OP_MARK, /* 136 always has an argument */ |
OP_MARK, /* 142 always has an argument */ |
| 1492 |
OP_PRUNE, /* 137 */ |
OP_PRUNE, /* 143 */ |
| 1493 |
OP_PRUNE_ARG, /* 138 same, but with argument */ |
OP_PRUNE_ARG, /* 144 same, but with argument */ |
| 1494 |
OP_SKIP, /* 139 */ |
OP_SKIP, /* 145 */ |
| 1495 |
OP_SKIP_ARG, /* 140 same, but with argument */ |
OP_SKIP_ARG, /* 146 same, but with argument */ |
| 1496 |
OP_THEN, /* 141 */ |
OP_THEN, /* 147 */ |
| 1497 |
OP_THEN_ARG, /* 142 same, but with argument */ |
OP_THEN_ARG, /* 148 same, but with argument */ |
| 1498 |
OP_COMMIT, /* 143 */ |
OP_COMMIT, /* 149 */ |
| 1499 |
|
|
| 1500 |
/* These are forced failure and success verbs */ |
/* These are forced failure and success verbs */ |
| 1501 |
|
|
| 1502 |
OP_FAIL, /* 144 */ |
OP_FAIL, /* 150 */ |
| 1503 |
OP_ACCEPT, /* 145 */ |
OP_ACCEPT, /* 151 */ |
| 1504 |
OP_CLOSE, /* 146 Used before OP_ACCEPT to close open captures */ |
OP_CLOSE, /* 152 Used before OP_ACCEPT to close open captures */ |
| 1505 |
|
|
| 1506 |
/* This is used to skip a subpattern with a {0} quantifier */ |
/* This is used to skip a subpattern with a {0} quantifier */ |
| 1507 |
|
|
| 1508 |
OP_SKIPZERO, /* 147 */ |
OP_SKIPZERO, /* 153 */ |
| 1509 |
|
|
| 1510 |
/* This is not an opcode, but is used to check that tables indexed by opcode |
/* This is not an opcode, but is used to check that tables indexed by opcode |
| 1511 |
are the correct length, in order to catch updating errors - there have been |
are the correct length, in order to catch updating errors - there have been |
| 1521 |
|
|
| 1522 |
/* This macro defines textual names for all the opcodes. These are used only |
/* This macro defines textual names for all the opcodes. These are used only |
| 1523 |
for debugging, and some of them are only partial names. The macro is referenced |
for debugging, and some of them are only partial names. The macro is referenced |
| 1524 |
only in pcre_printint.c, which fills out the full names in many cases (and in |
only in pcre_printint.c, which fills out the full names in many cases (and in |
| 1525 |
some cases doesn't actually use these names at all). */ |
some cases doesn't actually use these names at all). */ |
| 1526 |
|
|
| 1527 |
#define OP_NAME_LIST \ |
#define OP_NAME_LIST \ |
| 1547 |
"*", "*?", "+", "+?", "?", "??", "{", "{", \ |
"*", "*?", "+", "+?", "?", "??", "{", "{", \ |
| 1548 |
"class", "nclass", "xclass", "Ref", "Refi", \ |
"class", "nclass", "xclass", "Ref", "Refi", \ |
| 1549 |
"Recurse", "Callout", \ |
"Recurse", "Callout", \ |
| 1550 |
"Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", \ |
"Alt", "Ket", "KetRmax", "KetRmin", "KetRpos", \ |
| 1551 |
"AssertB", "AssertB not", "Reverse", \ |
"Assert", "Assert not", "AssertB", "AssertB not", "Reverse", \ |
| 1552 |
"Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond", \ |
"Once", \ |
| 1553 |
|
"Bra", "BraPos", "CBra", "CBraPos", \ |
| 1554 |
|
"Cond", \ |
| 1555 |
|
"SBra", "SBraPos", "SCBra", "SCBraPos", \ |
| 1556 |
|
"SCond", \ |
| 1557 |
"Cond ref", "Cond nref", "Cond rec", "Cond nrec", "Cond def", \ |
"Cond ref", "Cond nref", "Cond rec", "Cond nrec", "Cond def", \ |
| 1558 |
"Brazero", "Braminzero", \ |
"Brazero", "Braminzero", "Braposzero", \ |
| 1559 |
"*MARK", "*PRUNE", "*PRUNE", "*SKIP", "*SKIP", \ |
"*MARK", "*PRUNE", "*PRUNE", "*SKIP", "*SKIP", \ |
| 1560 |
"*THEN", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT", \ |
"*THEN", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT", \ |
| 1561 |
"Close", "Skip zero" |
"Close", "Skip zero" |
| 1615 |
1+LINK_SIZE, /* Ket */ \ |
1+LINK_SIZE, /* Ket */ \ |
| 1616 |
1+LINK_SIZE, /* KetRmax */ \ |
1+LINK_SIZE, /* KetRmax */ \ |
| 1617 |
1+LINK_SIZE, /* KetRmin */ \ |
1+LINK_SIZE, /* KetRmin */ \ |
| 1618 |
|
1+LINK_SIZE, /* KetRpos */ \ |
| 1619 |
1+LINK_SIZE, /* Assert */ \ |
1+LINK_SIZE, /* Assert */ \ |
| 1620 |
1+LINK_SIZE, /* Assert not */ \ |
1+LINK_SIZE, /* Assert not */ \ |
| 1621 |
1+LINK_SIZE, /* Assert behind */ \ |
1+LINK_SIZE, /* Assert behind */ \ |
| 1623 |
1+LINK_SIZE, /* Reverse */ \ |
1+LINK_SIZE, /* Reverse */ \ |
| 1624 |
1+LINK_SIZE, /* ONCE */ \ |
1+LINK_SIZE, /* ONCE */ \ |
| 1625 |
1+LINK_SIZE, /* BRA */ \ |
1+LINK_SIZE, /* BRA */ \ |
| 1626 |
|
1+LINK_SIZE, /* BRAPOS */ \ |
| 1627 |
3+LINK_SIZE, /* CBRA */ \ |
3+LINK_SIZE, /* CBRA */ \ |
| 1628 |
|
3+LINK_SIZE, /* CBRAPOS */ \ |
| 1629 |
1+LINK_SIZE, /* COND */ \ |
1+LINK_SIZE, /* COND */ \ |
| 1630 |
1+LINK_SIZE, /* SBRA */ \ |
1+LINK_SIZE, /* SBRA */ \ |
| 1631 |
|
1+LINK_SIZE, /* SBRAPOS */ \ |
| 1632 |
3+LINK_SIZE, /* SCBRA */ \ |
3+LINK_SIZE, /* SCBRA */ \ |
| 1633 |
|
3+LINK_SIZE, /* SCBRAPOS */ \ |
| 1634 |
1+LINK_SIZE, /* SCOND */ \ |
1+LINK_SIZE, /* SCOND */ \ |
| 1635 |
3, 3, /* CREF, NCREF */ \ |
3, 3, /* CREF, NCREF */ \ |
| 1636 |
3, 3, /* RREF, NRREF */ \ |
3, 3, /* RREF, NRREF */ \ |
| 1637 |
1, /* DEF */ \ |
1, /* DEF */ \ |
| 1638 |
1, 1, /* BRAZERO, BRAMINZERO */ \ |
1, 1, 1, /* BRAZERO, BRAMINZERO, BRAPOSZERO */ \ |
| 1639 |
3, 1, 3, /* MARK, PRUNE, PRUNE_ARG */ \ |
3, 1, 3, /* MARK, PRUNE, PRUNE_ARG */ \ |
| 1640 |
1, 3, /* SKIP, SKIP_ARG */ \ |
1, 3, /* SKIP, SKIP_ARG */ \ |
| 1641 |
1+LINK_SIZE, 3+LINK_SIZE, /* THEN, THEN_ARG */ \ |
1+LINK_SIZE, 3+LINK_SIZE, /* THEN, THEN_ARG */ \ |
| 1816 |
int end_offset_top; /* Highwater mark at end of match */ |
int end_offset_top; /* Highwater mark at end of match */ |
| 1817 |
int capture_last; /* Most recent capture number */ |
int capture_last; /* Most recent capture number */ |
| 1818 |
int start_offset; /* The start offset value */ |
int start_offset; /* The start offset value */ |
| 1819 |
|
int match_function_type; /* Set for certain special calls of MATCH() */ |
| 1820 |
eptrblock *eptrchain; /* Chain of eptrblocks for tail recursions */ |
eptrblock *eptrchain; /* Chain of eptrblocks for tail recursions */ |
| 1821 |
int eptrn; /* Next free eptrblock */ |
int eptrn; /* Next free eptrblock */ |
| 1822 |
recursion_info *recursive; /* Linked list of recursion data */ |
recursion_info *recursive; /* Linked list of recursion data */ |