From 037648577f8d11267697dc38db7b6c8f56f30feb Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 23 Apr 2018 15:16:03 -0400 Subject: [PATCH] Start to narrow 3.7 FUNCTION_EX grammar --- uncompyle6/parsers/parse36.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/uncompyle6/parsers/parse36.py b/uncompyle6/parsers/parse36.py index 8397809d..f5a66f16 100644 --- a/uncompyle6/parsers/parse36.py +++ b/uncompyle6/parsers/parse36.py @@ -294,20 +294,30 @@ class Python36Parser(Python35Parser): call_ex ::= expr starred CALL_FUNCTION_EX """, nop_func) if self.version > 3.6: - self.addRule(""" - expr ::= call_ex_kw + if 'BUILD_TUPLE_UNPACK_WITH_CALL' in self.seen_ops: + self.addRule(""" expr ::= call_ex_kw3 - expr ::= call_ex_kw4 call_ex_kw3 ::= expr build_tuple_unpack_with_call - expr + %s CALL_FUNCTION_EX + """ % 'expr '* token.attr, nop_func) + elif 'BUILD_MAP_UNPACK_WITH_CALL' in self.seen_ops: + # FIXME: Is this right? + self.addRule(""" + expr ::= call_ex_kw + call_ex_kw ::= expr expr + build_map_unpack_with_call CALL_FUNCTION_EX + """, nop_func) + pass + + # FIXME: Is this right? + self.addRule(""" + expr ::= call_ex_kw4 call_ex_kw4 ::= expr expr expr CALL_FUNCTION_EX - call_ex_kw ::= expr expr - build_map_unpack_with_call CALL_FUNCTION_EX """, nop_func) pass else: