From 61733e325436863bb409f8b663dc1dfa7d929d42 Mon Sep 17 00:00:00 2001 From: anon Date: Sat, 23 Sep 2023 16:34:06 +0200 Subject: [PATCH] progress at the price of techincal dept --- source/jeger.c | 19 +++++++++++-------- source/jeger.h | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/source/jeger.c b/source/jeger.c index 96266fe..40926e3 100644 --- a/source/jeger.c +++ b/source/jeger.c @@ -67,13 +67,13 @@ bool is_sentinel(const match_t * const match) { #define JEGER_CHAR_SET_lower_hex "abcdef" #define JEGER_CHAR_SET_upper_hex "ABCDEF" #define JEGER_CHAR_SET_oct_241_to_277 \ - "\241\242\243\244\245" \ - "\246\247\250\251\252" \ - "\253\254\255\256\257" \ - "\260\261\262\263\264" \ - "\265\266\267\270\271" \ - "\272\273\274\275\276" \ - "\277" + "\241\242\243\244\245" \ + "\246\247\250\251\252" \ + "\253\254\255\256\257" \ + "\260\261\262\263\264" \ + "\265\266\267\270\271" \ + "\272\273\274\275\276" \ + "\277" #define JEGER_CHAR_SET_oct_300_to_337 \ "\300\301\302\303\304" \ "\305\306\307\310\311" \ @@ -122,6 +122,7 @@ typedef struct { int flags; int state; int width; + int width2; char * whitelist; char * blacklist; } compiler_state; @@ -148,7 +149,7 @@ void HOOK_ALL(const int from, .input = *s, .to = ASSERT_HALT(to), .pattern_width = cs->width, - .match_width = 1, + .match_width = cs->width2, }; vector_push(®ex->delta_table, &delta); @@ -504,6 +505,7 @@ regex_t * regex_compile(const char * const pattern) { blacklist[0] = '\0'; cs.flags &= (IS_AT_THE_BEGINNING | FORCE_START_OF_STRING); cs.width = 1; + cs.width2 = 1; // Translate char switch (*s) { @@ -571,6 +573,7 @@ regex_t * regex_compile(const char * const pattern) { // --- ++cs.state; cs.width = 0; + cs.width2 = 0; HOOK_ALL(0, whitelist, +1, &cs, regex); cs.width = 1; OFFSHOOT(0, +1, 1, 0, &cs, regex); diff --git a/source/jeger.h b/source/jeger.h index 090f49d..7954b90 100644 --- a/source/jeger.h +++ b/source/jeger.h @@ -16,7 +16,7 @@ typedef struct { typedef struct { union { - int position; + int position; const char * _pos_ptr; }; int width;