You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
localize 2 and 3 argument BUILD_SLICE...
Nontermninal name matches AST anme now. Add test.
This commit is contained in:
@@ -313,6 +313,21 @@ class Python2Parser(PythonParser):
|
||||
"mapexpr ::= %s %s" % (opname, kvlist_n)
|
||||
], customize)
|
||||
continue
|
||||
elif opname_base == 'BUILD_SLICE':
|
||||
slice_num = token.attr
|
||||
if slice_num == 2:
|
||||
self.add_unique_rules([
|
||||
'expr ::= slice2',
|
||||
'slice2 ::= expr expr BUILD_SLICE_2'
|
||||
], customize)
|
||||
else:
|
||||
assert slice_num == 3, ("BUILD_SLICE value must be 2 or 3; is %s" %
|
||||
slice_num)
|
||||
self.add_unique_rules([
|
||||
'expr ::= slice3',
|
||||
'slice3 ::= expr expr expr BUILD_SLICE_3',
|
||||
], customize)
|
||||
continue
|
||||
elif opname_base in ('CALL_FUNCTION', 'CALL_FUNCTION_VAR',
|
||||
'CALL_FUNCTION_VAR_KW', 'CALL_FUNCTION_KW'):
|
||||
args_pos = (v & 0xff) # positional parameters
|
||||
|
Reference in New Issue
Block a user