38 |
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", |
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", |
39 |
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", |
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", |
40 |
"*", "*?", "+", "+?", "?", "??", "{", "{", |
"*", "*?", "+", "+?", "?", "??", "{", "{", |
41 |
"class", "Ref", |
"class", "negclass", "Ref", |
42 |
"Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", "Once", |
"Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", "Once", |
43 |
"Brazero", "Braminzero", "Bra" |
"Brazero", "Braminzero", "Bra" |
44 |
}; |
}; |
122 |
case OP_TYPEUPTO: |
case OP_TYPEUPTO: |
123 |
case OP_TYPEMINUPTO: |
case OP_TYPEMINUPTO: |
124 |
printf(" %s{", OP_names[code[3]]); |
printf(" %s{", OP_names[code[3]]); |
125 |
if (*code != OP_TYPEEXACT) printf(","); |
if (*code != OP_TYPEEXACT) printf("0,"); |
126 |
printf("%d}", (code[1] << 8) + code[2]); |
printf("%d}", (code[1] << 8) + code[2]); |
127 |
if (*code == OP_TYPEMINUPTO) printf("?"); |
if (*code == OP_TYPEMINUPTO) printf("?"); |
128 |
code += 3; |
code += 3; |
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 |
|
case OP_NEGCLASS: |
165 |
{ |
{ |
166 |
int i, min, max; |
int i, min, max; |
167 |
|
if (*code++ == OP_CLASS) printf(" ["); |
168 |
code++; |
else printf(" ^["); |
|
printf(" ["); |
|
169 |
|
|
170 |
for (i = 0; i < 256; i++) |
for (i = 0; i < 256; i++) |
171 |
{ |
{ |
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: |
268 |
int showinfo = 0; |
int showinfo = 0; |
269 |
int posix = 0; |
int posix = 0; |
270 |
int debug = 0; |
int debug = 0; |
271 |
|
int done = 0; |
272 |
unsigned char buffer[30000]; |
unsigned char buffer[30000]; |
273 |
unsigned char dbuffer[1024]; |
unsigned char dbuffer[1024]; |
274 |
|
|
327 |
|
|
328 |
/* Main loop */ |
/* Main loop */ |
329 |
|
|
330 |
for (;;) |
while (!done) |
331 |
{ |
{ |
332 |
pcre *re = NULL; |
pcre *re = NULL; |
333 |
pcre_extra *extra = NULL; |
pcre_extra *extra = NULL; |
376 |
if (fgets((char *)pp, len, infile) == NULL) |
if (fgets((char *)pp, len, infile) == NULL) |
377 |
{ |
{ |
378 |
fprintf(outfile, "** Unexpected EOF\n"); |
fprintf(outfile, "** Unexpected EOF\n"); |
379 |
goto END_OFF; |
done = 1; |
380 |
|
goto CONTINUE; |
381 |
} |
} |
382 |
if (infile != stdin) fprintf(outfile, (char *)pp); |
if (infile != stdin) fprintf(outfile, (char *)pp); |
383 |
} |
} |
412 |
} |
} |
413 |
} |
} |
414 |
|
|
415 |
/* Handle compiing via the POSIX interface, which doesn't support the |
/* Handle compiling via the POSIX interface, which doesn't support the |
416 |
timing, showing, or debugging options. */ |
timing, showing, or debugging options. */ |
417 |
|
|
418 |
if (posix || do_posix) |
if (posix || do_posix) |
467 |
for (;;) |
for (;;) |
468 |
{ |
{ |
469 |
if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) |
if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) |
470 |
goto END_OFF; |
{ |
471 |
|
done = 1; |
472 |
|
goto CONTINUE; |
473 |
|
} |
474 |
len = (int)strlen((char *)buffer); |
len = (int)strlen((char *)buffer); |
475 |
while (len > 0 && isspace(buffer[len-1])) len--; |
while (len > 0 && isspace(buffer[len-1])) len--; |
476 |
if (len == 0) break; |
if (len == 0) break; |
589 |
|
|
590 |
for (;;) |
for (;;) |
591 |
{ |
{ |
592 |
unsigned char *pp; |
unsigned char *q; |
593 |
int count, c; |
int count, c; |
594 |
int offsets[30]; |
int offsets[30]; |
595 |
int size_offsets = sizeof(offsets)/sizeof(int); |
int size_offsets = sizeof(offsets)/sizeof(int); |
597 |
options = 0; |
options = 0; |
598 |
|
|
599 |
if (infile == stdin) printf(" data> "); |
if (infile == stdin) printf(" data> "); |
600 |
if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) goto END_OFF; |
if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) |
601 |
|
{ |
602 |
|
done = 1; |
603 |
|
goto CONTINUE; |
604 |
|
} |
605 |
if (infile != stdin) fprintf(outfile, (char *)buffer); |
if (infile != stdin) fprintf(outfile, (char *)buffer); |
606 |
|
|
607 |
len = (int)strlen((char *)buffer); |
len = (int)strlen((char *)buffer); |
612 |
p = buffer; |
p = buffer; |
613 |
while (isspace(*p)) p++; |
while (isspace(*p)) p++; |
614 |
|
|
615 |
pp = dbuffer; |
q = dbuffer; |
616 |
while ((c = *p++) != 0) |
while ((c = *p++) != 0) |
617 |
{ |
{ |
618 |
int i = 0; |
int i = 0; |
674 |
|
|
675 |
case 'O': |
case 'O': |
676 |
while(isdigit(*p)) n = n * 10 + *p++ - '0'; |
while(isdigit(*p)) n = n * 10 + *p++ - '0'; |
677 |
if (n <= (int)sizeof(offsets)/sizeof(int)) size_offsets = n; |
if (n <= (int)(sizeof(offsets)/sizeof(int))) size_offsets = n; |
678 |
continue; |
continue; |
679 |
|
|
680 |
case 'Z': |
case 'Z': |
681 |
options |= PCRE_NOTEOL; |
options |= PCRE_NOTEOL; |
682 |
continue; |
continue; |
683 |
} |
} |
684 |
*pp++ = c; |
*q++ = c; |
685 |
} |
} |
686 |
*pp = 0; |
*q = 0; |
687 |
len = pp - dbuffer; |
len = q - dbuffer; |
688 |
|
|
689 |
/* Handle matching via the POSIX interface, which does not |
/* Handle matching via the POSIX interface, which does not |
690 |
support timing. */ |
support timing. */ |
771 |
} |
} |
772 |
} |
} |
773 |
|
|
774 |
|
CONTINUE: |
775 |
if (posix || do_posix) regfree(&preg); |
if (posix || do_posix) regfree(&preg); |
776 |
if (re != NULL) free(re); |
if (re != NULL) free(re); |
777 |
if (extra != NULL) free(extra); |
if (extra != NULL) free(extra); |
778 |
} |
} |
779 |
|
|
|
END_OFF: |
|
780 |
fprintf(outfile, "\n"); |
fprintf(outfile, "\n"); |
781 |
return 0; |
return 0; |
782 |
} |
} |