def METHOD_NAME(self, listener, r):
    """
 Exits a grammar rule by first triggering the event specific to the given parse tree node
 then by triggering the generic event {@link ParseTreeListener#exitEveryRule}
 @param listener The listener responding to the trigger events
 @param r The grammar rule containing the rule context
    """
    ctx = r.getRuleContext()
    ctx.METHOD_NAME(listener)
    listener.exitEveryRule(ctx)