You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Sync with python-2.4 branch
This commit is contained in:
@@ -48,6 +48,9 @@ class Python23Parser(Python24Parser):
|
|||||||
expr ::= and2
|
expr ::= and2
|
||||||
and2 ::= _jump jmp_false COME_FROM expr COME_FROM
|
and2 ::= _jump jmp_false COME_FROM expr COME_FROM
|
||||||
|
|
||||||
|
import_as ::= IMPORT_NAME load_attrs designator
|
||||||
|
load_attrs ::= LOAD_ATTR+
|
||||||
|
|
||||||
conditional ::= expr jmp_false expr JUMP_FORWARD expr COME_FROM
|
conditional ::= expr jmp_false expr JUMP_FORWARD expr COME_FROM
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@@ -33,9 +33,6 @@ class Python24Parser(Python25Parser):
|
|||||||
importmultiple ::= filler LOAD_CONST import_as imports_cont
|
importmultiple ::= filler LOAD_CONST import_as imports_cont
|
||||||
import_cont ::= filler LOAD_CONST import_as
|
import_cont ::= filler LOAD_CONST import_as
|
||||||
|
|
||||||
import_as ::= IMPORT_NAME load_attrs designator
|
|
||||||
load_attrs ::= LOAD_ATTR+
|
|
||||||
|
|
||||||
# Python 2.5+ omits POP_TOP POP_BLOCK
|
# Python 2.5+ omits POP_TOP POP_BLOCK
|
||||||
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_TOP POP_BLOCK COME_FROM
|
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_TOP POP_BLOCK COME_FROM
|
||||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_TOP POP_BLOCK COME_FROM
|
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_TOP POP_BLOCK COME_FROM
|
||||||
@@ -58,6 +55,10 @@ class Python24Parser(Python25Parser):
|
|||||||
def add_custom_rules(self, tokens, customize):
|
def add_custom_rules(self, tokens, customize):
|
||||||
self.remove_rules("""
|
self.remove_rules("""
|
||||||
kvlist ::= kvlist kv3
|
kvlist ::= kvlist kv3
|
||||||
|
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK COME_FROM
|
||||||
|
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK COME_FROM
|
||||||
|
while1stmt ::= SETUP_LOOP return_stmts COME_FROM
|
||||||
|
whilestmt ::= SETUP_LOOP testexpr return_stmts POP_BLOCK COME_FROM
|
||||||
""")
|
""")
|
||||||
super(Python24Parser, self).add_custom_rules(tokens, customize)
|
super(Python24Parser, self).add_custom_rules(tokens, customize)
|
||||||
if self.version == 2.4:
|
if self.version == 2.4:
|
||||||
@@ -67,7 +68,7 @@ class Python24Parser(Python25Parser):
|
|||||||
invalid = super(Python24Parser,
|
invalid = super(Python24Parser,
|
||||||
self).reduce_is_invalid(rule, ast,
|
self).reduce_is_invalid(rule, ast,
|
||||||
tokens, first, last)
|
tokens, first, last)
|
||||||
if invalid:
|
if invalid or tokens is None:
|
||||||
return invalid
|
return invalid
|
||||||
|
|
||||||
lhs = rule[0]
|
lhs = rule[0]
|
||||||
|
Reference in New Issue
Block a user