def validate_grammar(self, first=True):
        if first:
            self.unexists_rules = []
            self.unused_rules = []
            if "repository" in self.grammar:
                for rule_name in self.grammar["repository"]:
                    self.unused_rules.append(rule_name)
        if "separator" in self.grammar:
            self.validate_rule(self.grammar["separator"])
        if "compilation_unit" in self.grammar:
            self.validate_rule(self.grammar["compilation_unit"])
        self.unexists_rules.sort()
        self.unused_rules.sort()
        return {"unused_rules": self.unused_rules, "unexists_rules": self.unexists_rules}
dataset/ETHPy150Open spywhere/Javatar/parser/GrammarParser.py/GrammarParser.validate_grammar/original