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


Python Word.leaveWhitespace方法代码示例

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


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

示例1: parseExtensible

# 需要导入模块: from pyparsing import Word [as 别名]
# 或者: from pyparsing.Word import leaveWhitespace [as 别名]
def parseExtensible(attr, s):
    raise NotImplementedError()



from pyparsing import Word, Literal, Optional, ZeroOrMore, Suppress, \
                       Group, Forward, OneOrMore, ParseException, \
                       CharsNotIn, Combine, StringStart, \
                       StringEnd, delimitedList

import string

filter_ = Forward()
attr = Word(string.ascii_letters,
            string.ascii_letters + string.digits + ';-',)
attr.leaveWhitespace()
attr.setName('attr')
hexdigits = Word(string.hexdigits, exact=2)
hexdigits.setName('hexdigits')
escaped = Suppress(Literal('\\')) + hexdigits
escaped.setName('escaped')


def _p_escaped(s, l, t):
    text = t[0]
    return chr(int(text, 16))


escaped.setParseAction(_p_escaped)
value = Combine(OneOrMore(CharsNotIn('*()\\\0') | escaped))
value.setName('value')
开发者ID:cwaldbieser,项目名称:ldaptor,代码行数:33,代码来源:ldapfilter.py

示例2: oneOf

# 需要导入模块: from pyparsing import Word [as 别名]
# 或者: from pyparsing.Word import leaveWhitespace [as 别名]
compare_operators = oneOf("< > =  >= <=")
valname = alphanums + "-_${}+"

# version number
# vnum = Word(nums) + Optional(Word(alphanums + ".-_"))
# It seems like j3.134l.i is a valid version number...
# It is not allowed, but some PKGBUILDs seem to contain hyphens (freeorion)
vnum = Word(alphanums + "._-")

# a valid name for a package
val_package_name = Combine(Word(alphas + "".join((valname, "."))))

pkgname = Literal("pkgname=") + (opQuotedString(val_package_name)
          | "(" + opQuotedString(val_package_name) + ")")

pkgver = Literal("pkgver=") + vnum.leaveWhitespace() + LineEnd()

pkgrel = Literal("pkgrel=") + Word(nums)

epoch = Literal("epoch=") + Word(nums)

pkgdesc = Literal("pkgdesc=") + (QuotedString(quoteChar="'", multiline=True) | QuotedString(quoteChar='"', multiline=True))


screenshot = "screenshot=" + quotedString

# define a valid architecture
valid_arch = opQuotedString(Word(valname))

arch = Array("arch", OneOrMore(valid_arch), valid_arch)
开发者ID:ccr-tools,项目名称:aur2ccr,代码行数:32,代码来源:pkgbuild_parser.py


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