summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-08-24 20:11:32 (GMT)
committerThomas Wouters <thomas@python.org>2000-08-24 20:11:32 (GMT)
commit434d0828d81855692d45c3fdc0905a67c17d83ba (patch)
treefb920985e81a5c4091f75800ebdea7ed33a657e0 /Grammar
parentdd8dbdb7172fbafb5ffab8600e620103fc19879e (diff)
downloadcpython-434d0828d81855692d45c3fdc0905a67c17d83ba.zip
cpython-434d0828d81855692d45c3fdc0905a67c17d83ba.tar.gz
cpython-434d0828d81855692d45c3fdc0905a67c17d83ba.tar.bz2
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!
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 df4faa7..4df0623 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -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'