Implement add_mark_rule
This commit is contained in:
parent
25ce069a97
commit
e613019f10
@ -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
|
||||
*
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user