readability
This commit is contained in:
parent
7e81ea3f01
commit
b3e21c3e29
@ -490,6 +490,11 @@ regex_t * regex_compile(const char * const pattern) {
|
|||||||
char whitelist[64];
|
char whitelist[64];
|
||||||
char blacklist[64];
|
char blacklist[64];
|
||||||
|
|
||||||
|
static const int REGEX_PREVERSABLE_FLAGS = IS_AT_THE_BEGINNING
|
||||||
|
| FORCE_START_OF_STRING
|
||||||
|
| DO_FORBID_START_OF_STRING
|
||||||
|
;
|
||||||
|
|
||||||
compiler_state cs = {
|
compiler_state cs = {
|
||||||
.flags = IS_AT_THE_BEGINNING,
|
.flags = IS_AT_THE_BEGINNING,
|
||||||
.state = JEGER_INIT_STATE,
|
.state = JEGER_INIT_STATE,
|
||||||
@ -500,11 +505,11 @@ regex_t * regex_compile(const char * const pattern) {
|
|||||||
for (const char * s = pattern; *s != '\00';) {
|
for (const char * s = pattern; *s != '\00';) {
|
||||||
assert(!is_quantifier(*s) && "Pattern starts with quantifier.");
|
assert(!is_quantifier(*s) && "Pattern starts with quantifier.");
|
||||||
// Reset the compiler
|
// Reset the compiler
|
||||||
whitelist[0] = '\0';
|
whitelist[0] = '\0';
|
||||||
blacklist[0] = '\0';
|
blacklist[0] = '\0';
|
||||||
cs.flags &= (IS_AT_THE_BEGINNING | FORCE_START_OF_STRING);
|
cs.flags &= REGEX_PREVERSABLE_FLAGS;
|
||||||
cs.width = 1;
|
cs.width = 1;
|
||||||
cs.match_width = 1;
|
cs.match_width = 1;
|
||||||
|
|
||||||
// Translate char
|
// Translate char
|
||||||
switch (*s) {
|
switch (*s) {
|
||||||
@ -657,6 +662,7 @@ regex_t * regex_compile(const char * const pattern) {
|
|||||||
++cs.state;
|
++cs.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Purge SOS flag
|
||||||
cs.flags &= (~IS_AT_THE_BEGINNING);
|
cs.flags &= (~IS_AT_THE_BEGINNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user