| 97 |
|
|
| 98 |
/* The table of operator names. */ |
/* The table of operator names. */ |
| 99 |
|
|
| 100 |
static const char *OP_names[] = { OP_NAME_LIST }; |
static const char *priv_OP_names[] = { OP_NAME_LIST }; |
| 101 |
|
|
| 102 |
/* This table of operator lengths is not actually used by the working code, |
/* This table of operator lengths is not actually used by the working code, |
| 103 |
but its size is needed for a check that ensures it is the correct size for the |
but its size is needed for a check that ensures it is the correct size for the |
| 104 |
number of opcodes (thus catching update omissions). */ |
number of opcodes (thus catching update omissions). */ |
| 105 |
|
|
| 106 |
static const pcre_uint8 OP_lengths_size[] = { OP_LENGTHS }; |
static const pcre_uint8 priv_OP_lengths[] = { OP_LENGTHS }; |
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 300 |
|
|
| 301 |
case OP_TABLE_LENGTH: |
case OP_TABLE_LENGTH: |
| 302 |
case OP_TABLE_LENGTH + |
case OP_TABLE_LENGTH + |
| 303 |
((sizeof(OP_names)/sizeof(const char *) == OP_TABLE_LENGTH) && |
((sizeof(priv_OP_names)/sizeof(const char *) == OP_TABLE_LENGTH) && |
| 304 |
(sizeof(OP_lengths_size) == OP_TABLE_LENGTH)): |
(sizeof(priv_OP_lengths) == OP_TABLE_LENGTH)): |
| 305 |
break; |
break; |
| 306 |
/* ========================================================================== */ |
/* ========================================================================== */ |
| 307 |
|
|
| 308 |
case OP_END: |
case OP_END: |
| 309 |
fprintf(f, " %s\n", OP_names[*code]); |
fprintf(f, " %s\n", priv_OP_names[*code]); |
| 310 |
fprintf(f, "------------------------------------------------------------------\n"); |
fprintf(f, "------------------------------------------------------------------\n"); |
| 311 |
return; |
return; |
| 312 |
|
|
| 338 |
case OP_SCBRAPOS: |
case OP_SCBRAPOS: |
| 339 |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
| 340 |
else fprintf(f, " "); |
else fprintf(f, " "); |
| 341 |
fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE)); |
fprintf(f, "%s %d", priv_OP_names[*code], GET2(code, 1+LINK_SIZE)); |
| 342 |
break; |
break; |
| 343 |
|
|
| 344 |
case OP_BRA: |
case OP_BRA: |
| 361 |
case OP_REVERSE: |
case OP_REVERSE: |
| 362 |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
| 363 |
else fprintf(f, " "); |
else fprintf(f, " "); |
| 364 |
fprintf(f, "%s", OP_names[*code]); |
fprintf(f, "%s", priv_OP_names[*code]); |
| 365 |
break; |
break; |
| 366 |
|
|
| 367 |
case OP_CLOSE: |
case OP_CLOSE: |
| 368 |
fprintf(f, " %s %d", OP_names[*code], GET2(code, 1)); |
fprintf(f, " %s %d", priv_OP_names[*code], GET2(code, 1)); |
| 369 |
break; |
break; |
| 370 |
|
|
| 371 |
case OP_CREF: |
case OP_CREF: |
| 372 |
case OP_NCREF: |
case OP_NCREF: |
| 373 |
fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]); |
fprintf(f, "%3d %s", GET2(code,1), priv_OP_names[*code]); |
| 374 |
break; |
break; |
| 375 |
|
|
| 376 |
case OP_RREF: |
case OP_RREF: |
| 425 |
fprintf(f, " %s ", flag); |
fprintf(f, " %s ", flag); |
| 426 |
if (*code >= OP_TYPESTAR) |
if (*code >= OP_TYPESTAR) |
| 427 |
{ |
{ |
| 428 |
fprintf(f, "%s", OP_names[code[1]]); |
fprintf(f, "%s", priv_OP_names[code[1]]); |
| 429 |
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) |
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) |
| 430 |
{ |
{ |
| 431 |
fprintf(f, " %s ", get_ucpname(code[2], code[3])); |
fprintf(f, " %s ", get_ucpname(code[2], code[3])); |
| 433 |
} |
} |
| 434 |
} |
} |
| 435 |
else extra = print_char(f, code+1, utf); |
else extra = print_char(f, code+1, utf); |
| 436 |
fprintf(f, "%s", OP_names[*code]); |
fprintf(f, "%s", priv_OP_names[*code]); |
| 437 |
break; |
break; |
| 438 |
|
|
| 439 |
case OP_EXACTI: |
case OP_EXACTI: |
| 459 |
case OP_TYPEUPTO: |
case OP_TYPEUPTO: |
| 460 |
case OP_TYPEMINUPTO: |
case OP_TYPEMINUPTO: |
| 461 |
case OP_TYPEPOSUPTO: |
case OP_TYPEPOSUPTO: |
| 462 |
fprintf(f, " %s", OP_names[code[1 + IMM2_SIZE]]); |
fprintf(f, " %s", priv_OP_names[code[1 + IMM2_SIZE]]); |
| 463 |
if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP) |
if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP) |
| 464 |
{ |
{ |
| 465 |
fprintf(f, " %s ", get_ucpname(code[1 + IMM2_SIZE + 1], |
fprintf(f, " %s ", get_ucpname(code[1 + IMM2_SIZE + 1], |
| 509 |
c = code[1]; |
c = code[1]; |
| 510 |
if (PRINTABLE(c)) fprintf(f, " %s [^%c]", flag, c); |
if (PRINTABLE(c)) fprintf(f, " %s [^%c]", flag, c); |
| 511 |
else fprintf(f, " %s [^\\x%02x]", flag, c); |
else fprintf(f, " %s [^\\x%02x]", flag, c); |
| 512 |
fprintf(f, "%s", OP_names[*code]); |
fprintf(f, "%s", priv_OP_names[*code]); |
| 513 |
break; |
break; |
| 514 |
|
|
| 515 |
case OP_NOTEXACTI: |
case OP_NOTEXACTI: |
| 536 |
case OP_RECURSE: |
case OP_RECURSE: |
| 537 |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
| 538 |
else fprintf(f, " "); |
else fprintf(f, " "); |
| 539 |
fprintf(f, "%s", OP_names[*code]); |
fprintf(f, "%s", priv_OP_names[*code]); |
| 540 |
break; |
break; |
| 541 |
|
|
| 542 |
case OP_REFI: |
case OP_REFI: |
| 544 |
/* Fall through */ |
/* Fall through */ |
| 545 |
case OP_REF: |
case OP_REF: |
| 546 |
fprintf(f, " %s \\%d", flag, GET2(code,1)); |
fprintf(f, " %s \\%d", flag, GET2(code,1)); |
| 547 |
ccode = code + PRIV(OP_lengths)[*code]; |
ccode = code + priv_OP_lengths[*code]; |
| 548 |
goto CLASS_REF_REPEAT; |
goto CLASS_REF_REPEAT; |
| 549 |
|
|
| 550 |
case OP_CALLOUT: |
case OP_CALLOUT: |
| 551 |
fprintf(f, " %s %d %d %d", OP_names[*code], code[1], GET(code,2), |
fprintf(f, " %s %d %d %d", priv_OP_names[*code], code[1], GET(code,2), |
| 552 |
GET(code, 2 + LINK_SIZE)); |
GET(code, 2 + LINK_SIZE)); |
| 553 |
break; |
break; |
| 554 |
|
|
| 555 |
case OP_PROP: |
case OP_PROP: |
| 556 |
case OP_NOTPROP: |
case OP_NOTPROP: |
| 557 |
fprintf(f, " %s %s", OP_names[*code], get_ucpname(code[1], code[2])); |
fprintf(f, " %s %s", priv_OP_names[*code], get_ucpname(code[1], code[2])); |
| 558 |
break; |
break; |
| 559 |
|
|
| 560 |
/* OP_XCLASS can only occur in UTF or PCRE16 modes. However, there's no |
/* OP_XCLASS can only occur in UTF or PCRE16 modes. However, there's no |
| 658 |
case OP_CRMINPLUS: |
case OP_CRMINPLUS: |
| 659 |
case OP_CRQUERY: |
case OP_CRQUERY: |
| 660 |
case OP_CRMINQUERY: |
case OP_CRMINQUERY: |
| 661 |
fprintf(f, "%s", OP_names[*ccode]); |
fprintf(f, "%s", priv_OP_names[*ccode]); |
| 662 |
extra += PRIV(OP_lengths)[*ccode]; |
extra += priv_OP_lengths[*ccode]; |
| 663 |
break; |
break; |
| 664 |
|
|
| 665 |
case OP_CRRANGE: |
case OP_CRRANGE: |
| 669 |
if (max == 0) fprintf(f, "{%d,}", min); |
if (max == 0) fprintf(f, "{%d,}", min); |
| 670 |
else fprintf(f, "{%d,%d}", min, max); |
else fprintf(f, "{%d,%d}", min, max); |
| 671 |
if (*ccode == OP_CRMINRANGE) fprintf(f, "?"); |
if (*ccode == OP_CRMINRANGE) fprintf(f, "?"); |
| 672 |
extra += PRIV(OP_lengths)[*ccode]; |
extra += priv_OP_lengths[*ccode]; |
| 673 |
break; |
break; |
| 674 |
|
|
| 675 |
/* Do nothing if it's not a repeat; this code stops picky compilers |
/* Do nothing if it's not a repeat; this code stops picky compilers |
| 685 |
case OP_PRUNE_ARG: |
case OP_PRUNE_ARG: |
| 686 |
case OP_SKIP_ARG: |
case OP_SKIP_ARG: |
| 687 |
case OP_THEN_ARG: |
case OP_THEN_ARG: |
| 688 |
fprintf(f, " %s ", OP_names[*code]); |
fprintf(f, " %s ", priv_OP_names[*code]); |
| 689 |
print_puchar(f, code + 2); |
print_puchar(f, code + 2); |
| 690 |
extra += code[1]; |
extra += code[1]; |
| 691 |
break; |
break; |
| 692 |
|
|
| 693 |
case OP_THEN: |
case OP_THEN: |
| 694 |
fprintf(f, " %s", OP_names[*code]); |
fprintf(f, " %s", priv_OP_names[*code]); |
| 695 |
break; |
break; |
| 696 |
|
|
| 697 |
case OP_CIRCM: |
case OP_CIRCM: |
| 702 |
/* Anything else is just an item with no data, but possibly a flag. */ |
/* Anything else is just an item with no data, but possibly a flag. */ |
| 703 |
|
|
| 704 |
default: |
default: |
| 705 |
fprintf(f, " %s %s", flag, OP_names[*code]); |
fprintf(f, " %s %s", flag, priv_OP_names[*code]); |
| 706 |
break; |
break; |
| 707 |
} |
} |
| 708 |
|
|
| 709 |
code += PRIV(OP_lengths)[*code] + extra; |
code += priv_OP_lengths[*code] + extra; |
| 710 |
fprintf(f, "\n"); |
fprintf(f, "\n"); |
| 711 |
} |
} |
| 712 |
} |
} |