summaryrefslogtreecommitdiff
path: root/Grammar
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-08-24 20:11:32 +0000
committerThomas Wouters <thomas@python.org>2000-08-24 20:11:32 +0000
commit434d0828d81855692d45c3fdc0905a67c17d83ba (patch)
treefb920985e81a5c4091f75800ebdea7ed33a657e0 /Grammar
parentdd8dbdb7172fbafb5ffab8600e620103fc19879e (diff)
downloadcpython-git-434d0828d81855692d45c3fdc0905a67c17d83ba.tar.gz
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 df4faa760a..4df0623d6e 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'