5#include <absl/container/flat_hash_map.h>
20 if (erroring_)
return;
21 if (
auto it = transitions_.find(c); it != transitions_.end()) f(it->second);
26 if (erroring_)
return;
27 for (
auto& [c, to] : transitions_) f(c, to);
32 assert(!(accepting && erroring_) &&
"state cannot be accepting and erroring");
33 accepting_ = accepting;
38 assert(!(accepting_ && erroring) &&
"state cannot be accepting and erroring");
45 absl::flat_hash_map<std::uint16_t, const DFANode*> transitions_;
46 bool accepting_ =
false;
47 bool erroring_ =
false;
50extern template class AutomatonBase<DFANode>;
61template<
class To>
using DFAMap = absl::flat_hash_map<const DFANode*, To>;
void set_erroring(bool erroring) noexcept
friend std::ostream & operator<<(std::ostream &os, const DFANode &node)
void for_transitions(F &&f) const
bool is_accepting() const noexcept
const DFANode * get_transition(std::uint16_t c) const
void add_transition(const DFANode *to, std::uint16_t c)
bool is_erroring() const noexcept
void set_accepting(bool accepting) noexcept
void for_transitions(F &&f, std::uint16_t c) const
DFA & operator=(const DFA &)=delete
absl::flat_hash_map< const DFANode *, To > DFAMap