commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser ASTArrayAccess.java
Date Sat, 25 May 2002 18:39:02 GMT
geirm       02/05/25 11:39:02

  Modified:    jexl/src/java/org/apache/commons/jexl/parser
                        ASTArrayAccess.java
  Log:
  Support multi-dim access
  
  Revision  Changes    Path
  1.2       +19 -3     jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.java
  
  Index: ASTArrayAccess.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ASTArrayAccess.java	26 Apr 2002 04:23:14 -0000	1.1
  +++ ASTArrayAccess.java	25 May 2002 18:39:02 -0000	1.2
  @@ -71,7 +71,7 @@
    *    $foo[2]
    *
    *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  - *  @version $Id: ASTArrayAccess.java,v 1.1 2002/04/26 04:23:14 geirm Exp $
  + *  @version $Id: ASTArrayAccess.java,v 1.2 2002/05/25 18:39:02 geirm Exp $
    */
   public class ASTArrayAccess extends SimpleNode
   {
  @@ -106,9 +106,25 @@
   
           Object o = base.value(jc);
   
  -        SimpleNode arg = (SimpleNode) jjtGetChild(1);
  -        Object loc = arg.value(jc);
  +        /*
  +         * ignore the first child - it's our identifier
  +         */
  +        for(int i=1; i<jjtGetNumChildren(); i++)
  +        {
  +            Object loc = ((SimpleNode) jjtGetChild(i)).value(jc);
  +
  +            if(loc==null)
  +                return null;
  +
  +            o = evaluateExpr(o, loc);
  +        }
   
  +        return o;
  +    }
  +
  +    public static Object evaluateExpr(Object o, Object loc)
  +        throws Exception
  +    {
           /*
            * following the JSTL EL rules
            */
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message