You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Adjust while True grammar rule
This commit is contained in:
BIN
test/bytecode_3.8/01_while_if_then.pyc
Normal file
BIN
test/bytecode_3.8/01_while_if_then.pyc
Normal file
Binary file not shown.
@@ -20,7 +20,6 @@ from __future__ import print_function
|
||||
from uncompyle6.parser import PythonParserSingle
|
||||
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
||||
from uncompyle6.parsers.parse37 import Python37Parser
|
||||
from uncompyle6.scanners.tok import Token
|
||||
|
||||
class Python38Parser(Python37Parser):
|
||||
|
||||
@@ -35,6 +34,7 @@ class Python38Parser(Python37Parser):
|
||||
stmt ::= try_except_ret38
|
||||
stmt ::= try_except38
|
||||
stmt ::= whilestmt38
|
||||
stmt ::= whileTruestmt38
|
||||
|
||||
# FIXME this should be restricted to being inside a try block
|
||||
stmt ::= except_ret38
|
||||
@@ -67,12 +67,11 @@ class Python38Parser(Python37Parser):
|
||||
whilestmt38 ::= testexpr l_stmts JUMP_BACK
|
||||
|
||||
# while1elsestmt ::= l_stmts JUMP_BACK
|
||||
whileelsestmt ::= testexpr l_stmts JUMP_BACK POP_BLOCK
|
||||
whileTruestmt ::= l_stmts JUMP_BACK POP_BLOCK
|
||||
while1stmt ::= l_stmts COME_FROM_LOOP
|
||||
while1stmt ::= l_stmts COME_FROM JUMP_BACK COME_FROM_LOOP
|
||||
whileTruestmt ::= l_stmts JUMP_BACK NOP
|
||||
whileTruestmt ::= l_stmts JUMP_BACK POP_BLOCK NOP
|
||||
whileTruestmt38 ::= l_stmts JUMP_BACK
|
||||
|
||||
for_block ::= l_stmts_opt _come_from_loops JUMP_BACK
|
||||
|
||||
except_cond1 ::= DUP_TOP expr COMPARE_OP jmp_false
|
||||
|
@@ -982,6 +982,8 @@ def customize_for_version3(self, version):
|
||||
|
||||
'whilestmt38': ( '%|while %c:\n%+%c%-\n\n',
|
||||
(0, 'testexpr'), (1, 'l_stmts') ),
|
||||
'whileTruestmt38': ( '%|while True:\n%+%c%-\n\n',
|
||||
(0, 'l_stmts') ),
|
||||
'tryfinally38': (
|
||||
'%|try:\n%+%c%-%|finally:\n%+%c%-\n\n',
|
||||
(3, 'returns'), 6 ),
|
||||
|
Reference in New Issue
Block a user