summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-12-31 13:11:56 (GMT)
committerGuido van Rossum <guido@python.org>1991-12-31 13:11:56 (GMT)
commit6cf1273faa0891f1cec88283c5b8b9810638559c (patch)
treebe7304abbee77296c25c0f1921899c972a1f7822
parent5fca8a1b0d84a5e42fd572de1b22a1e2fcf46fd8 (diff)
downloadcpython-6cf1273faa0891f1cec88283c5b8b9810638559c.zip
cpython-6cf1273faa0891f1cec88283c5b8b9810638559c.tar.gz
cpython-6cf1273faa0891f1cec88283c5b8b9810638559c.tar.bz2
Allow trailing comma after fplist; '=' is no longer comparison;
expr/assignment statement now allows testlists.
-rw-r--r--Grammar/Grammar15
1 files changed, 11 insertions, 4 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index 494ebf0..1ba2f52 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -1,4 +1,11 @@
-# Grammar for Python, version 8
+# Grammar for Python, version 10
+
+# Changes since version 9:
+# Equality is now only tested with '=='; consequently
+# Exprlist replaced by testlist everywhere except after 'for'
+
+# Changes since version 8:
+# Trailing commas in formal parameter lists are allowed
# Changes since version 7:
# New syntax to specify base classes (but old syntax retained for now)
@@ -51,13 +58,13 @@ eval_input: testlist ENDMARKER
funcdef: 'def' NAME parameters ':' suite
parameters: '(' [fplist] ')'
-fplist: fpdef (',' fpdef)*
+fplist: fpdef (',' fpdef)* [',']
fpdef: NAME | '(' fplist ')'
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
-expr_stmt: (exprlist '=')* exprlist
+expr_stmt: (testlist '=')* testlist
# For assignments, additional restrictions enforced by the interpreter
print_stmt: 'print' (test ',')* [test]
del_stmt: 'del' exprlist
@@ -81,7 +88,7 @@ test: and_test ('or' and_test)*
and_test: not_test ('and' not_test)*
not_test: 'not' not_test | comparison
comparison: expr (comp_op expr)*
-comp_op: '<'|'>'|'='|'>='|'<='|'<>'|'!='|'=='|'in'|'not' 'in'|'is'|'is' 'not'
+comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'
expr: xor_expr ('|' xor_expr)*
xor_expr: and_expr ('^' and_expr)*
and_expr: shift_expr ('&' shift_expr)*