Compare commits
5 Commits
626486cadf
...
7d660e215d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d660e215d | ||
|
|
e613019f10 | ||
|
|
25ce069a97 | ||
|
|
1e045d9801 | ||
|
|
07b94c996c |
1
.gitignore
vendored
1
.gitignore
vendored
@ -48,6 +48,7 @@ _deps
|
||||
# ---> MISC & GBA
|
||||
.cache/
|
||||
build/
|
||||
build*
|
||||
|
||||
*.gba
|
||||
*.elf
|
||||
|
||||
@ -153,6 +153,9 @@ public:
|
||||
bool weighted_groups_full() const {
|
||||
return m_weighted_groups.full();
|
||||
}
|
||||
bool valid_weighted_group(weighted_group_id_t wgroup) const {
|
||||
return wgroup < m_weighted_groups.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add new weighted group
|
||||
@ -175,7 +178,9 @@ public:
|
||||
*
|
||||
* @ret @c true if the number of branch rules in the ruleset equals @c g_max_branch_rules, @c false otherwise
|
||||
*/
|
||||
bool branch_rules_full() const;
|
||||
bool branch_rules_full() const {
|
||||
return m_branch_rules.full();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add a new unweighted branch rule to the ruleset
|
||||
@ -214,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
|
||||
*
|
||||
|
||||
@ -66,6 +66,50 @@ weighted_group_id_t ruleset_t::add_weighted_group(const etl::ivector<etl::pair<g
|
||||
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;
|
||||
}
|
||||
|
||||
branch_rule_id_t ruleset_t::add_branch_rule_weighted(token_id_t match, weighted_group_id_t wgroup) {
|
||||
if (!valid_token(match) || !valid_weighted_group(wgroup)) {
|
||||
throw mtl::invalid_argument();
|
||||
}
|
||||
|
||||
branch_rule_t rule {
|
||||
.m_match = match,
|
||||
.m_weighted = true,
|
||||
.m_group = { .weighted = wgroup }
|
||||
};
|
||||
|
||||
m_branch_rules.push_back(rule);
|
||||
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