208 |
"magic number missing", |
"magic number missing", |
209 |
"unknown opcode - pattern overwritten?", |
"unknown opcode - pattern overwritten?", |
210 |
"no more memory", |
"no more memory", |
211 |
NULL, /* never returned by pcre_exec() or pcre_dfa_exec() */ |
NULL, /* never returned by pcre_exec() or pcre_dfa_exec() */ |
212 |
"match limit exceeded", |
"match limit exceeded", |
213 |
"callout error code", |
"callout error code", |
214 |
NULL, /* BADUTF8 is handled specially */ |
NULL, /* BADUTF8 is handled specially */ |
221 |
"backreference condition or recursion test not supported for DFA matching", |
"backreference condition or recursion test not supported for DFA matching", |
222 |
"match limit not supported for DFA matching", |
"match limit not supported for DFA matching", |
223 |
"workspace size exceeded in DFA matching", |
"workspace size exceeded in DFA matching", |
224 |
"too much recursion for DFA matching", |
"too much recursion for DFA matching", |
225 |
"recursion limit exceeded", |
"recursion limit exceeded", |
226 |
"not used - internal error", |
"not used - internal error", |
227 |
"invalid combination of newline options", |
"invalid combination of newline options", |
229 |
NULL, /* SHORTUTF8 is handled specially */ |
NULL, /* SHORTUTF8 is handled specially */ |
230 |
"nested recursion at the same subject position" |
"nested recursion at the same subject position" |
231 |
}; |
}; |
232 |
|
|
233 |
|
|
234 |
/************************************************* |
/************************************************* |
235 |
* Alternate character tables * |
* Alternate character tables * |
961 |
fprintf(outfile, "\n"); |
fprintf(outfile, "\n"); |
962 |
first_callout = 0; |
first_callout = 0; |
963 |
|
|
964 |
if (cb->mark != last_callout_mark) |
if (cb->mark != last_callout_mark) |
965 |
{ |
{ |
966 |
fprintf(outfile, "Latest Mark: %s\n", |
fprintf(outfile, "Latest Mark: %s\n", |
967 |
(cb->mark == NULL)? "<unset>" : (char *)(cb->mark)); |
(cb->mark == NULL)? "<unset>" : (char *)(cb->mark)); |
968 |
last_callout_mark = cb->mark; |
last_callout_mark = cb->mark; |
969 |
} |
} |
970 |
|
|
971 |
if (cb->callout_data != NULL) |
if (cb->callout_data != NULL) |
972 |
{ |
{ |
1273 |
unsigned char *endptr; |
unsigned char *endptr; |
1274 |
|
|
1275 |
if (strcmp(argv[op], "-m") == 0) showstore = 1; |
if (strcmp(argv[op], "-m") == 0) showstore = 1; |
1276 |
else if (strcmp(argv[op], "-s") == 0) force_study = 1; |
else if (strcmp(argv[op], "-s") == 0) force_study = 1; |
1277 |
else if (strcmp(argv[op], "-q") == 0) quiet = 1; |
else if (strcmp(argv[op], "-q") == 0) quiet = 1; |
1278 |
else if (strcmp(argv[op], "-b") == 0) debug = 1; |
else if (strcmp(argv[op], "-b") == 0) debug = 1; |
1279 |
else if (strcmp(argv[op], "-i") == 0) showinfo = 1; |
else if (strcmp(argv[op], "-i") == 0) showinfo = 1; |
1443 |
const unsigned char *tables = NULL; |
const unsigned char *tables = NULL; |
1444 |
unsigned long int true_size, true_study_size = 0; |
unsigned long int true_size, true_study_size = 0; |
1445 |
size_t size, regex_gotten_store; |
size_t size, regex_gotten_store; |
1446 |
int do_allcaps = 0; |
int do_allcaps = 0; |
1447 |
int do_mark = 0; |
int do_mark = 0; |
1448 |
int do_study = 0; |
int do_study = 0; |
1449 |
int no_force_study = 0; |
int no_force_study = 0; |
1450 |
int do_debug = debug; |
int do_debug = debug; |
1451 |
int do_G = 0; |
int do_G = 0; |
1452 |
int do_g = 0; |
int do_g = 0; |
1619 |
case 'x': options |= PCRE_EXTENDED; break; |
case 'x': options |= PCRE_EXTENDED; break; |
1620 |
|
|
1621 |
case '+': |
case '+': |
1622 |
if (do_showrest) do_showcaprest = 1; else do_showrest = 1; |
if (do_showrest) do_showcaprest = 1; else do_showrest = 1; |
1623 |
break; |
break; |
1624 |
|
|
1625 |
case '=': do_allcaps = 1; break; |
case '=': do_allcaps = 1; break; |
1626 |
case 'A': options |= PCRE_ANCHORED; break; |
case 'A': options |= PCRE_ANCHORED; break; |
1627 |
case 'B': do_debug = 1; break; |
case 'B': do_debug = 1; break; |
1628 |
case 'C': options |= PCRE_AUTO_CALLOUT; break; |
case 'C': options |= PCRE_AUTO_CALLOUT; break; |
1640 |
case 'P': do_posix = 1; break; |
case 'P': do_posix = 1; break; |
1641 |
#endif |
#endif |
1642 |
|
|
1643 |
case 'S': |
case 'S': |
1644 |
if (do_study == 0) do_study = 1; else |
if (do_study == 0) do_study = 1; else |
1645 |
{ |
{ |
1646 |
do_study = 0; |
do_study = 0; |
1647 |
no_force_study = 1; |
no_force_study = 1; |
1648 |
} |
} |
1649 |
break; |
break; |
1650 |
|
|
1651 |
case 'U': options |= PCRE_UNGREEDY; break; |
case 'U': options |= PCRE_UNGREEDY; break; |
1832 |
regex_gotten_store = gotten_store; |
regex_gotten_store = gotten_store; |
1833 |
|
|
1834 |
/* If -s or /S was present, study the regex to generate additional info to |
/* If -s or /S was present, study the regex to generate additional info to |
1835 |
help with the matching, unless the pattern has the SS option, which |
help with the matching, unless the pattern has the SS option, which |
1836 |
suppresses the effect of /S (used for a few test patterns where studying is |
suppresses the effect of /S (used for a few test patterns where studying is |
1837 |
never sensible). */ |
never sensible). */ |
1838 |
|
|
2074 |
/* Don't output study size; at present it is in any case a fixed |
/* Don't output study size; at present it is in any case a fixed |
2075 |
value, but it varies, depending on the computer architecture, and |
value, but it varies, depending on the computer architecture, and |
2076 |
so messes up the test suite. (And with the /F option, it might be |
so messes up the test suite. (And with the /F option, it might be |
2077 |
flipped.) If study was forced by an external -s, don't show this |
flipped.) If study was forced by an external -s, don't show this |
2078 |
information unless -i or -d was also present. This means that, except |
information unless -i or -d was also present. This means that, except |
2079 |
when auto-callouts are involved, the output from runs with and without |
when auto-callouts are involved, the output from runs with and without |
2080 |
-s should be identical. */ |
-s should be identical. */ |
2158 |
else |
else |
2159 |
{ |
{ |
2160 |
fprintf(outfile, "Compiled pattern written to %s\n", to_file); |
fprintf(outfile, "Compiled pattern written to %s\n", to_file); |
2161 |
|
|
2162 |
/* If there is study data, write it, but verify the writing only |
/* If there is study data, write it, but verify the writing only |
2163 |
if the studying was requested by /S, not just by -s. */ |
if the studying was requested by /S, not just by -s. */ |
2164 |
|
|
2165 |
if (extra != NULL) |
if (extra != NULL) |
2166 |
{ |
{ |
2167 |
if (fwrite(extra->study_data, 1, true_study_size, f) < |
if (fwrite(extra->study_data, 1, true_study_size, f) < |
2219 |
|
|
2220 |
pcre_callout = callout; |
pcre_callout = callout; |
2221 |
first_callout = 1; |
first_callout = 1; |
2222 |
last_callout_mark = NULL; |
last_callout_mark = NULL; |
2223 |
callout_extra = 0; |
callout_extra = 0; |
2224 |
callout_count = 0; |
callout_count = 0; |
2225 |
callout_fail_count = 999999; |
callout_fail_count = 999999; |
2746 |
do_g = do_G = FALSE; /* Break g/G loop */ |
do_g = do_G = FALSE; /* Break g/G loop */ |
2747 |
} |
} |
2748 |
} |
} |
2749 |
|
|
2750 |
/* do_allcaps requests showing of all captures in the pattern, to check |
/* do_allcaps requests showing of all captures in the pattern, to check |
2751 |
unset ones at the end. */ |
unset ones at the end. */ |
2752 |
|
|
2753 |
if (do_allcaps) |
if (do_allcaps) |
2754 |
{ |
{ |
2755 |
new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count); |
new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count); |
2756 |
count++; /* Allow for full match */ |
count++; /* Allow for full match */ |
2757 |
if (count * 2 > use_size_offsets) count = use_size_offsets/2; |
if (count * 2 > use_size_offsets) count = use_size_offsets/2; |
2758 |
} |
} |
2759 |
|
|
2760 |
/* Output the captured substrings */ |
/* Output the captured substrings */ |
2761 |
|
|
2762 |
for (i = 0; i < count * 2; i += 2) |
for (i = 0; i < count * 2; i += 2) |
2763 |
{ |
{ |
2764 |
if (use_offsets[i] < 0) |
if (use_offsets[i] < 0) |
2765 |
{ |
{ |
2766 |
if (use_offsets[i] != -1) |
if (use_offsets[i] != -1) |
2767 |
fprintf(outfile, "ERROR: bad negative value %d for offset %d\n", |
fprintf(outfile, "ERROR: bad negative value %d for offset %d\n", |
2768 |
use_offsets[i], i); |
use_offsets[i], i); |
2769 |
if (use_offsets[i+1] != -1) |
if (use_offsets[i+1] != -1) |
2770 |
fprintf(outfile, "ERROR: bad negative value %d for offset %d\n", |
fprintf(outfile, "ERROR: bad negative value %d for offset %d\n", |
2771 |
use_offsets[i+1], i+1); |
use_offsets[i+1], i+1); |
2772 |
fprintf(outfile, "%2d: <unset>\n", i/2); |
fprintf(outfile, "%2d: <unset>\n", i/2); |
2773 |
} |
} |
2774 |
else |
else |
2775 |
{ |
{ |
2776 |
fprintf(outfile, "%2d: ", i/2); |
fprintf(outfile, "%2d: ", i/2); |
2940 |
else |
else |
2941 |
{ |
{ |
2942 |
switch(count) |
switch(count) |
2943 |
{ |
{ |
2944 |
case PCRE_ERROR_NOMATCH: |
case PCRE_ERROR_NOMATCH: |
2945 |
if (gmatched == 0) |
if (gmatched == 0) |
2946 |
{ |
{ |
2948 |
else fprintf(outfile, "No match, mark = %s\n", markptr); |
else fprintf(outfile, "No match, mark = %s\n", markptr); |
2949 |
} |
} |
2950 |
break; |
break; |
2951 |
|
|
2952 |
case PCRE_ERROR_BADUTF8: |
case PCRE_ERROR_BADUTF8: |
2953 |
case PCRE_ERROR_SHORTUTF8: |
case PCRE_ERROR_SHORTUTF8: |
2954 |
fprintf(outfile, "Error %d (%s UTF-8 string)", count, |
fprintf(outfile, "Error %d (%s UTF-8 string)", count, |
2955 |
(count == PCRE_ERROR_BADUTF8)? "bad" : "short"); |
(count == PCRE_ERROR_BADUTF8)? "bad" : "short"); |
2956 |
if (use_size_offsets >= 2) |
if (use_size_offsets >= 2) |
2957 |
fprintf(outfile, " offset=%d reason=%d", use_offsets[0], |
fprintf(outfile, " offset=%d reason=%d", use_offsets[0], |
2958 |
use_offsets[1]); |
use_offsets[1]); |
2959 |
fprintf(outfile, "\n"); |
fprintf(outfile, "\n"); |
2960 |
break; |
break; |
2961 |
|
|
2962 |
default: |
default: |
2963 |
if (count < 0 && (-count) < sizeof(errtexts)/sizeof(const char *)) |
if (count < 0 && (-count) < sizeof(errtexts)/sizeof(const char *)) |
2964 |
fprintf(outfile, "Error %d (%s)\n", count, errtexts[-count]); |
fprintf(outfile, "Error %d (%s)\n", count, errtexts[-count]); |
2965 |
else |
else |
2966 |
fprintf(outfile, "Error %d (Unexpected value)\n", count); |
fprintf(outfile, "Error %d (Unexpected value)\n", count); |
2967 |
break; |
break; |
2968 |
} |
} |
2969 |
|
|
2970 |
break; /* Out of the /g loop */ |
break; /* Out of the /g loop */ |
2971 |
} |
} |
2972 |
} |
} |