Update rule hash implementation

This commit is contained in:
Max Brunsfeld 2013-12-30 23:52:38 -08:00
parent 3116b457fe
commit 257b8d7b68
18 changed files with 80 additions and 30 deletions

View file

@ -2,6 +2,7 @@
#include "transition_map.h"
using std::string;
using std::hash;
namespace tree_sitter {
namespace rules {
@ -12,6 +13,10 @@ namespace tree_sitter {
return other && (other->name == name);
}
size_t Symbol::hash_code() const {
return typeid(this).hash_code() ^ hash<string>()(name);
}
string Symbol::to_string() const {
return string("#<sym '") + name + "'>";
}