diff --git a/uncompyle6/parser.py b/uncompyle6/parser.py index 508c6124..123d0a56 100644 --- a/uncompyle6/parser.py +++ b/uncompyle6/parser.py @@ -39,7 +39,10 @@ class PythonParser(GenericASTBuilder): 'print_items', # PyPy: 'imports_cont', - 'kvlist_n'] + 'kvlist_n', + # Python 3.6+ + 'joined_str', + ] self.collect = frozenset(nt_list) def ast_first_offset(self, ast): diff --git a/uncompyle6/parsers/parse36.py b/uncompyle6/parsers/parse36.py index 479761f3..9976e9a8 100644 --- a/uncompyle6/parsers/parse36.py +++ b/uncompyle6/parsers/parse36.py @@ -88,20 +88,20 @@ class Python36Parser(Python35Parser): self.add_unique_doc_rules(rules_str, customize) elif opname == 'BUILD_STRING': v = token.attr - fstring_expr_or_str_n = "fstring_expr_or_str_%s" % v + joined_str_n = "formatted_value_%s" % v rules_str = """ - expr ::= fstring_expr - fstring_expr ::= expr FORMAT_VALUE - str ::= LOAD_CONST - fstring_expr_or_str ::= fstring_expr - fstring_expr_or_str ::= str + expr ::= fstring_expr + fstring_expr ::= expr FORMAT_VALUE + str ::= LOAD_CONST + formatted_value ::= fstring_expr + formatted_value ::= str expr ::= fstring_multi - fstring_multi ::= fstring_expr_or_strs BUILD_STRING - fstring_expr_or_strs ::= fstring_expr_or_str+ + fstring_multi ::= joined_str BUILD_STRING + joined_str ::= formatted_value+ fstring_multi ::= %s BUILD_STRING %s ::= %sBUILD_STRING - """ % (fstring_expr_or_str_n, fstring_expr_or_str_n, "fstring_expr_or_str " * v) + """ % (joined_str_n, joined_str_n, "formatted_value " * v) self.add_unique_doc_rules(rules_str, customize) def custom_classfunc_rule(self, opname, token, customize,