commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r381240 - /jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTBlock.java
Date Mon, 27 Feb 2006 03:11:47 GMT
Author: dion
Date: Sun Feb 26 19:11:43 2006
New Revision: 381240

URL: http://svn.apache.org/viewcvs?rev=381240&view=rev
Log:
Implement Block.
{ statement* }
value of the block is the value of the last statement

Modified:
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTBlock.java

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTBlock.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTBlock.java?rev=381240&r1=381239&r2=381240&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTBlock.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTBlock.java
Sun Feb 26 19:11:43 2006
@@ -1,7 +1,24 @@
 /* Generated By:JJTree: Do not edit this line. ASTBlock.java */
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 package org.apache.commons.jexl.parser;
 
+import org.apache.commons.jexl.JexlContext;
+
 public class ASTBlock extends SimpleNode {
   public ASTBlock(int id) {
     super(id);
@@ -16,4 +33,19 @@
   public Object jjtAccept(ParserVisitor visitor, Object data) {
     return visitor.visit(this, data);
   }
+
+  /**
+   * return the value of the block
+   */
+  public Object value(JexlContext context) throws Exception
+  {
+      int numChildren = jjtGetNumChildren();
+      Object result = null;
+      for(int i = 0; i < numChildren; i++)
+      {
+          result = ((SimpleNode) jjtGetChild(i)).value(context);
+      }
+      return result;
+  }
+
 }



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


Mime
View raw message