Commit 625963ec authored by Stefan Behnel's avatar Stefan Behnel

fix parser grammar for lambdas in lambdas

parent d61b5318
...@@ -108,7 +108,7 @@ def p_lambdef(s, allow_conditional=True): ...@@ -108,7 +108,7 @@ def p_lambdef(s, allow_conditional=True):
args, star_arg, starstar_arg = p_varargslist(s, terminator=':') args, star_arg, starstar_arg = p_varargslist(s, terminator=':')
s.expect(':') s.expect(':')
if allow_conditional: if allow_conditional:
expr = p_test(s) expr = p_simple_expr(s)
else: else:
expr = p_test_nocond(s) expr = p_test_nocond(s)
return ExprNodes.LambdaNode( return ExprNodes.LambdaNode(
......
...@@ -24,6 +24,9 @@ __doc__ = u""" ...@@ -24,6 +24,9 @@ __doc__ = u"""
11 11
>>> make_const_calc1_xy(8)(2) >>> make_const_calc1_xy(8)(2)
27 27
>>> make_lambda_lambda(1)(2)(4)
7
""" """
#cy_identity = lambda x:x #cy_identity = lambda x:x
...@@ -46,3 +49,6 @@ def make_const_calc1(): ...@@ -46,3 +49,6 @@ def make_const_calc1():
def make_const_calc1_xy(x): def make_const_calc1_xy(x):
return lambda y: x*y+(1*2*3+5) return lambda y: x*y+(1*2*3+5)
def make_lambda_lambda(x):
return lambda y : lambda z:x+y+z
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment