Auto-format all source code with clang-format
This commit is contained in:
parent
b8d8386e63
commit
98cc2f2264
105 changed files with 4223 additions and 4052 deletions
|
|
@ -4,39 +4,36 @@
|
|||
#include "compiler/rules/blank.h"
|
||||
|
||||
namespace tree_sitter {
|
||||
using std::make_shared;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
namespace rules {
|
||||
|
||||
namespace rules {
|
||||
Seq::Seq(rule_ptr left, rule_ptr right) : left(left), right(right) {}
|
||||
using std::make_shared;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
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) : rule;
|
||||
return result;
|
||||
}
|
||||
Seq::Seq(rule_ptr left, rule_ptr right) : left(left), right(right) {}
|
||||
|
||||
bool Seq::operator==(const Rule &rule) const {
|
||||
const Seq *other = dynamic_cast<const Seq *>(&rule);
|
||||
return other && (*other->left == *left) && (*other->right == *right);
|
||||
}
|
||||
|
||||
size_t Seq::hash_code() const {
|
||||
return left->hash_code() ^ right->hash_code();
|
||||
}
|
||||
|
||||
rule_ptr Seq::copy() const {
|
||||
return std::make_shared<Seq>(*this);
|
||||
}
|
||||
|
||||
string Seq::to_string() const {
|
||||
return string("#<seq ") + left->to_string() + " " + right->to_string() + ">";
|
||||
}
|
||||
|
||||
void Seq::accept(Visitor *visitor) const {
|
||||
visitor->visit(this);
|
||||
}
|
||||
}
|
||||
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)
|
||||
: rule;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Seq::operator==(const Rule &rule) const {
|
||||
const Seq *other = dynamic_cast<const Seq *>(&rule);
|
||||
return other && (*other->left == *left) && (*other->right == *right);
|
||||
}
|
||||
|
||||
size_t Seq::hash_code() const { return left->hash_code() ^ right->hash_code(); }
|
||||
|
||||
rule_ptr Seq::copy() const { return std::make_shared<Seq>(*this); }
|
||||
|
||||
string Seq::to_string() const {
|
||||
return string("#<seq ") + left->to_string() + " " + right->to_string() + ">";
|
||||
}
|
||||
|
||||
void Seq::accept(Visitor *visitor) const { visitor->visit(this); }
|
||||
|
||||
} // namespace rules
|
||||
} // namespace tree_sitter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue