27 lines
728 B
C
Raw Normal View History

2026-01-04 00:04:48 +01:00
/* retoor <retoor@molodetz.nl> */
#ifndef LOREG_MATCHER_H
#define LOREG_MATCHER_H
#include "nfa.h"
#include "loreg.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);
bool nfa_match(nfa_t *nfa, const char *text, size_t start_pos, loreg_match_t *result);
bool nfa_search(nfa_t *nfa, const char *text, loreg_match_t *result);
#endif