Grammar rule for 3.6 with .. return

This commit is contained in:
rocky
2017-12-15 08:24:52 -05:00
parent 3b0eb017b6
commit b736e0a0e2
3 changed files with 4 additions and 2 deletions

Binary file not shown.

View File

@@ -120,6 +120,8 @@ class Python36Parser(Python35Parser):
rules_str = """ rules_str = """
withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt POP_BLOCK LOAD_CONST withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt POP_BLOCK LOAD_CONST
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt COME_FROM_WITH
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
# Removes POP_BLOCK LOAD_CONST from 3.6- # Removes POP_BLOCK LOAD_CONST from 3.6-
withasstmt ::= expr SETUP_WITH store suite_stmts_opt COME_FROM_WITH withasstmt ::= expr SETUP_WITH store suite_stmts_opt COME_FROM_WITH

View File

@@ -628,8 +628,8 @@ class SourceWalker(GenericASTTraversal, object):
assert tup == 'tuple' assert tup == 'tuple'
self.call36_tuple(tup) self.call36_tuple(tup)
expr = node[2] expr = node[2]
assert expr == 'expr' if len(tup) > 0:
if tup[0].attr > 0: # if tup[0].attr > 0:
self.write(', ') self.write(', ')
self.write('**') self.write('**')
self.preorder(expr) self.preorder(expr)