| 101 |
*************************************************/ |
*************************************************/ |
| 102 |
|
|
| 103 |
static const char * |
static const char * |
| 104 |
get_ucpname(int property) |
get_ucpname(int ptype, int pvalue) |
| 105 |
{ |
{ |
| 106 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 107 |
int i; |
int i; |
| 108 |
for (i = _pcre_utt_size; i >= 0; i--) |
for (i = _pcre_utt_size; i >= 0; i--) |
| 109 |
{ |
{ |
| 110 |
if (property == _pcre_utt[i].value) break; |
if (ptype == _pcre_utt[i].type && pvalue == _pcre_utt[i].value) break; |
| 111 |
} |
} |
| 112 |
return (i >= 0)? _pcre_utt[i].name : "??"; |
return (i >= 0)? _pcre_utt[i].name : "??"; |
| 113 |
#else |
#else |
| 114 |
return "??"; |
/* It gets harder and harder to shut off unwanted compiler warnings. */ |
| 115 |
|
ptype = ptype * pvalue; |
| 116 |
|
return (ptype == pvalue)? "??" : "??"; |
| 117 |
#endif |
#endif |
| 118 |
} |
} |
| 119 |
|
|
| 182 |
break; |
break; |
| 183 |
|
|
| 184 |
case OP_CHAR: |
case OP_CHAR: |
| 185 |
|
fprintf(f, " "); |
| 186 |
|
do |
| 187 |
{ |
{ |
| 188 |
fprintf(f, " "); |
code++; |
| 189 |
do |
code += 1 + print_char(f, code, utf8); |
|
{ |
|
|
code++; |
|
|
code += 1 + print_char(f, code, utf8); |
|
|
} |
|
|
while (*code == OP_CHAR); |
|
|
fprintf(f, "\n"); |
|
|
continue; |
|
| 190 |
} |
} |
| 191 |
break; |
while (*code == OP_CHAR); |
| 192 |
|
fprintf(f, "\n"); |
| 193 |
|
continue; |
| 194 |
|
|
| 195 |
case OP_CHARNC: |
case OP_CHARNC: |
| 196 |
|
fprintf(f, " NC "); |
| 197 |
|
do |
| 198 |
{ |
{ |
| 199 |
fprintf(f, " NC "); |
code++; |
| 200 |
do |
code += 1 + print_char(f, code, utf8); |
|
{ |
|
|
code++; |
|
|
code += 1 + print_char(f, code, utf8); |
|
|
} |
|
|
while (*code == OP_CHARNC); |
|
|
fprintf(f, "\n"); |
|
|
continue; |
|
| 201 |
} |
} |
| 202 |
break; |
while (*code == OP_CHARNC); |
| 203 |
|
fprintf(f, "\n"); |
| 204 |
|
continue; |
| 205 |
|
|
| 206 |
case OP_KETRMAX: |
case OP_KETRMAX: |
| 207 |
case OP_KETRMIN: |
case OP_KETRMIN: |
| 246 |
fprintf(f, "%s", OP_names[code[1]]); |
fprintf(f, "%s", OP_names[code[1]]); |
| 247 |
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) |
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) |
| 248 |
{ |
{ |
| 249 |
fprintf(f, " %s ", get_ucpname(code[2])); |
fprintf(f, " %s ", get_ucpname(code[2], code[3])); |
| 250 |
extra = 1; |
extra = 2; |
| 251 |
} |
} |
| 252 |
} |
} |
| 253 |
else extra = print_char(f, code+1, utf8); |
else extra = print_char(f, code+1, utf8); |
| 271 |
fprintf(f, " %s", OP_names[code[3]]); |
fprintf(f, " %s", OP_names[code[3]]); |
| 272 |
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) |
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) |
| 273 |
{ |
{ |
| 274 |
fprintf(f, " %s ", get_ucpname(code[4])); |
fprintf(f, " %s ", get_ucpname(code[4], code[5])); |
| 275 |
extra = 1; |
extra = 2; |
| 276 |
} |
} |
| 277 |
fprintf(f, "{"); |
fprintf(f, "{"); |
| 278 |
if (*code != OP_TYPEEXACT) fprintf(f, "0,"); |
if (*code != OP_TYPEEXACT) fprintf(f, "0,"); |
| 322 |
|
|
| 323 |
case OP_PROP: |
case OP_PROP: |
| 324 |
case OP_NOTPROP: |
case OP_NOTPROP: |
| 325 |
fprintf(f, " %s %s", OP_names[*code], get_ucpname(code[1])); |
fprintf(f, " %s %s", OP_names[*code], get_ucpname(code[1], code[2])); |
| 326 |
break; |
break; |
| 327 |
|
|
| 328 |
/* OP_XCLASS can only occur in UTF-8 mode. However, there's no harm in |
/* OP_XCLASS can only occur in UTF-8 mode. However, there's no harm in |
| 385 |
{ |
{ |
| 386 |
if (ch == XCL_PROP) |
if (ch == XCL_PROP) |
| 387 |
{ |
{ |
| 388 |
fprintf(f, "\\p{%s}", get_ucpname(*ccode++)); |
int ptype = *ccode++; |
| 389 |
|
int pvalue = *ccode++; |
| 390 |
|
fprintf(f, "\\p{%s}", get_ucpname(ptype, pvalue)); |
| 391 |
} |
} |
| 392 |
else if (ch == XCL_NOTPROP) |
else if (ch == XCL_NOTPROP) |
| 393 |
{ |
{ |
| 394 |
fprintf(f, "\\P{%s}", get_ucpname(*ccode++)); |
int ptype = *ccode++; |
| 395 |
|
int pvalue = *ccode++; |
| 396 |
|
fprintf(f, "\\P{%s}", get_ucpname(ptype, pvalue)); |
| 397 |
} |
} |
| 398 |
else |
else |
| 399 |
{ |
{ |
| 435 |
if (*ccode == OP_CRMINRANGE) fprintf(f, "?"); |
if (*ccode == OP_CRMINRANGE) fprintf(f, "?"); |
| 436 |
extra += _pcre_OP_lengths[*ccode]; |
extra += _pcre_OP_lengths[*ccode]; |
| 437 |
break; |
break; |
| 438 |
|
|
| 439 |
|
/* Do nothing if it's not a repeat; this code stops picky compilers |
| 440 |
|
warning about the lack of a default code path. */ |
| 441 |
|
|
| 442 |
|
default: |
| 443 |
|
break; |
| 444 |
} |
} |
| 445 |
} |
} |
| 446 |
break; |
break; |