You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Python 2.3 list comprehensions
This commit is contained in:
BIN
test/bytecode_2.3/01_list_comprehension.pyc
Normal file
BIN
test/bytecode_2.3/01_list_comprehension.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.3/06_list_ifnot.pyc
Normal file
BIN
test/bytecode_2.3/06_list_ifnot.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.3/06_list_ifnot_and.pyc
Normal file
BIN
test/bytecode_2.3/06_list_ifnot_and.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.3/11-list-if.pyc
Normal file
BIN
test/bytecode_2.3/11-list-if.pyc
Normal file
Binary file not shown.
@@ -10,6 +10,22 @@
|
||||
# Python 3 grammar includes:
|
||||
# listcomp ::= LOAD_LISTCOMP LOAD_CONST MAKE_FUNCTION_0 expr GET_ITER CALL_FUNCTION_1
|
||||
|
||||
[ i for i in (1, 2, 3, 4) ]
|
||||
[ i+1 for i in (1, 2, 3, 4) ]
|
||||
[ i * i for i in range(4) ]
|
||||
# Add line spacing to assist in seeing which parts go where
|
||||
# in assembly and code
|
||||
|
||||
[ i
|
||||
for
|
||||
i in
|
||||
(1, 2, 3, 4)
|
||||
]
|
||||
|
||||
[ i+1
|
||||
for
|
||||
i in
|
||||
(1, 2, 3, 4)
|
||||
]
|
||||
|
||||
[ i * i
|
||||
for
|
||||
i in
|
||||
range(4) ]
|
||||
|
@@ -20,6 +20,12 @@ class Python23Parser(Python24Parser):
|
||||
COME_FROM POP_TOP POP_BLOCK COME_FROM
|
||||
|
||||
list_compr ::= BUILD_LIST_0 DUP_TOP LOAD_ATTR designator list_iter del_stmt
|
||||
list_for ::= expr _for designator list_iter JUMP_BACK come_froms POP_TOP JUMP_BACK
|
||||
|
||||
lc_body ::= LOAD_NAME expr CALL_FUNCTION_1 POP_TOP
|
||||
lc_body ::= LOAD_FAST expr CALL_FUNCTION_1 POP_TOP
|
||||
lc_body ::= LOAD_NAME expr LIST_APPEND
|
||||
lc_body ::= LOAD_FAST expr LIST_APPEND
|
||||
'''
|
||||
|
||||
class Python23ParserSingle(Python23Parser, PythonParserSingle):
|
||||
|
Reference in New Issue
Block a user