22
33# Change log:
44
5+ # 3-May-94:
6+ # Added else clause to try-except
7+
8+ # 17-Apr-94:
9+ # Added string literal concatenation
10+
11+ # 13-Apr-94:
12+ # Added default values for function/lambda argument lists
13+
514# 30-Nov-93:
615# Removed lambda_input, added lambdef
716
@@ -89,7 +98,7 @@ eval_input: testlist NEWLINE* ENDMARKER
8998
9099funcdef: 'def' NAME parameters ':' suite
91100parameters: '(' [varargslist] ')'
92- varargslist: (fpdef ' ,')* '*' NAME | fpdef (',' fpdef)* [',']
101+ varargslist: (fpdef ['=' test] ' ,')* '*' NAME | fpdef ['=' test] (',' fpdef ['=' test] )* [',']
93102fpdef: NAME | '(' fplist ')'
94103fplist: fpdef (',' fpdef)* [',']
95104
@@ -118,7 +127,7 @@ compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
118127if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
119128while_stmt: 'while' test ':' suite ['else' ':' suite]
120129for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
121- try_stmt: 'try' ':' suite (except_clause ':' suite)+ | 'try' ':' suite 'finally' ':' suite
130+ try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] | 'try' ':' suite 'finally' ':' suite
122131# NB compile.c makes sure that the default except clause is last
123132except_clause: 'except' [test [',' test]]
124133suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
@@ -135,7 +144,7 @@ shift_expr: arith_expr (('<<'|'>>') arith_expr)*
135144arith_expr: term (('+'|'-') term)*
136145term: factor (('*'|'/'|'%') factor)*
137146factor: ('+'|'-'|'~') factor | atom trailer*
138- atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING
147+ atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
139148lambdef: 'lambda' [varargslist] ':' test
140149trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME
141150subscript: test | [test] ':' [test]
0 commit comments