You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Python 2.4- doesn't have condition expresions
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2016-2017 Rocky Bernstein
|
# Copyright (c) 2016-2017, 2020 Rocky Bernstein
|
||||||
# Copyright (c) 2000-2002 by hartmut Goebel <hartmut@goebel.noris.de>
|
# Copyright (c) 2000-2002 by hartmut Goebel <hartmut@goebel.noris.de>
|
||||||
|
|
||||||
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
||||||
@@ -19,9 +19,6 @@ class Python21Parser(Python22Parser):
|
|||||||
for ::= SETUP_LOOP expr for_iter store
|
for ::= SETUP_LOOP expr for_iter store
|
||||||
l_stmts_opt _jump_back
|
l_stmts_opt _jump_back
|
||||||
POP_BLOCK COME_FROM
|
POP_BLOCK COME_FROM
|
||||||
|
|
||||||
expr ::= conditional
|
|
||||||
conditional ::= expr jmp_false expr JUMP_ABSOLUTE expr
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def p_import21(self, args):
|
def p_import21(self, args):
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2016-2018 Rocky Bernstein
|
# Copyright (c) 2016-2018, 2020 Rocky Bernstein
|
||||||
"""
|
"""
|
||||||
spark grammar differences over Python2.5 for Python 2.4.
|
spark grammar differences over Python2.5 for Python 2.4.
|
||||||
"""
|
"""
|
||||||
@@ -56,6 +56,12 @@ class Python24Parser(Python25Parser):
|
|||||||
kv2 ::= DUP_TOP expr expr ROT_THREE STORE_SUBSCR
|
kv2 ::= DUP_TOP expr expr ROT_THREE STORE_SUBSCR
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
def remove_rules_24(self):
|
||||||
|
self.remove_rules("""
|
||||||
|
expr ::= conditional
|
||||||
|
""")
|
||||||
|
|
||||||
|
|
||||||
def customize_grammar_rules(self, tokens, customize):
|
def customize_grammar_rules(self, tokens, customize):
|
||||||
self.remove_rules("""
|
self.remove_rules("""
|
||||||
gen_comp_body ::= expr YIELD_VALUE POP_TOP
|
gen_comp_body ::= expr YIELD_VALUE POP_TOP
|
||||||
@@ -72,6 +78,7 @@ class Python24Parser(Python25Parser):
|
|||||||
stmt ::= withasstmt
|
stmt ::= withasstmt
|
||||||
""")
|
""")
|
||||||
super(Python24Parser, self).customize_grammar_rules(tokens, customize)
|
super(Python24Parser, self).customize_grammar_rules(tokens, customize)
|
||||||
|
self.remove_rules_24()
|
||||||
if self.version == 2.4:
|
if self.version == 2.4:
|
||||||
self.check_reduce['nop_stmt'] = 'tokens'
|
self.check_reduce['nop_stmt'] = 'tokens'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user