7#include <absl/container/flat_hash_map.h>
21 if (erroring_)
return;
22 if (
auto it = transitions_.find(c); it != transitions_.end())
23 for (
const auto& to : it->second) std::forward<F>(f)(to);
28 if (erroring_)
return;
29 for (
auto& [c, tos] : transitions_)
30 for (
const auto& to : tos) std::forward<F>(f)(c, to);
35 assert(!(accepting && erroring_) &&
"state cannot be accepting and erroring");
36 accepting_ = accepting;
41 assert(!(accepting_ && erroring) &&
"state cannot be accepting and erroring");
48 absl::flat_hash_map<std::uint16_t, std::vector<const NFANode*>> transitions_;
49 bool accepting_ =
false;
50 bool erroring_ =
false;
53extern 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
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