1- # Copyright (c) 2019 by Rocky Bernstein
1+ # Copyright (c) 2019-2020 by Rocky Bernstein
22#
33# This program is free software: you can redistribute it and/or modify
44# it under the terms of the GNU General Public License as published by
1919# Python 3.8+ changes
2020#######################
2121
22- from uncompyle6 .semantics .consts import TABLE_DIRECT
22+ from uncompyle6 .semantics .consts import PRECEDENCE , TABLE_DIRECT
2323
2424def customize_for_version38 (self , version ):
2525
@@ -37,14 +37,15 @@ def customize_for_version38(self, version):
3737 '%|async for %c in %c:\n %+%c%-%|else:\n %+%c%-\n \n ' ,
3838 (7 , 'store' ), (0 , 'expr' ), (8 , 'for_block' ), (- 1 , 'else_suite' ) ),
3939
40- ' async_with_stmt38' : (
41- ' %|async with %c:\n %+%|%c%-' ,
42- (0 , ' expr' ), 7 ),
40+ " async_with_stmt38" : (
41+ " %|async with %c:\n %+%|%c%-" ,
42+ (0 , " expr" ), 7 ),
4343
44- 'async_with_as_stmt38' : (
45- '%|async with %c as %c:\n %+%|%c%-' ,
46- (0 , 'expr' ), (6 , 'store' ),
47- (7 , 'suite_stmts' ) ),
44+ "async_with_as_stmt38" : (
45+ "%|async with %c as %c:\n %+%|%c%-" ,
46+ (0 , "expr" ), (6 , "store" ),
47+ (7 , "suite_stmts" )
48+ ),
4849
4950 "call_stmt" : (
5051 "%|%c\n " , 0
@@ -80,11 +81,13 @@ def customize_for_version38(self, version):
8081 (2 , 'store' ),
8182 (0 , 'expr' ),
8283 (3 , 'for_block' ) ),
83- 'forelsestmt38' : (
84- '%|for %c in %c:\n %+%c%-%|else:\n %+%c%-\n \n ' ,
85- (2 , 'store' ),
86- (0 , 'expr' ),
87- (3 , 'for_block' ), - 2 ),
84+
85+ "forelsestmt38" : (
86+ "%|for %c in %c:\n %+%c%-%|else:\n %+%c%-\n \n " ,
87+ (2 , "store" ),
88+ (0 , "expr" ),
89+ (3 , "for_block" ), - 1 ),
90+
8891 'forelselaststmt38' : (
8992 '%|for %c in %c:\n %+%c%-%|else:\n %+%c%-' ,
9093 (2 , 'store' ),
@@ -153,6 +156,6 @@ def customize_for_version38(self, version):
153156 (2 , "suite_stmts_opt" ),
154157 (8 , "suite_stmts_opt" ) ),
155158 "named_expr" : ( # AKA "walrus operator"
156- "%c := %c " , (2 , "store" ), (0 , "expr" )
159+ "%c := %p " , (2 , "store" ), (0 , "expr" , PRECEDENCE [ "named_expr" ] - 1 )
157160 )
158161 })
0 commit comments