Rename source files: .cpp -> .cc
This commit is contained in:
parent
31a58bc7e4
commit
a411e43484
49 changed files with 3 additions and 3 deletions
|
|
@ -1,41 +0,0 @@
|
|||
#include "compiler/rules/seq.h"
|
||||
#include "compiler/rules/visitor.h"
|
||||
#include "compiler/rules/blank.h"
|
||||
|
||||
namespace tree_sitter {
|
||||
using std::make_shared;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace rules {
|
||||
Seq::Seq(rule_ptr left, rule_ptr right) : left(left), right(right) {};
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue