pyrser/parsing/base.py
def eval_hook(self, name: str, ctx: list) -> Node:
        """Evaluate the hook by its name"""
        if name not in self.__class__._hooks:
            # TODO: don't always throw error, could have return True by default
            self.diagnostic.notify(
                error.Severity.ERROR,
                "Unknown hook : %s" % name,
                error.LocationInfo.from_stream(self._stream, is_error=True)
            )
            raise self.diagnostic
        self._lastRule = '#' + name
        res = self.__class__._hooks[name](self, *ctx)
        if type(res) is not bool:
            raise TypeError("Your hook %r didn't return a bool value" % name)
        return res
def eval_hook(self, name: str, ctx: list) -> Node:
        if name not in self.__class__._hooks:
            # TODO: don't always throw error, could have return True by default
            self.diagnostic.notify(
                error.Severity.ERROR,
                "Unknown hook : %s" % name,
                error.LocationInfo.from_stream(self._stream, is_error=True)
            )
            raise self.diagnostic
        self._lastRule = '#' + name
        res = self.__class__._hooks[name](self, *ctx)
        if type(res) is not bool:
            raise TypeError("Your hook %r didn't return a bool value" % name)
        return res
def eval_hook ( self , name : str , ctx : list ) -> Node : if name not in self . __class__ . _hooks : # TODO: don't always throw error, could have return True by default self . diagnostic . notify ( error . Severity . ERROR , "Unknown hook : %s" % name , error . LocationInfo . from_stream ( self . _stream , is_error = True ) ) raise self . diagnostic self . _lastRule = '#' + name res = self . __class__ . _hooks [ name ] ( self , * ctx ) if type ( res ) is not bool : raise TypeError ( "Your hook %r didn't return a bool value" % name ) return res
Evaluate the hook by its name
Evaluate the hook by its name