Merge hell

This commit is contained in:
rocky
2024-03-08 04:41:46 -05:00
parent 3b1742e779
commit ebe0137b2d
4 changed files with 15 additions and 6 deletions

View File

@@ -67,7 +67,8 @@ class Python25Parser(Python26Parser):
def customize_grammar_rules(self, tokens, customize):
# Remove grammar rules inherited from Python 2.6 or Python 2
self.remove_rules("""
self.remove_rules(
"""
# No jump to jumps in 2.4 so we have a single "COME_FROM", not "come_froms"
ifelsestmt ::= testexpr c_stmts_opt jf_cf_pop else_suite come_froms

View File

@@ -550,9 +550,11 @@ if __name__ == "__main__":
if PYTHON_VERSION_TRIPLE[:2] == (2, 6):
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
from uncompyle6.scanner import get_scanner
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
opcode_set = set(s.opc.opname).union(set(
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
opcode_set = set(s.opc.opname).union(
set(
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP
LAMBDA_MARKER RETURN_LAST
""".split()

View File

@@ -382,7 +382,10 @@ class Python36Parser(Python35Parser):
elif opname == "GET_AITER":
self.add_unique_doc_rules("get_aiter ::= expr GET_AITER", customize)
if not set(["MAKE_FUNCTION_0", "MAKE_FUNCTION_CLOSURE"]) in self.seen_ops:
if (
not set(["MAKE_FUNCTION_0", "MAKE_FUNCTION_CLOSURE"])
in self.seen_ops
):
self.addRule(
"""
expr ::= dict_comp_async
@@ -581,7 +584,7 @@ class Python36Parser(Python35Parser):
)
else:
self.addRule("expr ::= call_kw36", nop_func)
values = 'expr ' * token.attr
values = "expr " * token.attr
rule = "call_kw36 ::= expr %s LOAD_CONST %s" % (values, opname)
self.add_unique_rule(rule, token.kind, token.attr, customize)
elif opname == "CALL_FUNCTION_EX_KW":

View File

@@ -1347,7 +1347,10 @@ class Python37Parser(Python37BaseParser):
elif opname == "GET_AITER":
self.add_unique_doc_rules("get_aiter ::= expr GET_AITER", customize)
if not set(["MAKE_FUNCTION_0", "MAKE_FUNCTION_CLOSURE"]) in self.seen_ops:
if (
not set(["MAKE_FUNCTION_0", "MAKE_FUNCTION_CLOSURE"])
in self.seen_ops
):
self.addRule(
"""
expr ::= dict_comp_async