From 0bfd6c33fa5af32a0e095bf2c3f645db259ef96c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 12 Jan 1996 01:00:58 +0000 Subject: [PATCH] Added power (**) operator --- Grammar/Grammar | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Grammar/Grammar b/Grammar/Grammar index f1b5117e91c..3d957a79940 100644 --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -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)* [',']