Collapse rules that contain only a single token

This commit is contained in:
Max Brunsfeld 2014-01-05 01:19:32 -08:00
parent 04d18b56ed
commit 0985fa3008
7 changed files with 70 additions and 61 deletions

View file

@ -6,6 +6,10 @@ using std::string;
namespace tree_sitter {
namespace rules {
bool Rule::operator!=(const Rule &other) const {
return !this->operator==(other);
}
ostream& operator<<(ostream& stream, const Rule &rule) {
return stream << rule.to_string();
}

View file

@ -13,6 +13,7 @@ namespace tree_sitter {
class Rule {
public:
virtual bool operator==(const Rule& other) const = 0;
bool operator!=(const Rule& other) const;
virtual size_t hash_code() const = 0;
virtual rule_ptr copy() const = 0;
virtual std::string to_string() const = 0;