def METHOD_NAME(self, startRuleIndex):
    startRuleStartState = self.atn.ruleToStartState[startRuleIndex]
    rootContext = InterpreterRuleContext(None, ATNState.INVALID_STATE_NUMBER, startRuleIndex)
    if startRuleStartState.isPrecedenceRule:
        self.enterRecursionRule(rootContext, startRuleStartState.stateNumber, startRuleIndex, 0)
    else:
        self.enterRule(rootContext, startRuleStartState.stateNumber, startRuleIndex)
    while True:
        p = self.getATNState()
        if p.stateType==ATNState.RULE_STOP :
            # pop; return from rule
            if len(self._ctx)==0:
                if startRuleStartState.isPrecedenceRule:
                    result = self._ctx
                    parentContext = self._parentContextStack.pop()
                    self.unrollRecursionContexts(parentContext.a)
                    return result
                else:
                    self.exitRule()
                    return rootContext
            self.visitRuleStopState(p)
        else:
            try:
                self.visitState(p)
            except RecognitionException as e:
                self.state = self.atn.ruleToStopState[p.ruleIndex].stateNumber
                self._ctx.exception = e
                self._errHandler.reportError(self, e)
                self._errHandler.recover(self, e)