def _validate_rule(self, rule):
        # type: (Type[Rule]) -> None
        """
        Validate rule. Valid rule must inherit from Rule and have valid syntax.
        :param rule: Rule to validate.
        :raise NotRuleException: If the parameter doesn't inherit from Rule.
        """
        if not inspect.isclass(rule) or not issubclass(rule, Rule):
            raise NotRuleException(rule)
        rule.validate(self._grammar)
Validate rule. Valid rule must inherit from Rule and have valid syntax.
        :param rule: Rule to validate.
        :raise NotRuleException: If the parameter doesn't inherit from Rule.