| 30 |
/* Debugging function to print the internal form of the regex. This is the same |
/* Debugging function to print the internal form of the regex. This is the same |
| 31 |
code as contained in pcre.c under the DEBUG macro. */ |
code as contained in pcre.c under the DEBUG macro. */ |
| 32 |
|
|
| 33 |
static char *OP_names[] = { "End", "\\A", "\\B", "\\b", "\\D", "\\d", |
static const char *OP_names[] = { |
| 34 |
|
"End", "\\A", "\\B", "\\b", "\\D", "\\d", |
| 35 |
"\\S", "\\s", "\\W", "\\w", "Cut", "\\Z", "^", "$", "Any", "chars", |
"\\S", "\\s", "\\W", "\\w", "Cut", "\\Z", "^", "$", "Any", "chars", |
| 36 |
"not", |
"not", |
| 37 |
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", |
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", |
| 157 |
|
|
| 158 |
case OP_REF: |
case OP_REF: |
| 159 |
printf(" \\%d", *(++code)); |
printf(" \\%d", *(++code)); |
| 160 |
break; |
code++; |
| 161 |
|
goto CLASS_REF_REPEAT; |
| 162 |
|
|
| 163 |
case OP_CLASS: |
case OP_CLASS: |
| 164 |
{ |
{ |
| 188 |
printf("]"); |
printf("]"); |
| 189 |
code += 32; |
code += 32; |
| 190 |
|
|
| 191 |
|
CLASS_REF_REPEAT: |
| 192 |
|
|
| 193 |
switch(*code) |
switch(*code) |
| 194 |
{ |
{ |
| 195 |
case OP_CRSTAR: |
case OP_CRSTAR: |
| 331 |
pcre *re = NULL; |
pcre *re = NULL; |
| 332 |
pcre_extra *extra = NULL; |
pcre_extra *extra = NULL; |
| 333 |
regex_t preg; |
regex_t preg; |
| 334 |
char *error; |
const char *error; |
| 335 |
unsigned char *p, *pp; |
unsigned char *p, *pp; |
| 336 |
int do_study = 0; |
int do_study = 0; |
| 337 |
int do_debug = 0; |
int do_debug = 0; |
| 584 |
|
|
| 585 |
for (;;) |
for (;;) |
| 586 |
{ |
{ |
| 587 |
unsigned char *pp; |
unsigned char *q; |
| 588 |
int count, c; |
int count, c; |
| 589 |
int offsets[30]; |
int offsets[30]; |
| 590 |
int size_offsets = sizeof(offsets)/sizeof(int); |
int size_offsets = sizeof(offsets)/sizeof(int); |
| 603 |
p = buffer; |
p = buffer; |
| 604 |
while (isspace(*p)) p++; |
while (isspace(*p)) p++; |
| 605 |
|
|
| 606 |
pp = dbuffer; |
q = dbuffer; |
| 607 |
while ((c = *p++) != 0) |
while ((c = *p++) != 0) |
| 608 |
{ |
{ |
| 609 |
int i = 0; |
int i = 0; |
| 665 |
|
|
| 666 |
case 'O': |
case 'O': |
| 667 |
while(isdigit(*p)) n = n * 10 + *p++ - '0'; |
while(isdigit(*p)) n = n * 10 + *p++ - '0'; |
| 668 |
if (n <= sizeof(offsets)/sizeof(int)) size_offsets = n; |
if (n <= (int)(sizeof(offsets)/sizeof(int))) size_offsets = n; |
| 669 |
continue; |
continue; |
| 670 |
|
|
| 671 |
case 'Z': |
case 'Z': |
| 672 |
options |= PCRE_NOTEOL; |
options |= PCRE_NOTEOL; |
| 673 |
continue; |
continue; |
| 674 |
} |
} |
| 675 |
*pp++ = c; |
*q++ = c; |
| 676 |
} |
} |
| 677 |
*pp = 0; |
*q = 0; |
| 678 |
len = pp - dbuffer; |
len = q - dbuffer; |
| 679 |
|
|
| 680 |
/* Handle matching via the POSIX interface, which does not |
/* Handle matching via the POSIX interface, which does not |
| 681 |
support timing. */ |
support timing. */ |
| 698 |
} |
} |
| 699 |
else |
else |
| 700 |
{ |
{ |
| 701 |
int i; |
size_t i; |
| 702 |
for (i = 0; i < sizeof(pmatch)/sizeof(regmatch_t); i++) |
for (i = 0; i < sizeof(pmatch)/sizeof(regmatch_t); i++) |
| 703 |
{ |
{ |
| 704 |
if (pmatch[i].rm_so >= 0) |
if (pmatch[i].rm_so >= 0) |