summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-01-12 01:00:58 (GMT)
committerGuido van Rossum <guido@python.org>1996-01-12 01:00:58 (GMT)
commit0bfd6c33fa5af32a0e095bf2c3f645db259ef96c (patch)
tree5b196417873dcba542aa69d89f544763ed7d2bf3 /Grammar
parent5990592b71199770b213afa416a08f161a16eb42 (diff)
downloadcpython-0bfd6c33fa5af32a0e095bf2c3f645db259ef96c.zip
cpython-0bfd6c33fa5af32a0e095bf2c3f645db259ef96c.tar.gz
cpython-0bfd6c33fa5af32a0e095bf2c3f645db259ef96c.tar.bz2
Added power (**) operator
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/Grammar7
1 files changed, 4 insertions, 3 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index f1b5117..3d957a7 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)* [',']