summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-08-01 11:00:20 (GMT)
committerGuido van Rossum <guido@python.org>1994-08-01 11:00:20 (GMT)
commitda5d518d46f275e3ee409fb9c3c25b3bcd3c2d22 (patch)
treed936f2052833fa6c047b86bc9a49a440159ad9e6 /Grammar
parent16c40cdf61eaf19969a642afb19f830e6ec60837 (diff)
downloadcpython-da5d518d46f275e3ee409fb9c3c25b3bcd3c2d22.zip
cpython-da5d518d46f275e3ee409fb9c3c25b3bcd3c2d22.tar.gz
cpython-da5d518d46f275e3ee409fb9c3c25b3bcd3c2d22.tar.bz2
Bring alpha100 revision back to mainline
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/Grammar15
1 files changed, 12 insertions, 3 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index de98aeb..2e0b20c 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -2,6 +2,15 @@
# Change log:
+# 3-May-94:
+# Added else clause to try-except
+
+# 17-Apr-94:
+# Added string literal concatenation
+
+# 13-Apr-94:
+# Added default values for function/lambda argument lists
+
# 30-Nov-93:
# Removed lambda_input, added lambdef
@@ -89,7 +98,7 @@ eval_input: testlist NEWLINE* ENDMARKER
funcdef: 'def' NAME parameters ':' suite
parameters: '(' [varargslist] ')'
-varargslist: (fpdef ',')* '*' NAME | fpdef (',' fpdef)* [',']
+varargslist: (fpdef ['=' test] ',')* '*' NAME | fpdef ['=' test] (',' fpdef ['=' test])* [',']
fpdef: NAME | '(' fplist ')'
fplist: fpdef (',' fpdef)* [',']
@@ -118,7 +127,7 @@ compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
while_stmt: 'while' test ':' suite ['else' ':' suite]
for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
-try_stmt: 'try' ':' suite (except_clause ':' suite)+ | 'try' ':' suite 'finally' ':' suite
+try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] | 'try' ':' suite 'finally' ':' suite
# NB compile.c makes sure that the default except clause is last
except_clause: 'except' [test [',' test]]
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
@@ -135,7 +144,7 @@ shift_expr: arith_expr (('<<'|'>>') arith_expr)*
arith_expr: term (('+'|'-') term)*
term: factor (('*'|'/'|'%') factor)*
factor: ('+'|'-'|'~') factor | atom trailer*
-atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING
+atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
lambdef: 'lambda' [varargslist] ':' test
trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME
subscript: test | [test] ':' [test]