diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2017-10-06 03:24:46 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2017-10-06 03:24:46 (GMT) |
commit | ac317700ce7439e38a8b420218d9a5035bba92ed (patch) | |
tree | ddeb7d90f2e90b73a37783b88ef77376d9d996f5 /Grammar | |
parent | 2084b30e540d88b9fc752c5bdcc2f24334af4f2b (diff) | |
download | cpython-ac317700ce7439e38a8b420218d9a5035bba92ed.zip cpython-ac317700ce7439e38a8b420218d9a5035bba92ed.tar.gz cpython-ac317700ce7439e38a8b420218d9a5035bba92ed.tar.bz2 |
bpo-30406: Make async and await proper keywords (#1669)
Per PEP 492, 'async' and 'await' should become proper keywords in 3.7.
Diffstat (limited to 'Grammar')
-rw-r--r-- | Grammar/Grammar | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar index 9058243..7d3dd0b 100644 --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -16,7 +16,7 @@ decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE decorators: decorator+ decorated: decorators (classdef | funcdef | async_funcdef) -async_funcdef: ASYNC funcdef +async_funcdef: 'async' funcdef funcdef: 'def' NAME parameters ['->' test] ':' suite parameters: '(' [typedargslist] ')' @@ -68,7 +68,7 @@ nonlocal_stmt: 'nonlocal' NAME (',' NAME)* assert_stmt: 'assert' test [',' test] compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt -async_stmt: ASYNC (funcdef | with_stmt | for_stmt) +async_stmt: 'async' (funcdef | with_stmt | for_stmt) if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] while_stmt: 'while' test ':' suite ['else' ':' suite] for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite] @@ -103,7 +103,7 @@ arith_expr: term (('+'|'-') term)* term: factor (('*'|'@'|'/'|'%'|'//') factor)* factor: ('+'|'-'|'~') factor | power power: atom_expr ['**' factor] -atom_expr: [AWAIT] atom trailer* +atom_expr: ['await'] atom trailer* atom: ('(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']' | '{' [dictorsetmaker] '}' | @@ -139,7 +139,8 @@ argument: ( test [comp_for] | '*' test ) comp_iter: comp_for | comp_if -comp_for: [ASYNC] 'for' exprlist 'in' or_test [comp_iter] +sync_comp_for: 'for' exprlist 'in' or_test [comp_iter] +comp_for: ['async'] sync_comp_for comp_if: 'if' test_nocond [comp_iter] # not used in grammar, but may appear in "node" passed from Parser to Compiler |