|
|
@@ -7,7 +7,9 @@ |
|
|
|
#include <assert.h> |
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
// ------------------ |
|
|
|
// ### Char tests ### |
|
|
|
// ------------------ |
|
|
|
static bool is_quantifier(const char c) { |
|
|
|
for (const char * s = "+*?"; *s != '\00'; s++) { |
|
|
|
if (*s == c) { |
|
|
@@ -31,7 +33,9 @@ bool is_magic(const char c) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------- |
|
|
|
// ### Internal Types ### |
|
|
|
// ---------------------- |
|
|
|
typedef struct { |
|
|
|
int in; |
|
|
|
char input; |
|
|
@@ -45,7 +49,9 @@ typedef struct { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------- |
|
|
|
// ### Regex creation/destruction ### |
|
|
|
// ---------------------------------- |
|
|
|
static int escape_1_to_1(const char c, char * whitelist) { |
|
|
|
switch(c) { |
|
|
|
case 't': { |
|
|
@@ -327,8 +333,9 @@ int regex_free(regex_t * const regex) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------- |
|
|
|
// ### Searching ### |
|
|
|
|
|
|
|
// ----------------- |
|
|
|
static bool regex_assert(const regex_t * const regex, |
|
|
|
const char * const string, |
|
|
|
int state) { |
|
|
|