diff options
author | Guido van Rossum <guido@python.org> | 1993-11-30 13:40:46 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-11-30 13:40:46 +0000 |
commit | 9952fc9646c5ffa333f1eaf7412763df3cb2e890 (patch) | |
tree | 5c6dc4df94222d272ce41c7db81e861aa994800b /Grammar | |
parent | 516e633a24f8bb061ecf15c16a6c564c10e0ebf1 (diff) | |
download | cpython-9952fc9646c5ffa333f1eaf7412763df3cb2e890.tar.gz |
* import.c (get_module): pass .py filename to parse_file, not .pyc filename!
* funcobject.c (func_repr): don't call getstringvalue(None) for anonymous
functions.
* bltinmodule.c: removed lambda (which is now a built-in function);
removed implied lambda for string arg to filter/map/reduce.
* Grammar, graminit.[ch], compile.[ch]: replaced lambda as built-in
function by lambda as grammar entity: instead of "lambda('x: x+1')" you
write "lambda x: x+1".
* Xtmodule.c (checkargdict): return 0, not NULL, for error.
Diffstat (limited to 'Grammar')
-rw-r--r-- | Grammar/Grammar | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar index 1094b09d75..6be7418b5f 100644 --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -2,6 +2,9 @@ # Change log: +# 30-Nov-93: +# Removed lambda_input, added lambdef + # 25-Oct-93: # Added lambda_input @@ -77,14 +80,12 @@ # Start symbols for the grammar: # single_input is a single interactive statement; # file_input is a module or sequence of commands read from an input file; -# eval_input is the input for the eval() and input() functions; -# lambda_input is the input for the proposed lambda() function. +# eval_input is the input for the eval() and input() functions. # NB: compound_stmt in single_input is followed by extra NEWLINE! single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE file_input: (NEWLINE | stmt)* ENDMARKER eval_input: testlist NEWLINE* ENDMARKER -lambda_input: varargslist ':' testlist NEWLINE* ENDMARKER funcdef: 'def' NAME parameters ':' suite parameters: '(' [varargslist] ')' @@ -134,7 +135,10 @@ 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 '`' | lambdef | NAME | NUMBER | STRING +# Note ambiguity in grammar: "lambda x: x[1]" could mean "(lambda x: x)[1]" +# but the parser is eager so interprets it as "lambda x: (x[1])"... +lambdef: 'lambda' [varargslist] ':' test trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME subscript: test | [test] ':' [test] exprlist: expr (',' expr)* [','] |