本文整理匯總了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