fix parser grammar for lambdas in lambdas
authorStefan Behnel <scoder@users.berlios.de>
Sun, 3 May 2009 11:04:56 +0000 (13:04 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 3 May 2009 11:04:56 +0000 (13:04 +0200)
Cython/Compiler/Parsing.py
tests/run/lambda_T195.pyx

index ba346131e75da61c8cccd352ea1daceab7dbb8cd..d651c541b028a97e23dd4cd1242f18f68542cdff 100644 (file)
@@ -108,7 +108,7 @@ def p_lambdef(s, allow_conditional=True):
         args, star_arg, starstar_arg = p_varargslist(s, terminator=':')
     s.expect(':')
     if allow_conditional:
-        expr = p_test(s)
+        expr = p_simple_expr(s)
     else:
         expr = p_test_nocond(s)
     return ExprNodes.LambdaNode(
index 59168d55aa2d758d647618e2564268e748e6194a..32481108023aaa80b3ad102fe2b8b5f0e2075774 100644 (file)
@@ -24,6 +24,9 @@ __doc__ = u"""
 11
 >>> make_const_calc1_xy(8)(2)
 27
+
+>>> make_lambda_lambda(1)(2)(4)
+7
 """
 
 #cy_identity = lambda x:x
@@ -46,3 +49,6 @@ def make_const_calc1():
 
 def make_const_calc1_xy(x):
     return lambda y: x*y+(1*2*3+5)
+
+def make_lambda_lambda(x):
+    return lambda y : lambda z:x+y+z