You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Python 2 "for" grammar rule isolation
This commit is contained in:
@@ -431,9 +431,6 @@ class PythonParser(GenericASTBuilder):
|
|||||||
|
|
||||||
for_block ::= l_stmts_opt _come_froms JUMP_BACK
|
for_block ::= l_stmts_opt _come_froms JUMP_BACK
|
||||||
|
|
||||||
for ::= SETUP_LOOP expr for_iter store
|
|
||||||
for_block POP_BLOCK _come_froms
|
|
||||||
|
|
||||||
forelsestmt ::= SETUP_LOOP expr for_iter store
|
forelsestmt ::= SETUP_LOOP expr for_iter store
|
||||||
for_block POP_BLOCK else_suite _come_froms
|
for_block POP_BLOCK else_suite _come_froms
|
||||||
|
|
||||||
|
@@ -95,6 +95,9 @@ class Python2Parser(PythonParser):
|
|||||||
raise_stmt2 ::= expr expr RAISE_VARARGS_2
|
raise_stmt2 ::= expr expr RAISE_VARARGS_2
|
||||||
raise_stmt3 ::= expr expr expr RAISE_VARARGS_3
|
raise_stmt3 ::= expr expr expr RAISE_VARARGS_3
|
||||||
|
|
||||||
|
for ::= SETUP_LOOP expr for_iter store
|
||||||
|
for_block POP_BLOCK _come_froms
|
||||||
|
|
||||||
del_stmt ::= expr DELETE_SLICE+0
|
del_stmt ::= expr DELETE_SLICE+0
|
||||||
del_stmt ::= expr expr DELETE_SLICE+1
|
del_stmt ::= expr expr DELETE_SLICE+1
|
||||||
del_stmt ::= expr expr DELETE_SLICE+2
|
del_stmt ::= expr expr DELETE_SLICE+2
|
||||||
|
@@ -93,7 +93,6 @@ class Python36Parser(Python35Parser):
|
|||||||
def customize_grammar_rules(self, tokens, customize):
|
def customize_grammar_rules(self, tokens, customize):
|
||||||
super(Python36Parser, self).customize_grammar_rules(tokens, customize)
|
super(Python36Parser, self).customize_grammar_rules(tokens, customize)
|
||||||
self.remove_rules("""
|
self.remove_rules("""
|
||||||
for ::= SETUP_LOOP expr for_iter store for_block POP_BLOCK _come_froms
|
|
||||||
dict_comp ::= load_closure LOAD_DICTCOMP LOAD_CONST MAKE_CLOSURE_0 expr GET_ITER CALL_FUNCTION_1
|
dict_comp ::= load_closure LOAD_DICTCOMP LOAD_CONST MAKE_CLOSURE_0 expr GET_ITER CALL_FUNCTION_1
|
||||||
""")
|
""")
|
||||||
self.check_reduce['call_kw'] = 'AST'
|
self.check_reduce['call_kw'] = 'AST'
|
||||||
|
Reference in New Issue
Block a user