tree-sitter/src/compiler/rules/repeat.cpp

24 lines
638 B
C++
Raw Normal View History

2013-12-18 20:58:05 -08:00
#include "rules.h"
2013-11-15 08:46:45 -08:00
#include "transition_map.h"
using std::string;
2013-11-15 08:46:45 -08:00
namespace tree_sitter {
namespace rules {
Repeat::Repeat(const rule_ptr content) : content(content) {}
bool Repeat::operator==(const Rule &rule) const {
const Repeat *other = dynamic_cast<const Repeat *>(&rule);
return other && (*other->content == *content);
}
string Repeat::to_string() const {
return string("(repeat ") + content->to_string() + ")";
2013-11-15 08:46:45 -08:00
}
2013-12-18 20:58:05 -08:00
void Repeat::accept(RuleVisitor &visitor) const {
visitor.visit(this);
}
2013-11-15 08:46:45 -08:00
}
}