/* * Copyright (c) Camden Dixie O'Brien * SPDX-License-Identifier: AGPL-3.0-only */ #include "compile.h" #include "construct.h" #include "convert.h" #include "parse.h" bool compile(const char *regex, int len, fsa_t *dfa_out) { regex_t pt; if (-1 == parse_expr(regex, len, &pt)) return false; fsa_t nfa; construct_nfa(&pt, &nfa); regex_free(&pt); convert_to_dfa(&nfa, dfa_out); fsa_free(&nfa); return true; }