| 6 |
and semantics are as close as possible to those of the Perl 5 language. |
and semantics are as close as possible to those of the Perl 5 language. |
| 7 |
|
|
| 8 |
Written by Philip Hazel |
Written by Philip Hazel |
| 9 |
Copyright (c) 1997-2007 University of Cambridge |
Copyright (c) 1997-2009 University of Cambridge |
| 10 |
|
|
| 11 |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
| 12 |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
| 54 |
(even without the use of locales) and we want the output always to be the same, |
(even without the use of locales) and we want the output always to be the same, |
| 55 |
for testing purposes. This macro is used in pcretest as well as in this file. */ |
for testing purposes. This macro is used in pcretest as well as in this file. */ |
| 56 |
|
|
| 57 |
|
#ifdef EBCDIC |
| 58 |
|
#define PRINTABLE(c) ((c) >= 64 && (c) < 255) |
| 59 |
|
#else |
| 60 |
#define PRINTABLE(c) ((c) >= 32 && (c) < 127) |
#define PRINTABLE(c) ((c) >= 32 && (c) < 127) |
| 61 |
|
#endif |
| 62 |
|
|
| 63 |
/* The table of operator names. */ |
/* The table of operator names. */ |
| 64 |
|
|
| 126 |
{ |
{ |
| 127 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
| 128 |
int i; |
int i; |
| 129 |
for (i = _pcre_utt_size; i >= 0; i--) |
for (i = _pcre_utt_size - 1; i >= 0; i--) |
| 130 |
{ |
{ |
| 131 |
if (ptype == _pcre_utt[i].type && pvalue == _pcre_utt[i].value) break; |
if (ptype == _pcre_utt[i].type && pvalue == _pcre_utt[i].value) break; |
| 132 |
} |
} |
| 133 |
return (i >= 0)? _pcre_utt[i].name : "??"; |
return (i >= 0)? _pcre_utt_names + _pcre_utt[i].name_offset : "??"; |
| 134 |
#else |
#else |
| 135 |
/* It gets harder and harder to shut off unwanted compiler warnings. */ |
/* It gets harder and harder to shut off unwanted compiler warnings. */ |
| 136 |
ptype = ptype * pvalue; |
ptype = ptype * pvalue; |
| 146 |
|
|
| 147 |
/* Make this function work for a regex with integers either byte order. |
/* Make this function work for a regex with integers either byte order. |
| 148 |
However, we assume that what we are passed is a compiled regex. The |
However, we assume that what we are passed is a compiled regex. The |
| 149 |
print_lengths flag controls whether offsets and lengths of items are printed. |
print_lengths flag controls whether offsets and lengths of items are printed. |
| 150 |
They can be turned off from pcretest so that automatic tests on bytecode can be |
They can be turned off from pcretest so that automatic tests on bytecode can be |
| 151 |
written that do not depend on the value of LINK_SIZE. */ |
written that do not depend on the value of LINK_SIZE. */ |
| 152 |
|
|
| 185 |
if (print_lengths) |
if (print_lengths) |
| 186 |
fprintf(f, "%3d ", (int)(code - codestart)); |
fprintf(f, "%3d ", (int)(code - codestart)); |
| 187 |
else |
else |
| 188 |
fprintf(f, " "); |
fprintf(f, " "); |
| 189 |
|
|
| 190 |
switch(*code) |
switch(*code) |
| 191 |
{ |
{ |
| 223 |
case OP_CBRA: |
case OP_CBRA: |
| 224 |
case OP_SCBRA: |
case OP_SCBRA: |
| 225 |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
| 226 |
else fprintf(f, " "); |
else fprintf(f, " "); |
| 227 |
fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE)); |
fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE)); |
| 228 |
break; |
break; |
| 229 |
|
|
| 242 |
case OP_SCOND: |
case OP_SCOND: |
| 243 |
case OP_REVERSE: |
case OP_REVERSE: |
| 244 |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); |
| 245 |
else fprintf(f, " "); |
else fprintf(f, " "); |
| 246 |
fprintf(f, "%s", OP_names[*code]); |
fprintf(f, "%s", OP_names[*code]); |
| 247 |
break; |
break; |
| 248 |
|
|
| 360 |
|
|
| 361 |
case OP_RECURSE: |
case OP_RECURSE: |
| 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", OP_names[*code]); |
| 365 |
break; |
break; |
| 366 |
|
|