def generateRuleBypassTransitions(self, atn:ATN): count = len(atn.ruleToStartState) atn.ruleToTokenType = [ 0 ] * count for i in range(0, count): atn.ruleToTokenType[i] = atn.maxTokenType + i + 1 for i in range(0, count): self.generateRuleBypassTransition(atn, i)
def generateRuleBypassTransitions(self, atn: ATN): count = len(atn.ruleToStartState) atn.ruleToTokenType = [0] * count for i in range(0, count): atn.ruleToTokenType[i] = atn.maxTokenType + i + 1 for i in range(0, count): self.generateRuleBypassTransition(atn, i)
def readRules(self, atn: ATN): nrules = self.readInt() if atn.grammarType == ATNType.LEXER: atn.ruleToTokenType = [0] * nrules atn.ruleToStartState = [0] * nrules for i in range(0, nrules): s = self.readInt() startState = atn.states[s] atn.ruleToStartState[i] = startState if atn.grammarType == ATNType.LEXER: tokenType = self.readInt() atn.ruleToTokenType[i] = tokenType atn.ruleToStopState = [0] * nrules for state in atn.states: if not isinstance(state, RuleStopState): continue atn.ruleToStopState[state.ruleIndex] = state atn.ruleToStartState[state.ruleIndex].stopState = state
def readRules(self, atn:ATN): nrules = self.readInt() if atn.grammarType == ATNType.LEXER: atn.ruleToTokenType = [0] * nrules atn.ruleToStartState = [0] * nrules for i in range(0, nrules): s = self.readInt() startState = atn.states[s] atn.ruleToStartState[i] = startState if atn.grammarType == ATNType.LEXER: tokenType = self.readInt() if tokenType == 0xFFFF: tokenType = Token.EOF atn.ruleToTokenType[i] = tokenType atn.ruleToStopState = [0] * nrules for state in atn.states: if not isinstance(state, RuleStopState): continue atn.ruleToStopState[state.ruleIndex] = state atn.ruleToStartState[state.ruleIndex].stopState = state