def parse_grammar(self, data):
        if self.data is None or self.data != data:
            self.data = data
            self.regions = []
        else:
            if self.printer is not None:
                self.printer(0, "Already parse")
            return True
        starttime = clock()
        if "compilation_unit" in self.grammar:
            if self.printer is not None:
                self.printer(0, "== Compilation unit ==")
            begin = 0
            # Pre separator (for beginning correction)
            if ("before_separator" not in self.grammar["compilation_unit"] or self.grammar["compilation_unit"]["before_separator"]):
                separator_output = self.parse_rule(self.grammar["separator"], True, "", 0, 0)
                if separator_output["successive_match"]:
                    begin = separator_output["end"]
                    self.regions += separator_output["regions"]
            parse_output = self.parse_rule(self.grammar["compilation_unit"], False, "", 0, begin)
            if parse_output["successive_match"]:
                self.regions += parse_output["regions"]
            # Post separator (for ending correction)
            if (self.grammar["compilation_unit"] not in "after_separator" or self.grammar["compilation_unit"]["after_separator"]):
                separator_output = self.parse_rule(self.grammar["separator"], True, "", 0, parse_output["end"])
                if separator_output["successive_match"]:
                    parse_output["end"] = separator_output["end"]
                    self.regions += separator_output["regions"]
        self.elapse_time = clock()-starttime
        return {"success": parse_output["successive_match"], "begin": parse_output["begin"], "end": parse_output["end"]}
dataset/ETHPy150Open spywhere/Javatar/parser/GrammarParser.py/GrammarParser.parse_grammar/swapped operands of `not in`