当前位置: 首页>>代码示例>>Python>>正文


Python IntervalSet.removeOne方法代码示例

本文整理汇总了Python中antlr4.IntervalSet.IntervalSet.removeOne方法的典型用法代码示例。如果您正苦于以下问题:Python IntervalSet.removeOne方法的具体用法?Python IntervalSet.removeOne怎么用?Python IntervalSet.removeOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在antlr4.IntervalSet.IntervalSet的用法示例。


在下文中一共展示了IntervalSet.removeOne方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getErrorRecoverySet

# 需要导入模块: from antlr4.IntervalSet import IntervalSet [as 别名]
# 或者: from antlr4.IntervalSet.IntervalSet import removeOne [as 别名]
 def getErrorRecoverySet(self, recognizer:Parser):
     atn = recognizer._interp.atn
     ctx = recognizer._ctx
     recoverSet = IntervalSet()
     while ctx is not None and ctx.invokingState>=0:
         # compute what follows who invoked us
         invokingState = atn.states[ctx.invokingState]
         rt = invokingState.transitions[0]
         follow = atn.nextTokens(rt.followState)
         recoverSet.addSet(follow)
         ctx = ctx.parentCtx
     recoverSet.removeOne(Token.EPSILON)
     return recoverSet
开发者ID:lecode-official,项目名称:antlr4,代码行数:15,代码来源:ErrorStrategy.py

示例2: getExpectedTokens

# 需要导入模块: from antlr4.IntervalSet import IntervalSet [as 别名]
# 或者: from antlr4.IntervalSet.IntervalSet import removeOne [as 别名]
 def getExpectedTokens(self, stateNumber: int, ctx: RuleContext):
     if stateNumber < 0 or stateNumber >= len(self.states):
         raise Exception("Invalid state number.")
     s = self.states[stateNumber]
     following = self.nextTokens(s)
     if Token.EPSILON not in following:
         return following
     expected = IntervalSet()
     expected.addSet(following)
     expected.removeOne(Token.EPSILON)
     while ctx != None and ctx.invokingState >= 0 and Token.EPSILON in following:
         invokingState = self.states[ctx.invokingState]
         rt = invokingState.transitions[0]
         following = self.nextTokens(rt.followState)
         expected.addSet(following)
         expected.removeOne(Token.EPSILON)
         ctx = ctx.parentCtx
     if Token.EPSILON in following:
         expected.addOne(Token.EOF)
     return expected
开发者ID:CodeGrimoire,项目名称:antlr4,代码行数:22,代码来源:ATN.py


注:本文中的antlr4.IntervalSet.IntervalSet.removeOne方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。