|
/* retoor <retoor@molodetz.nl> */
|
|
#ifndef LOREX_MATCHER_H
|
|
#define LOREX_MATCHER_H
|
|
|
|
#include "nfa.h"
|
|
#include "lorex.h"
|
|
|
|
typedef struct {
|
|
nfa_state_t **states;
|
|
size_t count;
|
|
size_t capacity;
|
|
size_t *group_starts;
|
|
size_t *group_ends;
|
|
int group_count;
|
|
} state_set_t;
|
|
|
|
state_set_t *state_set_create(size_t initial_capacity, int group_count);
|
|
void state_set_free(state_set_t *set);
|
|
void state_set_clear(state_set_t *set);
|
|
void state_set_add(state_set_t *set, nfa_state_t *state);
|
|
bool state_set_contains(state_set_t *set, nfa_state_t *state);
|
|
|
|
typedef struct match_ctx match_ctx_t;
|
|
|
|
match_ctx_t *match_ctx_create(nfa_t *nfa);
|
|
void match_ctx_free(match_ctx_t *ctx);
|
|
|
|
bool nfa_match(nfa_t *nfa, const char *text, size_t start_pos, lorex_match_t *result);
|
|
bool nfa_match_with_ctx(nfa_t *nfa, const char *text, size_t start_pos, lorex_match_t *result, match_ctx_t *ctx);
|
|
bool nfa_search(nfa_t *nfa, const char *text, lorex_match_t *result);
|
|
|
|
#endif
|