2013/7/15 <ma...@apache.org>
>
> Author: markt
> Date: Sun Jul 14 21:07:26 2013
> New Revision: 1503056
>
> URL: http://svn.apache.org/r1503056
> Log:
> Start to implement the lambda expression syntax. Very basic expressions
work. I expect further changes to be required for more complex expressions.
> Includes the initial unit tests for this syntax.
>
> Modified:
tomcat/trunk/java/org/apache/el/parser/AstLambdaExpressionOrInvocation.java
> URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstLambdaExpressionOrInvocation.java?rev=1503056&r1=1503055&r2=1503056&view=diff
>
==============================================================================
> ---
tomcat/trunk/java/org/apache/el/parser/AstLambdaExpressionOrInvocation.java
(original)
> +++
tomcat/trunk/java/org/apache/el/parser/AstLambdaExpressionOrInvocation.java
Sun Jul 14 21:07:26 2013
> @@ -17,10 +17,33 @@
>  /* Generated By:JJTree: Do not edit this line.
AstLambdaExpressionOrInvocation.java Version 4.3 */
>  package org.apache.el.parser;
>
> -public
> -class AstLambdaExpressionOrInvocation extends SimpleNode {
> -  public AstLambdaExpressionOrInvocation(int id) {
> -    super(id);
> -  }
> +import javax.el.ELException;
> +
> +import org.apache.el.lang.EvaluationContext;
> +
> +public class AstLambdaExpressionOrInvocation extends SimpleNode {
> +
> +    public AstLambdaExpressionOrInvocation(int id) {
> +        super(id);
> +    }
> +
> +
> +    @Override
> +    public Object getValue(EvaluationContext ctx) throws ELException {
> +
> +        if (children.length == 2) {

Why you are limiting the children to 2.
We have MethodArguments -> zero or more:

void LambdaExpressionOrCall() #LambdaExpression : {}
{
<LPAREN>
LambdaParameters() <ARROW>
(LOOKAHEAD(3) LambdaExpression() | Choice() )
<RPAREN>
(MethodArguments())*
}

> +            AstLambdaExpression lambdaExpression =
> +                    (AstLambdaExpression) children[0];
> +
> +
> +            Object[] args =
> +                    ((AstMethodParameters)
children[1]).getParameters(ctx);
> +
> +            return lambdaExpression.invoke(ctx, null, args);
> +        }
> +
> +        // TODO Auto-generated method stub
> +        return super.getValue(ctx);
> +    }
>  }
>  /* JavaCC - OriginalChecksum=6b3dd15b31540457a41bd55974037ed9 (do not
edit this line) */

Reply via email to