Run black on express/

This commit is contained in:
Thomas Krijnen
2026-02-26 12:36:01 +01:00
parent 18527a78e1
commit 077a0c3755
11 changed files with 239 additions and 222 deletions
@@ -163,7 +163,18 @@ statements = []
terminals = reduce(lambda x, y: x | y, (find_bytype(e, Terminal) for id, e in express))
keywords = list(filter(operator.attrgetter("is_keyword"), terminals))
negated_keywords = map(lambda s: "~%s" % s, keywords)
no_action = {"letter", "digit", "digits", "real_literal", "integer_literal", "string_literal", "simple_string_literal", "letter", "not_quote", "not_paren_star_quote_special"}
no_action = {
"letter",
"digit",
"digits",
"real_literal",
"integer_literal",
"string_literal",
"simple_string_literal",
"letter",
"not_quote",
"not_paren_star_quote_special",
}
while True:
emitted_in_loop = set()
@@ -194,7 +205,9 @@ for id in to_emit:
if id in to_combine:
stmt = "Suppress%s" % stmt
if id not in no_action and not isinstance(expr.contents, Keyword):
children = list(map(operator.attrgetter('contents'), reduce(lambda x, y: x | y, (find_bytype(e, Keyword) for e in [expr]))))
children = list(
map(operator.attrgetter("contents"), reduce(lambda x, y: x | y, (find_bytype(e, Keyword) for e in [expr])))
)
has_duplicates = len(children) > len(set(children))
node_type = "ListNode" if ("ZeroOrMore" in stmt or has_duplicates) else "Node"
action = ".setParseAction(%s)" % (
@@ -243,5 +256,4 @@ if __name__ == "__main__":
mdl = importlib.import_module(output)
mdl.Generator(m).emit()
sys.stdout.write(m.schema.name)
""" % ("\n ".join(statements))
)
""" % ("\n ".join(statements)))