mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Added power (**) operator
This commit is contained in:
		
							parent
							
								
									5990592b71
								
							
						
					
					
						commit
						0bfd6c33fa
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -23,7 +23,7 @@ eval_input: testlist NEWLINE* ENDMARKER
 | 
				
			||||||
 | 
					
 | 
				
			||||||
funcdef: 'def' NAME parameters ':' suite
 | 
					funcdef: 'def' NAME parameters ':' suite
 | 
				
			||||||
parameters: '(' [varargslist] ')'
 | 
					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 ')'
 | 
					fpdef: NAME | '(' fplist ')'
 | 
				
			||||||
fplist: fpdef (',' fpdef)* [',']
 | 
					fplist: fpdef (',' fpdef)* [',']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,11 +70,12 @@ and_expr: shift_expr ('&' shift_expr)*
 | 
				
			||||||
shift_expr: arith_expr (('<<'|'>>') arith_expr)*
 | 
					shift_expr: arith_expr (('<<'|'>>') arith_expr)*
 | 
				
			||||||
arith_expr: term (('+'|'-') term)*
 | 
					arith_expr: term (('+'|'-') term)*
 | 
				
			||||||
term: factor (('*'|'/'|'%') factor)*
 | 
					term: factor (('*'|'/'|'%') factor)*
 | 
				
			||||||
factor: ('+'|'-'|'~') factor | atom trailer*
 | 
					factor: ('+'|'-'|'~') factor | power
 | 
				
			||||||
 | 
					power: atom trailer* ('**' factor)*
 | 
				
			||||||
atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
 | 
					atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
 | 
				
			||||||
lambdef: 'lambda' [varargslist] ':' test
 | 
					lambdef: 'lambda' [varargslist] ':' test
 | 
				
			||||||
trailer: '(' [arglist] ')' | '[' subscript ']' | '.' NAME
 | 
					trailer: '(' [arglist] ')' | '[' subscript ']' | '.' NAME
 | 
				
			||||||
subscript: test | [test] ':' [test]
 | 
					subscript: test (',' test)* [','] | [test] ':' [test]
 | 
				
			||||||
exprlist: expr (',' expr)* [',']
 | 
					exprlist: expr (',' expr)* [',']
 | 
				
			||||||
testlist: test (',' test)* [',']
 | 
					testlist: test (',' test)* [',']
 | 
				
			||||||
dictmaker: test ':' test (',' test ':' test)* [',']
 | 
					dictmaker: test ':' test (',' test ':' test)* [',']
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue