Fixes PEP 505 grammar (#699)
This commit is contained in:
parent
bd6332d245
commit
3e128e568b
|
@ -62,10 +62,9 @@ The following rules of the Python grammar are updated to read::
|
||||||
|
|
||||||
augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
|
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*
|
atom_expr: ['await'] atom trailer*
|
||||||
trailer: ('(' [arglist] ')' |
|
trailer: ('(' [arglist] ')' |
|
||||||
'[' subscriptlist ']' |
|
'[' subscriptlist ']' |
|
||||||
|
@ -83,8 +82,8 @@ determined to be ``None``. For example::
|
||||||
def c(): return None
|
def c(): return None
|
||||||
def ex(): raise Exception()
|
def ex(): raise Exception()
|
||||||
|
|
||||||
(a ?? 2 ** b ?? 3) == a ?? (2 ** b) ?? 3
|
(a ?? 2 ** b ?? 3) == a ?? (2 ** (b ?? 3))
|
||||||
(a * b ?? c // d) == (a * b) ?? (c // d)
|
(a * b ?? c // d) == a * (b ?? c) // d
|
||||||
(a ?? True and b ?? False) == (a ?? True) and (b ?? False)
|
(a ?? True and b ?? False) == (a ?? True) and (b ?? False)
|
||||||
(c() ?? c() ?? True) == True
|
(c() ?? c() ?? True) == True
|
||||||
(True ?? ex()) == True
|
(True ?? ex()) == True
|
||||||
|
|
Loading…
Reference in New Issue