7#include <absl/container/flat_hash_map.h>
17 constexpr int id() const noexcept {
return id_; }
23 if (erroring_)
return;
24 if (
auto it = transitions_.find(c); it != transitions_.end())
25 for (
const auto& to : it->second) std::forward<F>(f)(to);
30 if (erroring_)
return;
31 for (
auto& [c, tos] : transitions_)
32 for (
const auto& to : tos) std::forward<F>(f)(c, to);
37 assert(!(accepting && erroring_) &&
"state cannot be accepting and erroring");
38 accepting_ = accepting;
43 assert(!(accepting_ && erroring) &&
"state cannot be accepting and erroring");
51 absl::flat_hash_map<std::uint16_t, std::vector<const NFANode*>> transitions_;
52 bool accepting_ =
false;
53 bool erroring_ =
false;
56extern template class AutomatonBase<NFANode>;
bool is_erroring() const noexcept
void set_erroring(bool erroring) noexcept
bool is_accepting() const
void for_transitions(F &&f) const
constexpr int id() const noexcept
friend std::ostream & operator<<(std::ostream &os, const NFANode &node)
void set_accepting(bool accepting)
void for_transitions(F &&f, std::uint16_t c) const
std::vector< const NFANode * > get_transitions(std::uint16_t c) const
void add_transition(const NFANode *to, std::uint16_t c)
NFA & operator=(const NFA &)=delete