From e40c6ec60d23f00aa4a90a4dd58fd46a31273464 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 19 Feb 2014 18:30:56 -0800 Subject: [PATCH] Clean up PreparedGrammar::operator== --- src/compiler/prepared_grammar.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/compiler/prepared_grammar.cpp b/src/compiler/prepared_grammar.cpp index ae766f98..2140f5ec 100644 --- a/src/compiler/prepared_grammar.cpp +++ b/src/compiler/prepared_grammar.cpp @@ -36,21 +36,13 @@ namespace tree_sitter { } bool PreparedGrammar::operator==(const PreparedGrammar &other) const { - if (other.start_rule_name != start_rule_name) return false; - if (other.rules.size() != rules.size()) return false; + if (!Grammar::operator==(other)) return false; if (other.aux_rules.size() != aux_rules.size()) return false; - - for (auto pair : rules) { - auto other_pair = other.rules.find(pair.first); - if (other_pair == other.rules.end()) return false; - if (!other_pair->second->operator==(*pair.second)) return false; - } for (auto pair : aux_rules) { auto other_pair = other.aux_rules.find(pair.first); if (other_pair == other.aux_rules.end()) return false; if (!other_pair->second->operator==(*pair.second)) return false; } - return true; }