]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Bring alpha100 revision back to mainline
authorGuido van Rossum <guido@python.org>
Mon, 1 Aug 1994 11:00:20 +0000 (11:00 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 1 Aug 1994 11:00:20 +0000 (11:00 +0000)
Grammar/Grammar

index de98aeb7c693246ce5deec42de51daf1c896c417..2e0b20c46d936305937e7217cafbb754e89fec99 100644 (file)
@@ -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]