#include "rules.h" #include "transition_map.h" using std::string; namespace tree_sitter { namespace rules { Choice::Choice(rule_ptr left, rule_ptr right) : left(left), right(right) {}; bool Choice::operator==(const Rule &rule) const { const Choice *other = dynamic_cast(&rule); return other && (*other->left == *left) && (*other->right == *right); } size_t Choice::hash_code() const { return typeid(this).hash_code() ^ left->hash_code() ^ right->hash_code(); } rule_ptr Choice::copy() const { return std::make_shared(*this); } string Choice::to_string() const { return string("#to_string() + " " + right->to_string() + ">"; } void Choice::accept(Visitor &visitor) const { visitor.visit(this); } } }