Add more while1else grammar rules

Towards addressing issue #93
This commit is contained in:
rocky
2017-04-10 02:47:46 -04:00
parent b9703cf6b4
commit 9e34654b38
9 changed files with 16 additions and 4 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,8 @@
# From Python-3.5.2/Lib/multiprocessing/connection.py
def PipeClient(address):
while 1:
z = 2
else:
raise
return

View File

@@ -41,10 +41,10 @@ class Python2Parser(PythonParser):
def p_stmt2(self, args): def p_stmt2(self, args):
""" """
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK COME_FROM
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK COME_FROM while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK COME_FROM
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK else_suite COME_FROM while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK else_suite COME_FROM
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK else_suite COME_FROM
exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT
exec_stmt ::= expr exprlist EXEC_STMT exec_stmt ::= expr exprlist EXEC_STMT

View File

@@ -381,6 +381,8 @@ class Python3Parser(PythonParser):
while1stmt ::= SETUP_LOOP l_stmts COME_FROM JUMP_BACK COME_FROM_LOOP while1stmt ::= SETUP_LOOP l_stmts COME_FROM JUMP_BACK COME_FROM_LOOP
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK
else_suite COME_FROM_LOOP
# FIXME: investigate - can code really produce a NOP? # FIXME: investigate - can code really produce a NOP?
whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK NOP whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK NOP

View File

@@ -20,8 +20,10 @@ class Python35Parser(Python34Parser):
# I'm sure by the time Python 4 comes around these will be turned # I'm sure by the time Python 4 comes around these will be turned
# into special opcodes # into special opcodes
while1stmt ::= SETUP_LOOP l_stmts COME_FROM JUMP_BACK while1stmt ::= SETUP_LOOP l_stmts COME_FROM JUMP_BACK
POP_BLOCK COME_FROM_LOOP POP_BLOCK COME_FROM_LOOP
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK
POP_BLOCK else_suite COME_FROM_LOOP
# Python 3.5+ Await statement # Python 3.5+ Await statement
stmt ::= await_stmt stmt ::= await_stmt