You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Merge hell
This commit is contained in:
@@ -67,7 +67,8 @@ class Python25Parser(Python26Parser):
|
|||||||
|
|
||||||
def customize_grammar_rules(self, tokens, customize):
|
def customize_grammar_rules(self, tokens, customize):
|
||||||
# Remove grammar rules inherited from Python 2.6 or Python 2
|
# 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"
|
# 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
|
ifelsestmt ::= testexpr c_stmts_opt jf_cf_pop else_suite come_froms
|
||||||
|
|
||||||
|
@@ -550,9 +550,11 @@ if __name__ == "__main__":
|
|||||||
if PYTHON_VERSION_TRIPLE[:2] == (2, 6):
|
if PYTHON_VERSION_TRIPLE[:2] == (2, 6):
|
||||||
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
|
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
|
||||||
from uncompyle6.scanner import get_scanner
|
from uncompyle6.scanner import get_scanner
|
||||||
|
|
||||||
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
|
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
|
||||||
opcode_set = set(s.opc.opname).union(set(
|
opcode_set = set(s.opc.opname).union(
|
||||||
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
|
set(
|
||||||
|
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
|
||||||
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP
|
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP
|
||||||
LAMBDA_MARKER RETURN_LAST
|
LAMBDA_MARKER RETURN_LAST
|
||||||
""".split()
|
""".split()
|
||||||
|
@@ -382,7 +382,10 @@ class Python36Parser(Python35Parser):
|
|||||||
elif opname == "GET_AITER":
|
elif opname == "GET_AITER":
|
||||||
self.add_unique_doc_rules("get_aiter ::= expr GET_AITER", customize)
|
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(
|
self.addRule(
|
||||||
"""
|
"""
|
||||||
expr ::= dict_comp_async
|
expr ::= dict_comp_async
|
||||||
@@ -581,7 +584,7 @@ class Python36Parser(Python35Parser):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.addRule("expr ::= call_kw36", nop_func)
|
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)
|
rule = "call_kw36 ::= expr %s LOAD_CONST %s" % (values, opname)
|
||||||
self.add_unique_rule(rule, token.kind, token.attr, customize)
|
self.add_unique_rule(rule, token.kind, token.attr, customize)
|
||||||
elif opname == "CALL_FUNCTION_EX_KW":
|
elif opname == "CALL_FUNCTION_EX_KW":
|
||||||
|
@@ -1347,7 +1347,10 @@ class Python37Parser(Python37BaseParser):
|
|||||||
elif opname == "GET_AITER":
|
elif opname == "GET_AITER":
|
||||||
self.add_unique_doc_rules("get_aiter ::= expr GET_AITER", customize)
|
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(
|
self.addRule(
|
||||||
"""
|
"""
|
||||||
expr ::= dict_comp_async
|
expr ::= dict_comp_async
|
||||||
|
Reference in New Issue
Block a user