You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Grammar isolation fixes
This commit is contained in:
@@ -37,12 +37,6 @@ def test_grammar():
|
||||
else:
|
||||
expect_lhs.add('kwarg')
|
||||
|
||||
# FIXME: grammar remove_rule on
|
||||
# kv3 ::= expr expr STORE_MAP
|
||||
# doesn't currently work in grammar, so we have this extraneous kv3 around.
|
||||
if 3.3 <= PYTHON_VERSION <= 3.4:
|
||||
expect_lhs.add('kv3')
|
||||
|
||||
assert expect_lhs == set(lhs)
|
||||
assert unused_rhs == set(rhs)
|
||||
assert expect_right_recursive == right_recursive
|
||||
|
@@ -400,7 +400,6 @@ class PythonParser(GenericASTBuilder):
|
||||
def p_list_comprehension(self, args):
|
||||
"""
|
||||
expr ::= list_compr
|
||||
list_compr ::= BUILD_LIST_0 list_iter
|
||||
|
||||
list_iter ::= list_for
|
||||
list_iter ::= list_if
|
||||
@@ -409,8 +408,6 @@ class PythonParser(GenericASTBuilder):
|
||||
|
||||
list_if ::= expr jmp_false list_iter
|
||||
list_if_not ::= expr jmp_true list_iter
|
||||
|
||||
lc_body ::= expr LIST_APPEND
|
||||
"""
|
||||
|
||||
def p_setcomp(self, args):
|
||||
|
@@ -15,6 +15,8 @@ class Python27Parser(Python2Parser):
|
||||
def p_comprehension27(self, args):
|
||||
"""
|
||||
list_for ::= expr _for designator list_iter JUMP_BACK
|
||||
list_compr ::= BUILD_LIST_0 list_iter
|
||||
lc_body ::= expr LIST_APPEND
|
||||
|
||||
stmt ::= setcomp_func
|
||||
|
||||
|
@@ -49,7 +49,12 @@ class Python32Parser(Python3Parser):
|
||||
|
||||
stmt ::= del_deref_stmt
|
||||
del_deref_stmt ::= DELETE_DEREF
|
||||
kv3 ::= expr expr STORE_MAP
|
||||
|
||||
list_compr ::= BUILD_LIST_0 list_iter
|
||||
lc_body ::= expr LIST_APPEND
|
||||
|
||||
kvlist ::= kvlist kv3
|
||||
kv3 ::= expr expr STORE_MAP
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class Python33Parser(Python32Parser):
|
||||
trystmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
|
||||
try_middle
|
||||
jump_excepts come_from_except_clauses
|
||||
kvlist ::= kvlist kv3
|
||||
mapexpr ::= BUILD_MAP kvlist
|
||||
"""
|
||||
|
||||
def add_custom_rules(self, tokens, customize):
|
||||
|
Reference in New Issue
Block a user