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

23 lines
597 B
C++
Raw Normal View History

2013-12-18 20:58:05 -08:00
#include "rules.h"
2013-11-07 13:24:01 -08:00
#include "transition_map.h"
using std::string;
2013-11-07 13:24:01 -08:00
namespace tree_sitter {
namespace rules {
Symbol::Symbol(const std::string &name) : name(name) {};
2013-11-07 13:24:01 -08:00
bool Symbol::operator==(const Rule &rule) const {
const Symbol *other = dynamic_cast<const Symbol *>(&rule);
return other && (other->name == name);
2013-11-07 13:24:01 -08:00
}
string Symbol::to_string() const {
return string("(sym '") + name + "')";
}
2013-12-18 20:58:05 -08:00
2013-12-19 23:16:13 -08:00
void Symbol::accept(Visitor &visitor) const {
2013-12-18 20:58:05 -08:00
visitor.visit(this);
}
2013-11-07 13:24:01 -08:00
}
}