formatting fixes
This commit is contained in:
parent
bddb3885b6
commit
1ed8286ab5
132
source/regex.c
132
source/regex.c
@ -110,48 +110,48 @@ static int escape_1_to_N(const char c, char * whitelist) {
|
|||||||
case 'i': {
|
case 'i': {
|
||||||
const char identifier_chars[] = "@0123456789_"
|
const char identifier_chars[] = "@0123456789_"
|
||||||
"\300\301\302\303\304"
|
"\300\301\302\303\304"
|
||||||
"\305\306\307\310\311"
|
"\305\306\307\310\311"
|
||||||
"\312\313\314\315\316"
|
"\312\313\314\315\316"
|
||||||
"\317\320\321\322\323"
|
"\317\320\321\322\323"
|
||||||
"\324\325\326\327\330"
|
"\324\325\326\327\330"
|
||||||
"\331\332\333\334\335"
|
"\331\332\333\334\335"
|
||||||
"\336\337";
|
"\336\337";
|
||||||
strcpy(whitelist, identifier_chars);
|
strcpy(whitelist, identifier_chars);
|
||||||
return sizeof(identifier_chars)-1;
|
return sizeof(identifier_chars)-1;
|
||||||
};
|
};
|
||||||
case 'I': {
|
case 'I': {
|
||||||
const char identifier_chars[] = "@_"
|
const char identifier_chars[] = "@_"
|
||||||
"\300\301\302\303\304"
|
"\300\301\302\303\304"
|
||||||
"\305\306\307\310\311"
|
"\305\306\307\310\311"
|
||||||
"\312\313\314\315\316"
|
"\312\313\314\315\316"
|
||||||
"\317\320\321\322\323"
|
"\317\320\321\322\323"
|
||||||
"\324\325\326\327\330"
|
"\324\325\326\327\330"
|
||||||
"\331\332\333\334\335"
|
"\331\332\333\334\335"
|
||||||
"\336\337";
|
"\336\337";
|
||||||
strcpy(whitelist, identifier_chars);
|
strcpy(whitelist, identifier_chars);
|
||||||
return sizeof(identifier_chars)-1;
|
return sizeof(identifier_chars)-1;
|
||||||
};
|
};
|
||||||
case 'k': {
|
case 'k': {
|
||||||
const char keyword_chars[] = "@0123456789_"
|
const char keyword_chars[] = "@0123456789_"
|
||||||
"\300\301\302\303\304"
|
"\300\301\302\303\304"
|
||||||
"\305\306\307\310\311"
|
"\305\306\307\310\311"
|
||||||
"\312\313\314\315\316"
|
"\312\313\314\315\316"
|
||||||
"\317\320\321\322\323"
|
"\317\320\321\322\323"
|
||||||
"\324\325\326\327\330"
|
"\324\325\326\327\330"
|
||||||
"\331\332\333\334\335"
|
"\331\332\333\334\335"
|
||||||
"\336\337";
|
"\336\337";
|
||||||
strcpy(whitelist, keyword_chars);
|
strcpy(whitelist, keyword_chars);
|
||||||
return sizeof(keyword_chars)-1;
|
return sizeof(keyword_chars)-1;
|
||||||
};
|
};
|
||||||
case 'K': {
|
case 'K': {
|
||||||
const char keyword_chars[] = "@_"
|
const char keyword_chars[] = "@_"
|
||||||
"\300\301\302\303\304"
|
"\300\301\302\303\304"
|
||||||
"\305\306\307\310\311"
|
"\305\306\307\310\311"
|
||||||
"\312\313\314\315\316"
|
"\312\313\314\315\316"
|
||||||
"\317\320\321\322\323"
|
"\317\320\321\322\323"
|
||||||
"\324\325\326\327\330"
|
"\324\325\326\327\330"
|
||||||
"\331\332\333\334\335"
|
"\331\332\333\334\335"
|
||||||
"\336\337";
|
"\336\337";
|
||||||
strcpy(whitelist, keyword_chars);
|
strcpy(whitelist, keyword_chars);
|
||||||
return sizeof(keyword_chars)-1;
|
return sizeof(keyword_chars)-1;
|
||||||
};
|
};
|
||||||
@ -167,39 +167,39 @@ static int escape_1_to_N(const char c, char * whitelist) {
|
|||||||
};
|
};
|
||||||
case 'p': {
|
case 'p': {
|
||||||
const char printable_chars[] = "@"
|
const char printable_chars[] = "@"
|
||||||
"\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"
|
||||||
"\300\301\302\303\304"
|
"\300\301\302\303\304"
|
||||||
"\305\306\307\310\311"
|
"\305\306\307\310\311"
|
||||||
"\312\313\314\315\316"
|
"\312\313\314\315\316"
|
||||||
"\317\320\321\322\323"
|
"\317\320\321\322\323"
|
||||||
"\324\325\326\327\330"
|
"\324\325\326\327\330"
|
||||||
"\331\332\333\334\335"
|
"\331\332\333\334\335"
|
||||||
"\336\337";
|
"\336\337";
|
||||||
strcpy(whitelist, printable_chars);
|
strcpy(whitelist, printable_chars);
|
||||||
return sizeof(printable_chars)-1;
|
return sizeof(printable_chars)-1;
|
||||||
};
|
};
|
||||||
case 'P': {
|
case 'P': {
|
||||||
const char printable_chars[] = "@"
|
const char printable_chars[] = "@"
|
||||||
"\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"
|
||||||
"\300\301\302\303\304"
|
"\300\301\302\303\304"
|
||||||
"\305\306\307\310\311"
|
"\305\306\307\310\311"
|
||||||
"\312\313\314\315\316"
|
"\312\313\314\315\316"
|
||||||
"\317\320\321\322\323"
|
"\317\320\321\322\323"
|
||||||
"\324\325\326\327\330"
|
"\324\325\326\327\330"
|
||||||
"\331\332\333\334\335"
|
"\331\332\333\334\335"
|
||||||
"\336\337";
|
"\336\337";
|
||||||
strcpy(whitelist, printable_chars);
|
strcpy(whitelist, printable_chars);
|
||||||
return sizeof(printable_chars)-1;
|
return sizeof(printable_chars)-1;
|
||||||
};
|
};
|
||||||
@ -215,8 +215,8 @@ static int escape_1_to_N(const char c, char * whitelist) {
|
|||||||
};
|
};
|
||||||
case 'x': {
|
case 'x': {
|
||||||
const char hex_chars[] = "0123456789"
|
const char hex_chars[] = "0123456789"
|
||||||
"abcdef"
|
"abcdef"
|
||||||
"ABCDEF";
|
"ABCDEF";
|
||||||
strcpy(whitelist, hex_chars);
|
strcpy(whitelist, hex_chars);
|
||||||
return sizeof(hex_chars)-1;
|
return sizeof(hex_chars)-1;
|
||||||
};
|
};
|
||||||
@ -227,22 +227,22 @@ static int escape_1_to_N(const char c, char * whitelist) {
|
|||||||
};
|
};
|
||||||
case 'w': {
|
case 'w': {
|
||||||
const char word_chars[] = "0123456789"
|
const char word_chars[] = "0123456789"
|
||||||
"abcdefghijklmnopqrstuwxyz"
|
"abcdefghijklmnopqrstuwxyz"
|
||||||
"ABCDEFGHIJKLMNOPQRSTUWXYZ"
|
"ABCDEFGHIJKLMNOPQRSTUWXYZ"
|
||||||
"_";
|
"_";
|
||||||
strcpy(whitelist, word_chars);
|
strcpy(whitelist, word_chars);
|
||||||
return sizeof(word_chars)-1;
|
return sizeof(word_chars)-1;
|
||||||
};
|
};
|
||||||
case 'h': {
|
case 'h': {
|
||||||
const char very_word_chars[] = "abcdefghijklmnopqrstuwxyz"
|
const char very_word_chars[] = "abcdefghijklmnopqrstuwxyz"
|
||||||
"ABCDEFGHIJKLMNOPQRSTUWXYZ"
|
"ABCDEFGHIJKLMNOPQRSTUWXYZ"
|
||||||
"_";
|
"_";
|
||||||
strcpy(whitelist, very_word_chars);
|
strcpy(whitelist, very_word_chars);
|
||||||
return sizeof(very_word_chars)-1;
|
return sizeof(very_word_chars)-1;
|
||||||
};
|
};
|
||||||
case 'a': {
|
case 'a': {
|
||||||
const char alpha_chars[] = "abcdefghijklmnopqrstuwxyz"
|
const char alpha_chars[] = "abcdefghijklmnopqrstuwxyz"
|
||||||
"ABCDEFGHIJKLMNOPQRSTUWXYZ";
|
"ABCDEFGHIJKLMNOPQRSTUWXYZ";
|
||||||
strcpy(whitelist, alpha_chars);
|
strcpy(whitelist, alpha_chars);
|
||||||
return sizeof(alpha_chars)-1;
|
return sizeof(alpha_chars)-1;
|
||||||
};
|
};
|
||||||
@ -326,10 +326,10 @@ static bool catch_(const regex_t * const regex,
|
|||||||
|
|
||||||
#define HALT_AND_CATCH_FIRE -1
|
#define HALT_AND_CATCH_FIRE -1
|
||||||
|
|
||||||
void HOOK_ALL( int from,
|
void HOOK_ALL(int from,
|
||||||
const char * const str,
|
const char * const str,
|
||||||
int to,
|
int to,
|
||||||
compiler_state * cs) {
|
compiler_state * cs) {
|
||||||
|
|
||||||
int hook_to = (*cs->is_negative) ? HALT_AND_CATCH_FIRE : *cs->state + to;
|
int hook_to = (*cs->is_negative) ? HALT_AND_CATCH_FIRE : *cs->state + to;
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ int regex_free(regex_t * const regex) {
|
|||||||
// -----------------
|
// -----------------
|
||||||
static bool regex_assert(const regex_t * const regex,
|
static bool regex_assert(const regex_t * const regex,
|
||||||
const char * const string,
|
const char * const string,
|
||||||
int state) {
|
int state) {
|
||||||
|
|
||||||
for (const char * s = string; *s != '\00'; s++) {
|
for (const char * s = string; *s != '\00'; s++) {
|
||||||
// delta
|
// delta
|
||||||
|
Loading…
Reference in New Issue
Block a user