libregexis024/src/libregexis024fa/codeset.h
2024-07-28 19:54:57 +03:00

27 lines
897 B
C++

#ifndef LIBREGEXIS024_CODESET_H
#define LIBREGEXIS024_CODESET_H
#include <vector>
#include <utility>
#include <stdint.h>
#include <string>
typedef std::vector<std::pair<uint32_t, uint32_t>> codeset_t;
codeset_t invert_set(const codeset_t& X);
codeset_t merge_sets(const codeset_t& A, const codeset_t& B);
codeset_t intersect_sets(const codeset_t& A, const codeset_t& B);
codeset_t subtract_sets(const codeset_t& A, const codeset_t& B);
/* Aborts if segment in question hit the edge (unsafe function) */
bool is_inside(uint32_t start, uint32_t end, codeset_t& X);
codeset_t set_add_char(const codeset_t& X, uint32_t cp);
codeset_t set_add_range(const codeset_t& X, uint32_t start, uint32_t end);
codeset_t codeset_of_one_char(uint32_t ch);
#define codeset_of_all codeset_t({{0, UINT32_MAX}})
std::string stringifyCodesetBase10(const codeset_t& CS);
#endif //LIBREGEXIS024_CODESET_H