2013-12-18 20:58:05 -08:00
|
|
|
#include "rules.h"
|
2013-11-07 13:24:01 -08:00
|
|
|
#include "transition_map.h"
|
|
|
|
|
|
2013-12-19 23:05:54 -08:00
|
|
|
using std::string;
|
|
|
|
|
|
2013-11-07 13:24:01 -08:00
|
|
|
namespace tree_sitter {
|
|
|
|
|
namespace rules {
|
2013-11-10 14:24:25 -08:00
|
|
|
Symbol::Symbol(const std::string &name) : name(name) {};
|
2013-11-14 12:55:02 -08:00
|
|
|
|
2013-11-07 13:24:01 -08:00
|
|
|
bool Symbol::operator==(const Rule &rule) const {
|
|
|
|
|
const Symbol *other = dynamic_cast<const Symbol *>(&rule);
|
2013-11-14 21:25:58 -08:00
|
|
|
return other && (other->name == name);
|
2013-11-07 13:24:01 -08:00
|
|
|
}
|
|
|
|
|
|
2013-12-19 23:05:54 -08:00
|
|
|
string Symbol::to_string() const {
|
|
|
|
|
return string("(sym '") + name + "')";
|
2013-11-10 14:24:25 -08:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
}
|