Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions runtime/Python3/src/antlr4/ParserInterpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, grammarFileName:str, tokenNames:list, ruleNames:list, atn:ATN
self._interp = ParserATNSimulator(self, atn, self.decisionToDFA, self.sharedContextCache)

# Begin parsing at startRuleIndex#
def parse(self, startRuleIndex:int):
def parse(self, startRuleIndex:int):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect indent ?

startRuleStartState = self.atn.ruleToStartState[startRuleIndex]
rootContext = InterpreterRuleContext(None, ATNState.INVALID_STATE_NUMBER, startRuleIndex)
if startRuleStartState.isPrecedenceRule:
Expand Down Expand Up @@ -108,7 +108,7 @@ def visitState(self, p:ATNState):
tt = transition.serializationType
if tt==Transition.EPSILON:

if self.pushRecursionContextStates[p.stateNumber] and not isinstance(transition.target, LoopEndState):
if p.stateNumber in self.pushRecursionContextStates and not isinstance(transition.target, LoopEndState):
t = self._parentContextStack[-1]
ctx = InterpreterRuleContext(t[0], t[1], self._ctx.ruleIndex)
self.pushNewRecursionContext(ctx, self.atn.ruleToStartState[p.ruleIndex].stateNumber, self._ctx.ruleIndex)
Expand Down
Loading