mirror of https://github.com/python/cpython
Added power (**) operator
This commit is contained in:
parent
5990592b71
commit
0bfd6c33fa
|
@ -23,7 +23,7 @@ eval_input: testlist NEWLINE* ENDMARKER
|
|||
|
||||
funcdef: 'def' NAME parameters ':' suite
|
||||
parameters: '(' [varargslist] ')'
|
||||
varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' '*' '*' NAME] | '*' '*' NAME) | fpdef ['=' test] (',' fpdef ['=' test])* [',']
|
||||
varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME] | ('**'|'*' '*') NAME) | fpdef ['=' test] (',' fpdef ['=' test])* [',']
|
||||
fpdef: NAME | '(' fplist ')'
|
||||
fplist: fpdef (',' fpdef)* [',']
|
||||
|
||||
|
@ -70,11 +70,12 @@ and_expr: shift_expr ('&' shift_expr)*
|
|||
shift_expr: arith_expr (('<<'|'>>') arith_expr)*
|
||||
arith_expr: term (('+'|'-') term)*
|
||||
term: factor (('*'|'/'|'%') factor)*
|
||||
factor: ('+'|'-'|'~') factor | atom trailer*
|
||||
factor: ('+'|'-'|'~') factor | power
|
||||
power: atom trailer* ('**' factor)*
|
||||
atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
|
||||
lambdef: 'lambda' [varargslist] ':' test
|
||||
trailer: '(' [arglist] ')' | '[' subscript ']' | '.' NAME
|
||||
subscript: test | [test] ':' [test]
|
||||
subscript: test (',' test)* [','] | [test] ':' [test]
|
||||
exprlist: expr (',' expr)* [',']
|
||||
testlist: test (',' test)* [',']
|
||||
dictmaker: test ':' test (',' test ':' test)* [',']
|
||||
|
|
Loading…
Reference in New Issue