while1 grammar rule cleanup

Closes #172
This commit is contained in:
rocky
2018-04-27 10:57:27 -04:00
parent c0022ed5b7
commit f1e48fb60a
6 changed files with 7 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -19,10 +19,15 @@ while 1:
while 1:
if __name__:
while 1:
if y:
if __name__:
break
raise RuntimeError
elif __file__:
x = 2
else:
raise RuntimeError
# Degenerate case. Note: we can't run becase this causes an infinite loop.
# Suggested in issue #172
while 1:
pass

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2016-2017 Rocky Bernstein
# Copyright (c) 2016-2018 Rocky Bernstein
# Copyright (c) 2000-2002 by hartmut Goebel <hartmut@goebel.noris.de>
# Copyright (c) 1999 John Aycock
@@ -32,9 +32,6 @@ class Python23Parser(Python24Parser):
while1stmt ::= _while1test l_stmts_opt JUMP_BACK
POP_TOP POP_BLOCK COME_FROM
while1stmt ::= _while1test l_stmts_opt JUMP_BACK
POP_TOP POP_BLOCK
while1stmt ::= _while1test l_stmts_opt JUMP_BACK
COME_FROM POP_TOP POP_BLOCK COME_FROM

View File

@@ -171,7 +171,6 @@ class Python27Parser(Python2Parser):
def customize_grammar_rules(self, tokens, customize):
# 2.7 changes COME_FROM to COME_FROM_FINALLY
self.remove_rules("""
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK COME_FROM
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK else_suite COME_FROM
tryfinallystmt ::= SETUP_FINALLY suite_stmts_opt POP_BLOCK LOAD_CONST COME_FROM suite_stmts_opt END_FINALLY
""")