本文整理汇总了Python中pyparsing.OneOrMore.suppress方法的典型用法代码示例。如果您正苦于以下问题:Python OneOrMore.suppress方法的具体用法?Python OneOrMore.suppress怎么用?Python OneOrMore.suppress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyparsing.OneOrMore
的用法示例。
在下文中一共展示了OneOrMore.suppress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Combine
# 需要导入模块: from pyparsing import OneOrMore [as 别名]
# 或者: from pyparsing.OneOrMore import suppress [as 别名]
containedA = Combine(Literal(CONTAINED) + spaces + Literal(A))
args = ZeroOrMore(types + identifier)
argument = Group((Optional(Literal(SPIDER))) + (Literal(NUMBER) |
Literal(LETTER) | Literal(SENTENCE)) + identifier)
argsDeff = Group(Optional(argument + ZeroOrMore(Literal(COMMA).suppress() +
argument) ))
argsCall = Optional(expression + ZeroOrMore(Literal(COMMA).suppress()
+ expression))
#Function call
functionCall << (identifier + lpar + Group(argsCall) + rpar)
#Function definitions
voidF = Combine(Literal(THE) + spaces + Literal(LOOKING_GLASS) +
spaces.suppress() + ~Literal(HATTA))
mainF = Combine(Literal(THE) + spaces + Literal(LOOKING_GLASS)
+ spaces + Literal(HATTA))
typeF = Combine(Literal(THE) + spaces + Literal(ROOM))
block = Group(opened + Group(Optional(ZeroOrMore(anyFunction | declaration) +
OneOrMore(sequence))) + closed)
opcl << block
mainFunction = Group(mainF + lpar + argsDeff + rpar + block)
voidFunction = Group(voidF + identifier + lpar + argsDeff + rpar + block)
typeFunction = Group(typeF + identifier + lpar + argsDeff + rpar + containedA
+ types + block)
function << (voidFunction | typeFunction)
anyFunction << (function | mainFunction)
# Import extension
filePath = Word(nums + alphas + "!$%&(')*+,-./:;<=>[email protected][]^_`{|}~ #" + "\\")