2023-09-09 08:37:20 -04:00
|
|
|
#ifndef JEGER_H
|
|
|
|
#define JEGER_H
|
2023-09-01 10:47:53 -04:00
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "vector.h"
|
|
|
|
|
|
|
|
extern bool is_case_on;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int accepting_state;
|
|
|
|
char * str;
|
|
|
|
vector_t delta_table; // <delta_t>
|
|
|
|
vector_t catch_table; // <offshoot_t>
|
|
|
|
} regex_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2023-09-23 09:55:36 -04:00
|
|
|
union {
|
2023-09-23 10:34:06 -04:00
|
|
|
int position;
|
2023-09-23 09:55:36 -04:00
|
|
|
const char * _pos_ptr;
|
|
|
|
};
|
2023-09-01 10:47:53 -04:00
|
|
|
int width;
|
|
|
|
} match_t;
|
|
|
|
|
|
|
|
extern regex_t * regex_compile(const char * const pattern);
|
|
|
|
extern int regex_free(regex_t * const regex);
|
2023-09-02 11:39:52 -04:00
|
|
|
extern bool regex_search(const regex_t * const regex, const char * const string);
|
|
|
|
extern match_t * regex_match(const regex_t * const regex, const char * const string, const bool start_of_string);
|
2023-09-01 10:47:53 -04:00
|
|
|
|
|
|
|
extern bool is_magic(const char c);
|
2023-09-23 10:52:45 -04:00
|
|
|
extern bool is_sentinel(const match_t * const match);
|
2023-09-01 10:47:53 -04:00
|
|
|
|
|
|
|
#endif
|