Fixes PEP 505 grammar (#699)

This commit is contained in:
Steve Dower 2018-07-08 15:55:45 -07:00 committed by GitHub
parent bd6332d245
commit 3e128e568b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -62,10 +62,9 @@ The following rules of the Python grammar are updated to read::
augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
'<<=' | '>>=' | '**=' | '//=' | '??=')
term: coalesce (('*'|'@'|'/'|'%'|'//') coalesce)*
coalesce: factor ('??' factor)*
# factor eventually resolved to atom_expr
power: coalesce ['**' factor]
coalesce: atom_expr ['??' factor]
atom_expr: ['await'] atom trailer*
trailer: ('(' [arglist] ')' |
'[' subscriptlist ']' |
@ -83,8 +82,8 @@ determined to be ``None``. For example::
def c(): return None
def ex(): raise Exception()
(a ?? 2 ** b ?? 3) == a ?? (2 ** b) ?? 3
(a * b ?? c // d) == (a * b) ?? (c // d)
(a ?? 2 ** b ?? 3) == a ?? (2 ** (b ?? 3))
(a * b ?? c // d) == a * (b ?? c) // d
(a ?? True and b ?? False) == (a ?? True) and (b ?? False)
(c() ?? c() ?? True) == True
(True ?? ex()) == True