2013-12-18 20:58:05 -08:00
|
|
|
#include "rules.h"
|
2013-11-07 18:30:00 -08:00
|
|
|
#include "transition_map.h"
|
|
|
|
|
|
|
|
|
|
namespace tree_sitter {
|
|
|
|
|
namespace rules {
|
|
|
|
|
String::String(std::string value) : value(value) {};
|
|
|
|
|
|
2013-12-19 20:05:57 -08:00
|
|
|
rule_ptr str(const std::string &value) {
|
2013-11-14 12:55:02 -08:00
|
|
|
return std::make_shared<String>(value);
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-07 18:30:00 -08:00
|
|
|
bool String::operator==(const Rule &rule) const {
|
|
|
|
|
const String *other = dynamic_cast<const String *>(&rule);
|
|
|
|
|
return (other != NULL) && (other->value == value);
|
|
|
|
|
}
|
2013-11-14 12:55:02 -08:00
|
|
|
|
2013-11-07 18:30:00 -08:00
|
|
|
std::string String::to_string() const {
|
2013-11-12 18:37:02 -08:00
|
|
|
return std::string("(string '") + value + "')";
|
2013-11-07 18:30:00 -08:00
|
|
|
}
|
2013-12-18 20:58:05 -08:00
|
|
|
|
|
|
|
|
void String::accept(RuleVisitor &visitor) const {
|
|
|
|
|
visitor.visit(this);
|
|
|
|
|
}
|
2013-11-07 18:30:00 -08:00
|
|
|
}
|
|
|
|
|
}
|