Skip to content

Commit 6974567

Browse files
committed
Reorganize parse2.py to remove useless rule in 2.7
1 parent 994c749 commit 6974567

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

pytest/test_grammar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def check_tokens(tokens, opcode_set):
3939
s = get_scanner(PYTHON_VERSION, IS_PYPY)
4040
ignore_set = set(
4141
"""
42-
JUMP_BACK CONTINUE RETURN_END_IF
42+
JUMP_BACK CONTINUE RETURN_END_IF THEN
4343
COME_FROM COME_FROM_EXCEPT COME_FROM_LOOP COME_FROM_WITH
4444
COME_FROM_FINALLY ELSE
4545
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP

uncompyle6/parsers/parse2.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,12 @@ def p_grammar(self, args):
136136
137137
_ifstmts_jump ::= return_if_stmts
138138
139-
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE
140-
139+
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE
141140
iflaststmtl ::= testexpr c_stmts_opt JUMP_BACK
142-
143-
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite COME_FROM
144-
ifelsestmt ::= testexpr_then c_stmts_opt jf_cf_pop else_suite come_froms
145-
141+
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite COME_FROM
146142
ifelsestmtc ::= testexpr c_stmts_opt JUMP_ABSOLUTE else_suitec
147143
148144
ifelsestmtr ::= testexpr return_if_stmts return_stmts
149-
150145
ifelsestmtr ::= testexpr return_if_stmts COME_FROM return_stmts
151146
152147
ifelsestmtl ::= testexpr c_stmts_opt JUMP_BACK else_suitel

uncompyle6/parsers/parse26.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def p_stmt26(self, args):
113113
114114
break_stmt ::= BREAK_LOOP JUMP_BACK
115115
116+
ifelsestmt ::= testexpr_then c_stmts_opt jf_cf_pop else_suite come_froms
117+
116118
# Semantic actions want else_suitel to be at index 3
117119
ifelsestmtl ::= testexpr c_stmts_opt jb_cf_pop else_suitel
118120
ifelsestmtc ::= testexpr c_stmts_opt ja_cf_pop else_suitec

0 commit comments

Comments
 (0)