Rename static 'Build' methods to 'build'
This commit is contained in:
parent
34d96909d1
commit
a0d9da9d5c
12 changed files with 22 additions and 22 deletions
|
|
@ -27,7 +27,7 @@ void add_choice_element(vector<rule_ptr> *vec, const rule_ptr new_rule) {
|
|||
}
|
||||
}
|
||||
|
||||
rule_ptr Choice::Build(const vector<rule_ptr> &inputs) {
|
||||
rule_ptr Choice::build(const vector<rule_ptr> &inputs) {
|
||||
vector<rule_ptr> elements;
|
||||
for (auto &el : inputs)
|
||||
add_choice_element(&elements, el);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace rules {
|
|||
class Choice : public Rule {
|
||||
public:
|
||||
explicit Choice(const std::vector<rule_ptr> &elements);
|
||||
static rule_ptr Build(const std::vector<rule_ptr> &rules);
|
||||
static rule_ptr build(const std::vector<rule_ptr> &rules);
|
||||
|
||||
bool operator==(const Rule &other) const;
|
||||
size_t hash_code() const;
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ static rule_ptr metadata(rule_ptr rule, map<MetadataKey, int> values) {
|
|||
|
||||
rule_ptr blank() { return make_shared<Blank>(); }
|
||||
|
||||
rule_ptr choice(const vector<rule_ptr> &rules) { return Choice::Build(rules); }
|
||||
rule_ptr choice(const vector<rule_ptr> &rules) { return Choice::build(rules); }
|
||||
|
||||
rule_ptr repeat(const rule_ptr &content) {
|
||||
return std::make_shared<Repeat>(content);
|
||||
}
|
||||
|
||||
rule_ptr seq(const vector<rule_ptr> &rules) { return Seq::Build(rules); }
|
||||
rule_ptr seq(const vector<rule_ptr> &rules) { return Seq::build(rules); }
|
||||
|
||||
rule_ptr sym(const string &name) { return make_shared<NamedSymbol>(name); }
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ using std::vector;
|
|||
|
||||
Seq::Seq(rule_ptr left, rule_ptr right) : left(left), right(right) {}
|
||||
|
||||
rule_ptr Seq::Build(const std::vector<rule_ptr> &rules) {
|
||||
rule_ptr Seq::build(const std::vector<rule_ptr> &rules) {
|
||||
rule_ptr result = make_shared<Blank>();
|
||||
for (auto &rule : rules)
|
||||
result = (typeid(*result) != typeid(Blank)) ? make_shared<Seq>(result, rule)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace rules {
|
|||
class Seq : public Rule {
|
||||
public:
|
||||
Seq(rule_ptr left, rule_ptr right);
|
||||
static rule_ptr Build(const std::vector<rule_ptr> &rules);
|
||||
static rule_ptr build(const std::vector<rule_ptr> &rules);
|
||||
|
||||
bool operator==(const Rule &other) const;
|
||||
size_t hash_code() const;
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ rule_ptr IdentityRuleFn::apply_to(const Choice *rule) {
|
|||
vector<rule_ptr> rules;
|
||||
for (const auto &el : rule->elements)
|
||||
rules.push_back(apply(el));
|
||||
return Choice::Build(rules);
|
||||
return Choice::build(rules);
|
||||
}
|
||||
|
||||
rule_ptr IdentityRuleFn::apply_to(const Seq *rule) {
|
||||
return Seq::Build({ apply(rule->left), apply(rule->right) });
|
||||
return Seq::build({ apply(rule->left), apply(rule->right) });
|
||||
}
|
||||
|
||||
rule_ptr IdentityRuleFn::apply_to(const Repeat *rule) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue