8282 ),
8383 ),
8484 (
85- 'ifelsestmtc' ,
86- (
87- 'testexpr' ,
88- 'c_stmts_opt' ,
89- 'JUMP_FORWARD' ,
90- 'else_suite' ,
91- 'come_froms'
92- ),
85+ "ifelsestmtc" ,
86+ ("testexpr" , "c_stmts_opt" , "JUMP_FORWARD" , "else_suite" , "come_froms" ),
9387 ),
9488 (
9589 "ifelsestmt" ,
155149
156150
157151def ifelsestmt (self , lhs , n , rule , tree , tokens , first , last ):
158-
159152 if (last + 1 ) < n and tokens [last + 1 ] == "COME_FROM_LOOP" and lhs != "ifelsestmtc" :
160153 # ifelsestmt jumped outside of loop. No good.
161154 return True
@@ -176,10 +169,7 @@ def ifelsestmt(self, lhs, n, rule, tree, tokens, first, last):
176169 stmts = tree [1 ]
177170 if stmts in ("c_stmts" ,) and len (stmts ) == 1 :
178171 raise_stmt1 = stmts [0 ]
179- if (
180- raise_stmt1 == "raise_stmt1" and
181- raise_stmt1 [0 ] in ("LOAD_ASSERT" ,)
182- ):
172+ if raise_stmt1 == "raise_stmt1" and raise_stmt1 [0 ] in ("LOAD_ASSERT" ,):
183173 return True
184174
185175 # Make sure all the offsets from the "come froms" at the
@@ -277,17 +267,18 @@ def ifelsestmt(self, lhs, n, rule, tree, tokens, first, last):
277267 # only if we are trying to match or reduce an "if"
278268 # statement of the kind that can occur only inside a
279269 # loop construct.
270+
280271 if lhs in ("ifelsestmtl" , "ifelsestmtc" ):
281272 jump_false = jmp
282273 if (
283- tree [2 ].kind == "JUMP_FORWARD"
274+ tree [2 ].kind in ( "JUMP_FORWARD" , "JUMP_ABSOLUTE" )
284275 and jump_false == "jmp_false"
285276 and len (else_suite ) == 1
286277 ):
287278 suite_stmts = else_suite [0 ]
288279 continue_stmt = suite_stmts [0 ]
289280 if (
290- suite_stmts == "suite_stmts"
281+ suite_stmts in ( "suite_stmts" , "c_stmts" )
291282 and len (suite_stmts ) == 1
292283 and continue_stmt == "continue"
293284 and jump_false [0 ].attr == continue_stmt [0 ].attr
0 commit comments