Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da5d518

Browse files
committed
Bring alpha100 revision back to mainline
1 parent 16c40cd commit da5d518

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

Grammar/Grammar

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
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

9099
funcdef: 'def' NAME parameters ':' suite
91100
parameters: '(' [varargslist] ')'
92-
varargslist: (fpdef ',')* '*' NAME | fpdef (',' fpdef)* [',']
101+
varargslist: (fpdef ['=' test] ',')* '*' NAME | fpdef ['=' test] (',' fpdef ['=' test])* [',']
93102
fpdef: NAME | '(' fplist ')'
94103
fplist: fpdef (',' fpdef)* [',']
95104

@@ -118,7 +127,7 @@ compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
118127
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
119128
while_stmt: 'while' test ':' suite ['else' ':' suite]
120129
for_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
123132
except_clause: 'except' [test [',' test]]
124133
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
@@ -135,7 +144,7 @@ shift_expr: arith_expr (('<<'|'>>') arith_expr)*
135144
arith_expr: term (('+'|'-') term)*
136145
term: factor (('*'|'/'|'%') factor)*
137146
factor: ('+'|'-'|'~') factor | atom trailer*
138-
atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING
147+
atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
139148
lambdef: 'lambda' [varargslist] ':' test
140149
trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME
141150
subscript: test | [test] ':' [test]

0 commit comments

Comments
 (0)