コード例 #1
0
ファイル: LL1Analyzer.py プロジェクト: DanMcLaughlin/antlr4
    def getDecisionLookahead(self, s:ATNState):
        if s is None:
            return None

        count = len(s.transitions)
        look = [] * count
        for alt in range(0, count):
            look[alt] = set()
            lookBusy = set()
            seeThruPreds = False # fail to get lookahead upon pred
            self._LOOK(s.transition(alt).target, None, PredictionContext.EMPTY,
                  look[alt], lookBusy, set(), seeThruPreds, False)
            # Wipe out lookahead for this alternative if we found nothing
            # or we had a predicate when we !seeThruPreds
            if len(look[alt])==0 or self.HIT_PRED in look[alt]:
                look[alt] = None
        return look
コード例 #2
0
ファイル: LL1Analyzer.py プロジェクト: clinzy/butools
    def getDecisionLookahead(self, s: ATNState):
        if s is None:
            return None

        count = len(s.transitions)
        look = [] * count
        for alt in range(0, count):
            look[alt] = set()
            lookBusy = set()
            seeThruPreds = False  # fail to get lookahead upon pred
            self._LOOK(s.transition(alt).target, None, PredictionContext.EMPTY, \
                  look[alt], lookBusy, set(), seeThruPreds, False)
            # Wipe out lookahead for this alternative if we found nothing
            # or we had a predicate when we !seeThruPreds
            if len(look[alt]) == 0 or self.HIT_PRED in look[alt]:
                look[alt] = None
        return look
コード例 #3
0
ファイル: ATN.py プロジェクト: geektcp/alpha-antlr4
 def addState(self, state: ATNState):
     if state is not None:
         state.atn = self
         state.stateNumber = len(self.states)
     self.states.append(state)
コード例 #4
0
ファイル: ATN.py プロジェクト: geektcp/alpha-antlr4
 def nextTokensNoContext(self, s: ATNState):
     if s.nextTokenWithinRule is not None:
         return s.nextTokenWithinRule
     s.nextTokenWithinRule = self.nextTokensInContext(s, None)
     s.nextTokenWithinRule.readonly = True
     return s.nextTokenWithinRule
コード例 #5
0
ファイル: ATN.py プロジェクト: CodeGrimoire/antlr4
 def addState(self, state: ATNState):
     if state is not None:
         state.atn = self
         state.stateNumber = len(self.states)
     self.states.append(state)
コード例 #6
0
ファイル: ATN.py プロジェクト: CodeGrimoire/antlr4
 def nextTokensNoContext(self, s: ATNState):
     if s.nextTokenWithinRule is not None:
         return s.nextTokenWithinRule
     s.nextTokenWithinRule = self.nextTokensInContext(s, None)
     s.nextTokenWithinRule.readonly = True
     return s.nextTokenWithinRule