| 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_TYPEUPTO: |
| 1321 |
|
case OP_TYPEMINUPTO: |
| 1322 |
|
case OP_TYPEEXACT: |
| 1323 |
|
case OP_TYPEPOSSTAR: |
| 1324 |
|
case OP_TYPEPOSPLUS: |
| 1325 |
|
case OP_TYPEPOSQUERY: |
| 1326 |
|
case OP_TYPEPOSUPTO: |
| 1327 |
|
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2; |
| 1328 |
|
break; |
| 1329 |
|
} |
| 1330 |
|
|
| 1331 |
|
/* Add in the fixed length from the table */ |
| 1332 |
|
|
| 1333 |
code += _pcre_OP_lengths[c]; |
code += _pcre_OP_lengths[c]; |
| 1334 |
|
|
| 1335 |
|
/* In UTF-8 mode, opcodes that are followed by a character may be followed by |
| 1336 |
|
a multi-byte character. The length in the table is a minimum, so we have to |
| 1337 |
|
arrange to skip the extra bytes. */ |
| 1338 |
|
|
| 1339 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1340 |
if (utf8) switch(c) |
if (utf8) switch(c) |
| 1341 |
{ |
{ |
| 1386 |
register int c = *code; |
register int c = *code; |
| 1387 |
if (c == OP_END) return NULL; |
if (c == OP_END) return NULL; |
| 1388 |
if (c == OP_RECURSE) return code; |
if (c == OP_RECURSE) return code; |
| 1389 |
|
|
| 1390 |
/* XCLASS is used for classes that cannot be represented just by a bit |
/* XCLASS is used for classes that cannot be represented just by a bit |
| 1391 |
map. This includes negated single high-valued characters. The length in |
map. This includes negated single high-valued characters. The length in |
| 1392 |
the table is zero; the actual length is stored in the compiled code. */ |
the table is zero; the actual length is stored in the compiled code. */ |
| 1393 |
|
|
| 1394 |
if (c == OP_XCLASS) code += GET(code, 1); |
if (c == OP_XCLASS) code += GET(code, 1); |
| 1395 |
|
|
| 1396 |
/* 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 |
| 1397 |
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 |
| 1398 |
The length in the table is a minimum, so we have to arrange to skip the extra |
two bytes of parameters. */ |
|
bytes. */ |
|
| 1399 |
|
|
| 1400 |
else |
else |
| 1401 |
{ |
{ |
| 1402 |
|
switch(c) |
| 1403 |
|
{ |
| 1404 |
|
case OP_TYPESTAR: |
| 1405 |
|
case OP_TYPEMINSTAR: |
| 1406 |
|
case OP_TYPEPLUS: |
| 1407 |
|
case OP_TYPEMINPLUS: |
| 1408 |
|
case OP_TYPEQUERY: |
| 1409 |
|
case OP_TYPEMINQUERY: |
| 1410 |
|
case OP_TYPEUPTO: |
| 1411 |
|
case OP_TYPEMINUPTO: |
| 1412 |
|
case OP_TYPEEXACT: |
| 1413 |
|
case OP_TYPEPOSSTAR: |
| 1414 |
|
case OP_TYPEPOSPLUS: |
| 1415 |
|
case OP_TYPEPOSQUERY: |
| 1416 |
|
case OP_TYPEPOSUPTO: |
| 1417 |
|
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2; |
| 1418 |
|
break; |
| 1419 |
|
} |
| 1420 |
|
|
| 1421 |
|
/* Add in the fixed length from the table */ |
| 1422 |
|
|
| 1423 |
code += _pcre_OP_lengths[c]; |
code += _pcre_OP_lengths[c]; |
| 1424 |
|
|
| 1425 |
|
/* In UTF-8 mode, opcodes that are followed by a character may be followed |
| 1426 |
|
by a multi-byte character. The length in the table is a minimum, so we have |
| 1427 |
|
to arrange to skip the extra bytes. */ |
| 1428 |
|
|
| 1429 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 1430 |
if (utf8) switch(c) |
if (utf8) switch(c) |
| 1431 |
{ |
{ |
| 2722 |
else inescq = TRUE; |
else inescq = TRUE; |
| 2723 |
continue; |
continue; |
| 2724 |
} |
} |
| 2725 |
|
else if (-c == ESC_E) continue; /* Ignore orphan \E */ |
| 2726 |
|
|
| 2727 |
if (c < 0) |
if (c < 0) |
| 2728 |
{ |
{ |
| 4797 |
goto FAILED; |
goto FAILED; |
| 4798 |
} |
} |
| 4799 |
|
|
| 4800 |
/* 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, |
| 4801 |
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 |
| 4802 |
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 |
| 4803 |
a quantifier. */ |
duplicated by a quantifier.*/ |
| 4804 |
|
|
| 4805 |
if (lengthptr != NULL) |
if (lengthptr != NULL) |
| 4806 |
{ |
{ |
| 4810 |
goto FAILED; |
goto FAILED; |
| 4811 |
} |
} |
| 4812 |
*lengthptr += length_prevgroup - 2 - 2*LINK_SIZE; |
*lengthptr += length_prevgroup - 2 - 2*LINK_SIZE; |
| 4813 |
code++; |
*code++ = OP_BRA; |
| 4814 |
PUTINC(code, 0, 1 + LINK_SIZE); |
PUTINC(code, 0, 1 + LINK_SIZE); |
| 4815 |
*code++ = OP_KET; |
*code++ = OP_KET; |
| 4816 |
PUTINC(code, 0, 1 + LINK_SIZE); |
PUTINC(code, 0, 1 + LINK_SIZE); |
| 4817 |
|
break; /* No need to waste time with special character handling */ |
| 4818 |
} |
} |
| 4819 |
|
|
| 4820 |
/* Otherwise update the main code pointer to the end of the group. */ |
/* Otherwise update the main code pointer to the end of the group. */ |
| 4821 |
|
|
| 4822 |
else code = tempcode; |
code = tempcode; |
| 4823 |
|
|
| 4824 |
/* For a DEFINE group, required and first character settings are not |
/* For a DEFINE group, required and first character settings are not |
| 4825 |
relevant. */ |
relevant. */ |