Added power (**) operator

This commit is contained in:
Guido van Rossum 1996-01-12 01:00:58 +00:00
parent 5990592b71
commit 0bfd6c33fa
1 changed files with 4 additions and 3 deletions

View File

@ -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)* [',']