Implement add_mark_rule

This commit is contained in:
Madeline Busig 2025-04-29 06:21:39 -07:00
parent 7a73162798
commit 83c2ca5ffd
2 changed files with 17 additions and 1 deletions

View File

@ -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
*

View File

@ -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;