progress at the price of techincal dept

This commit is contained in:
anon 2023-09-23 16:34:06 +02:00
parent e0a5c54b62
commit 61733e3254
2 changed files with 12 additions and 9 deletions

View File

@ -67,13 +67,13 @@ bool is_sentinel(const match_t * const match) {
#define JEGER_CHAR_SET_lower_hex "abcdef" #define JEGER_CHAR_SET_lower_hex "abcdef"
#define JEGER_CHAR_SET_upper_hex "ABCDEF" #define JEGER_CHAR_SET_upper_hex "ABCDEF"
#define JEGER_CHAR_SET_oct_241_to_277 \ #define JEGER_CHAR_SET_oct_241_to_277 \
"\241\242\243\244\245" \ "\241\242\243\244\245" \
"\246\247\250\251\252" \ "\246\247\250\251\252" \
"\253\254\255\256\257" \ "\253\254\255\256\257" \
"\260\261\262\263\264" \ "\260\261\262\263\264" \
"\265\266\267\270\271" \ "\265\266\267\270\271" \
"\272\273\274\275\276" \ "\272\273\274\275\276" \
"\277" "\277"
#define JEGER_CHAR_SET_oct_300_to_337 \ #define JEGER_CHAR_SET_oct_300_to_337 \
"\300\301\302\303\304" \ "\300\301\302\303\304" \
"\305\306\307\310\311" \ "\305\306\307\310\311" \
@ -122,6 +122,7 @@ typedef struct {
int flags; int flags;
int state; int state;
int width; int width;
int width2;
char * whitelist; char * whitelist;
char * blacklist; char * blacklist;
} compiler_state; } compiler_state;
@ -148,7 +149,7 @@ void HOOK_ALL(const int from,
.input = *s, .input = *s,
.to = ASSERT_HALT(to), .to = ASSERT_HALT(to),
.pattern_width = cs->width, .pattern_width = cs->width,
.match_width = 1, .match_width = cs->width2,
}; };
vector_push(&regex->delta_table, vector_push(&regex->delta_table,
&delta); &delta);
@ -504,6 +505,7 @@ regex_t * regex_compile(const char * const pattern) {
blacklist[0] = '\0'; blacklist[0] = '\0';
cs.flags &= (IS_AT_THE_BEGINNING | FORCE_START_OF_STRING); cs.flags &= (IS_AT_THE_BEGINNING | FORCE_START_OF_STRING);
cs.width = 1; cs.width = 1;
cs.width2 = 1;
// Translate char // Translate char
switch (*s) { switch (*s) {
@ -571,6 +573,7 @@ regex_t * regex_compile(const char * const pattern) {
// --- // ---
++cs.state; ++cs.state;
cs.width = 0; cs.width = 0;
cs.width2 = 0;
HOOK_ALL(0, whitelist, +1, &cs, regex); HOOK_ALL(0, whitelist, +1, &cs, regex);
cs.width = 1; cs.width = 1;
OFFSHOOT(0, +1, 1, 0, &cs, regex); OFFSHOOT(0, +1, 1, 0, &cs, regex);

View File

@ -16,7 +16,7 @@ typedef struct {
typedef struct { typedef struct {
union { union {
int position; int position;
const char * _pos_ptr; const char * _pos_ptr;
}; };
int width; int width;