Make ordering of cases deterministic in generated parsers

This commit is contained in:
Max Brunsfeld 2014-02-10 18:38:01 -08:00
parent 8baa1396fd
commit 15c9e2d398
12 changed files with 369 additions and 348 deletions

View file

@ -64,6 +64,10 @@ namespace tree_sitter {
return other && (ranges == other->ranges);
}
bool CharacterSet::operator<(const CharacterSet &other) const {
return ranges < other.ranges;
}
size_t CharacterSet::hash_code() const {
return typeid(this).hash_code() ^ hash<string>()(to_string());
}