diff --git a/include/fractal.hpp b/include/fractal.hpp index 7042394..cec7352 100644 --- a/include/fractal.hpp +++ b/include/fractal.hpp @@ -219,7 +219,9 @@ public: * * @ret @c true if the number of mark rules in the ruleset equals @c g_max_mark_rules, @c false otherwise */ - bool mark_rules_full() const; + bool mark_rules_full() const { + return m_mark_rules.full(); + } /** @brief Add a new marking rule to the ruleset * diff --git a/src/fractal.cpp b/src/fractal.cpp index 830881a..f314216 100644 --- a/src/fractal.cpp +++ b/src/fractal.cpp @@ -96,6 +96,20 @@ branch_rule_id_t ruleset_t::add_branch_rule_weighted(token_id_t match, weighted_ return m_branch_rules.size() - 1; } +mark_rule_id_t ruleset_t::add_mark_rule(token_id_t match, uint32_t tag) { + if (!valid_token(match)) { + throw mtl::invalid_argument(); + } + + mark_rule_t rule { + .m_match = match, + .m_tag = tag + }; + + m_mark_rules.push_back(rule); + return m_mark_rules.size() - 1; +} + #if 0 token_id_t generator_t::add_token(token_type_e type, mtl::fixed value) { log::debug << "Adding token with type " << (int)type << endl;