This commit is contained in:
Kyryl Melekhin
2021-08-05 11:37:00 +00:00
parent 515312b80d
commit 8a2e4144b3

16
pike.c
View File

@@ -7,8 +7,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h> #include <ctype.h>
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
const unsigned char utf8_length[256] = { const unsigned char utf8_length[256] = {
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
/* 0 */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0 */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -114,12 +112,6 @@ pc += num;
#define EMIT(at, byte) (code ? (code[at] = byte) : at) #define EMIT(at, byte) (code ? (code[at] = byte) : at)
#define PC (prog->unilen) #define PC (prog->unilen)
void re_fatal(char *msg)
{
fprintf(stderr, "fatal error: %s\n", msg);
exit(2);
}
int re_classmatch(const int *pc, int c) int re_classmatch(const int *pc, int c)
{ {
// pc points to "classnot" byte after opcode // pc points to "classnot" byte after opcode
@@ -514,7 +506,7 @@ if (--csub->ref == 0) { \
pc += 2; \ pc += 2; \
goto rec##nn; \ goto rec##nn; \
case WBEG: \ case WBEG: \
if (!nlistidx && (!isword(_sp) || isword(sp)) \ if ((!isword(_sp) || isword(sp)) \
&& !(sp == s && isword(sp))) \ && !(sp == s && isword(sp))) \
goto dec_check##nn; \ goto dec_check##nn; \
pc++; goto rec##nn; \ pc++; goto rec##nn; \
@@ -617,8 +609,10 @@ int main(int argc, char *argv[])
char code[(sizeof(rcode)+sz)*2]; char code[(sizeof(rcode)+sz)*2];
memset(code+sizeof(rcode)+sz, 0, sizeof(rcode)+sz); memset(code+sizeof(rcode)+sz, 0, sizeof(rcode)+sz);
rcode *_code = (rcode*)code; rcode *_code = (rcode*)code;
if (re_comp(_code, argv[1])) if (re_comp(_code, argv[1])) {
re_fatal("Error in re_comp"); printf("Error in re_comp");
return 1;
}
re_dumpcode(_code); re_dumpcode(_code);
#include <time.h> #include <time.h>
if (argc > 2) { if (argc > 2) {