Add await expr

Fixes #111
This commit is contained in:
rocky
2017-04-22 10:34:21 -04:00
parent 8081decf7c
commit 87db833f62
4 changed files with 10 additions and 2 deletions

Binary file not shown.

View File

@@ -27,3 +27,6 @@ async def awith_as_test():
async def f(z):
await z
async def g(z):
return await z

View File

@@ -27,8 +27,12 @@ class Python35Parser(Python34Parser):
POP_BLOCK else_suite COME_FROM_LOOP
# Python 3.5+ Await statement
expr ::= await_expr
await_expr ::= expr GET_AWAITABLE LOAD_CONST YIELD_FROM
stmt ::= await_stmt
await_stmt ::= expr GET_AWAITABLE LOAD_CONST YIELD_FROM POP_TOP
await_stmt ::= await_expr POP_TOP
# Python 3.5+ has WITH_CLEANUP_START/FINISH

View File

@@ -335,7 +335,8 @@ class SourceWalker(GenericASTTraversal, object):
#######################
if version >= 3.5:
TABLE_DIRECT.update({
'await_stmt': ( '%|await %c', 0),
'await_expr': ( 'await %c', 0),
'await_stmt': ( '%|%c', 0),
'async_for_stmt': (
'%|async for %c in %c:\n%+%c%-\n\n', 9, 1, 25 ),
'async_forelse_stmt': (