本文整理汇总了Python中pyparsing.And方法的典型用法代码示例。如果您正苦于以下问题:Python pyparsing.And方法的具体用法?Python pyparsing.And怎么用?Python pyparsing.And使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyparsing
的用法示例。
在下文中一共展示了pyparsing.And方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build_rule
# 需要导入模块: import pyparsing [as 别名]
# 或者: from pyparsing import And [as 别名]
def _build_rule(self, rule_id):
rule_config = self._record_configs[rule_id]
rule_type = rule_config.rule_type
if rule_config.rules:
rule = self._process_rules(rule_config.rules, pp.And)
else:
rule = self._build_terminal_rule(rule_config)
if rule_type in self._decorators:
rule = self._decorators[rule_type].decorate(rule, rule_config)
if 'results_name' in rule_config:
rule = rule.setResultsName(rule_config['results_name'])
else:
rule = rule.setResultsName(rule_id)
rule.setName(rule_id)
if self._debug:
rule.setDebug()
return rule
示例2: _make_matcher_element
# 需要导入模块: import pyparsing [as 别名]
# 或者: from pyparsing import And [as 别名]
def _make_matcher_element(self):
# Wrap the parser element for the referenced rule's root expansion so that
# the current match value for the NamedRuleRef is also set.
return self._set_matcher_element_attributes(pyparsing.And([
self.referenced_rule.expansion.matcher_element
]))
示例3: get_fragment_language
# 需要导入模块: import pyparsing [as 别名]
# 或者: from pyparsing import And [as 别名]
def get_fragment_language() -> ParserElement:
"""Build a protein fragment parser."""
_fragment_value_inner = fragment_range | missing_fragment(FRAGMENT_MISSING)
_fragment_value = _fragment_value_inner | And([Suppress('"'), _fragment_value_inner, Suppress('"')])
parser_element = fragment_tag + nest(_fragment_value + Optional(WCW + quote(FRAGMENT_DESCRIPTION)))
return parser_element
示例4: _process_rules_group
# 需要导入模块: import pyparsing [as 别名]
# 或者: from pyparsing import And [as 别名]
def _process_rules_group(self, rules):
group = None
group_type = rules.list_type
data = rules.rules
if group_type == 'sequence':
group = self._process_rules(data, pp.And)
elif group_type == 'option':
group = self._process_rules(data, pp.MatchFirst)
elif group_type == 'optional':
group = pp.Optional(self._process_rules(data, pp.And))
return group