def grammar():
"""Define the query grammar for the external backend used for testing."""
# Hosts selection: clustershell (,!&^[]) syntax is allowed: host10[10-42].domain
hosts = pp.Word(pp.alphanums + '-_.,!&^[]')('hosts')
# Final grammar, see the docstring for its BNF based on the tokens defined above
# Groups are used to split the parsed results for an easy access
full_grammar = pp.Forward()
full_grammar << pp.Group(hosts) + pp.ZeroOrMore(pp.Group(hosts)) # pylint: disable=expression-not-assigned
return full_grammar
评论列表
文章目录