diff options
author | Yury Selivanov <yury@magic.io> | 2016-09-08 20:50:03 -0700 |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-09-08 20:50:03 -0700 |
commit | b164476aaf77ceffac36ddbbdc7f4df90fbfebd3 (patch) | |
tree | 0a744472fe547a36f970c59528e48aebd01de75e /Lib/lib2to3/Grammar.txt | |
parent | 61f296e12ff25b48169250d726b92d589e0221af (diff) | |
download | cpython-b164476aaf77ceffac36ddbbdc7f4df90fbfebd3.tar.gz |
Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.
Patch by Ivan Levkivskyi.
Diffstat (limited to 'Lib/lib2to3/Grammar.txt')
-rw-r--r-- | Lib/lib2to3/Grammar.txt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/lib2to3/Grammar.txt b/Lib/lib2to3/Grammar.txt index c954669e8a..abe1268c27 100644 --- a/Lib/lib2to3/Grammar.txt +++ b/Lib/lib2to3/Grammar.txt @@ -54,12 +54,13 @@ stmt: simple_stmt | compound_stmt simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt) -expr_stmt: testlist_star_expr (augassign (yield_expr|testlist) | +expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) | ('=' (yield_expr|testlist_star_expr))*) +annassign: ':' test ['=' test] testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [','] augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//=') -# For normal assignments, additional restrictions enforced by the interpreter +# For normal and annotated assignments, additional restrictions enforced by the interpreter print_stmt: 'print' ( [ test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ] ) del_stmt: 'del' exprlist |