mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Support for three-token characters (**=, >>=, <<=) which was written by
Michael Hudson, and support in general for the augmented assignment syntax. The graminit.c patch is large!
This commit is contained in:
parent
dd8dbdb717
commit
434d0828d8
7 changed files with 1401 additions and 890 deletions
|
@ -37,9 +37,10 @@ fplist: fpdef (',' fpdef)* [',']
|
|||
stmt: simple_stmt | compound_stmt
|
||||
simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
|
||||
#small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt
|
||||
small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt
|
||||
expr_stmt: testlist ('=' testlist)*
|
||||
# For assignments, additional restrictions enforced by the interpreter
|
||||
small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt
|
||||
expr_stmt: testlist (augassign testlist | ('=' testlist)*)
|
||||
augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**='
|
||||
# For normal assignments, additional restrictions enforced by the interpreter
|
||||
print_stmt: 'print' ( [ test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ] )
|
||||
del_stmt: 'del' exprlist
|
||||
pass_stmt: 'pass'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue