Implement add_branch_rule
This commit is contained in:
parent
81a0ad5628
commit
925efc1ebc
@ -66,6 +66,21 @@ weighted_group_id_t ruleset_t::add_weighted_group(const etl::ivector<etl::pair<g
|
|||||||
return m_weighted_groups.size() - 1;
|
return m_weighted_groups.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
branch_rule_id_t ruleset_t::add_branch_rule(token_id_t match, group_id_t group) {
|
||||||
|
if (!valid_token(match) || !valid_group_characteristic(group)) {
|
||||||
|
throw mtl::invalid_argument();
|
||||||
|
}
|
||||||
|
|
||||||
|
branch_rule_t rule {
|
||||||
|
.m_match = match,
|
||||||
|
.m_weighted = false,
|
||||||
|
.m_group = { .basic = group }
|
||||||
|
};
|
||||||
|
|
||||||
|
m_branch_rules.push_back(rule);
|
||||||
|
return m_branch_rules.size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
token_id_t generator_t::add_token(token_type_e type, mtl::fixed value) {
|
token_id_t generator_t::add_token(token_type_e type, mtl::fixed value) {
|
||||||
log::debug << "Adding token with type " << (int)type << endl;
|
log::debug << "Adding token with type " << (int)type << endl;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user