22 constexpr int id() const noexcept {
return id_; }
29 if (erroring_)
return;
30 if (
auto it = transitions_.find(c); it != transitions_.end())
31 for (
const auto& to : it->second)
32 std::forward<F>(f)(to);
38 if (erroring_)
return;
39 for (
auto& [c, tos] : transitions_)
40 for (
const auto& to : tos)
41 std::forward<F>(f)(c, to);
46 assert(!(accepting && erroring_) &&
"state cannot be accepting and erroring");
47 accepting_ = accepting;
52 assert(!(accepting_ && erroring) &&
"state cannot be accepting and erroring");
61 std::map<std::uint16_t, std::vector<const NFANode*>> transitions_;
62 bool accepting_ =
false;
63 bool erroring_ =
false;
66extern template class AutomatonBase<NFANode>;
68using NFASet = std::set<const NFANode*, NFANode::Lt>;
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
std::set< const NFANode *, NFANode::Lt > NFASet
constexpr bool operator()(const NFANode *n, const NFANode *m) const noexcept