commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hen...@apache.org
Subject svn commit: r1207941 [2/5] - in /commons/proper/jexl/trunk: ./ src/main/assembly/ src/main/config/ src/main/java/org/apache/commons/jexl3/ src/main/java/org/apache/commons/jexl3/internal/ src/main/java/org/apache/commons/jexl3/internal/introspection/ s...
Date Tue, 29 Nov 2011 16:19:43 GMT
Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Interpreter.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Interpreter.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Interpreter.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Interpreter.java Tue Nov 29 16:18:59 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 import java.lang.reflect.Array;
 import java.lang.reflect.InvocationTargetException;
@@ -24,73 +24,73 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.jexl2.parser.SimpleNode;
+import org.apache.commons.jexl3.parser.SimpleNode;
 import org.apache.commons.logging.Log;
 
-import org.apache.commons.jexl2.parser.JexlNode;
-import org.apache.commons.jexl2.parser.ASTAdditiveNode;
-import org.apache.commons.jexl2.parser.ASTAdditiveOperator;
-import org.apache.commons.jexl2.parser.ASTAndNode;
-import org.apache.commons.jexl2.parser.ASTAmbiguous;
-import org.apache.commons.jexl2.parser.ASTArrayAccess;
-import org.apache.commons.jexl2.parser.ASTArrayLiteral;
-import org.apache.commons.jexl2.parser.ASTAssignment;
-import org.apache.commons.jexl2.parser.ASTBitwiseAndNode;
-import org.apache.commons.jexl2.parser.ASTBitwiseComplNode;
-import org.apache.commons.jexl2.parser.ASTBitwiseOrNode;
-import org.apache.commons.jexl2.parser.ASTBitwiseXorNode;
-import org.apache.commons.jexl2.parser.ASTBlock;
-import org.apache.commons.jexl2.parser.ASTConstructorNode;
-import org.apache.commons.jexl2.parser.ASTDivNode;
-import org.apache.commons.jexl2.parser.ASTEQNode;
-import org.apache.commons.jexl2.parser.ASTERNode;
-import org.apache.commons.jexl2.parser.ASTEmptyFunction;
-import org.apache.commons.jexl2.parser.ASTFalseNode;
-import org.apache.commons.jexl2.parser.ASTFunctionNode;
-import org.apache.commons.jexl2.parser.ASTForeachStatement;
-import org.apache.commons.jexl2.parser.ASTGENode;
-import org.apache.commons.jexl2.parser.ASTGTNode;
-import org.apache.commons.jexl2.parser.ASTIdentifier;
-import org.apache.commons.jexl2.parser.ASTIfStatement;
-import org.apache.commons.jexl2.parser.ASTJexlScript;
-import org.apache.commons.jexl2.parser.ASTLENode;
-import org.apache.commons.jexl2.parser.ASTLTNode;
-import org.apache.commons.jexl2.parser.ASTMapEntry;
-import org.apache.commons.jexl2.parser.ASTMapLiteral;
-import org.apache.commons.jexl2.parser.ASTMethodNode;
-import org.apache.commons.jexl2.parser.ASTModNode;
-import org.apache.commons.jexl2.parser.ASTMulNode;
-import org.apache.commons.jexl2.parser.ASTNENode;
-import org.apache.commons.jexl2.parser.ASTNRNode;
-import org.apache.commons.jexl2.parser.ASTNotNode;
-import org.apache.commons.jexl2.parser.ASTNullLiteral;
-import org.apache.commons.jexl2.parser.ASTNumberLiteral;
-import org.apache.commons.jexl2.parser.ASTOrNode;
-import org.apache.commons.jexl2.parser.ASTReference;
-import org.apache.commons.jexl2.parser.ASTReferenceExpression;
-import org.apache.commons.jexl2.parser.ASTReturnStatement;
-import org.apache.commons.jexl2.parser.ASTSizeFunction;
-import org.apache.commons.jexl2.parser.ASTSizeMethod;
-import org.apache.commons.jexl2.parser.ASTStringLiteral;
-import org.apache.commons.jexl2.parser.ASTTernaryNode;
-import org.apache.commons.jexl2.parser.ASTTrueNode;
-import org.apache.commons.jexl2.parser.ASTUnaryMinusNode;
-import org.apache.commons.jexl2.parser.ASTWhileStatement;
-import org.apache.commons.jexl2.parser.Node;
-import org.apache.commons.jexl2.parser.ParserVisitor;
-
-import org.apache.commons.jexl2.introspection.Uberspect;
-import org.apache.commons.jexl2.introspection.JexlMethod;
-import org.apache.commons.jexl2.introspection.JexlPropertyGet;
-import org.apache.commons.jexl2.introspection.JexlPropertySet;
-import org.apache.commons.jexl2.parser.ASTVar;
+import org.apache.commons.jexl3.parser.JexlNode;
+import org.apache.commons.jexl3.parser.ASTAdditiveNode;
+import org.apache.commons.jexl3.parser.ASTAdditiveOperator;
+import org.apache.commons.jexl3.parser.ASTAndNode;
+import org.apache.commons.jexl3.parser.ASTAmbiguous;
+import org.apache.commons.jexl3.parser.ASTArrayAccess;
+import org.apache.commons.jexl3.parser.ASTArrayLiteral;
+import org.apache.commons.jexl3.parser.ASTAssignment;
+import org.apache.commons.jexl3.parser.ASTBitwiseAndNode;
+import org.apache.commons.jexl3.parser.ASTBitwiseComplNode;
+import org.apache.commons.jexl3.parser.ASTBitwiseOrNode;
+import org.apache.commons.jexl3.parser.ASTBitwiseXorNode;
+import org.apache.commons.jexl3.parser.ASTBlock;
+import org.apache.commons.jexl3.parser.ASTConstructorNode;
+import org.apache.commons.jexl3.parser.ASTDivNode;
+import org.apache.commons.jexl3.parser.ASTEQNode;
+import org.apache.commons.jexl3.parser.ASTERNode;
+import org.apache.commons.jexl3.parser.ASTEmptyFunction;
+import org.apache.commons.jexl3.parser.ASTFalseNode;
+import org.apache.commons.jexl3.parser.ASTFunctionNode;
+import org.apache.commons.jexl3.parser.ASTForeachStatement;
+import org.apache.commons.jexl3.parser.ASTGENode;
+import org.apache.commons.jexl3.parser.ASTGTNode;
+import org.apache.commons.jexl3.parser.ASTIdentifier;
+import org.apache.commons.jexl3.parser.ASTIfStatement;
+import org.apache.commons.jexl3.parser.ASTJexlScript;
+import org.apache.commons.jexl3.parser.ASTLENode;
+import org.apache.commons.jexl3.parser.ASTLTNode;
+import org.apache.commons.jexl3.parser.ASTMapEntry;
+import org.apache.commons.jexl3.parser.ASTMapLiteral;
+import org.apache.commons.jexl3.parser.ASTMethodNode;
+import org.apache.commons.jexl3.parser.ASTModNode;
+import org.apache.commons.jexl3.parser.ASTMulNode;
+import org.apache.commons.jexl3.parser.ASTNENode;
+import org.apache.commons.jexl3.parser.ASTNRNode;
+import org.apache.commons.jexl3.parser.ASTNotNode;
+import org.apache.commons.jexl3.parser.ASTNullLiteral;
+import org.apache.commons.jexl3.parser.ASTNumberLiteral;
+import org.apache.commons.jexl3.parser.ASTOrNode;
+import org.apache.commons.jexl3.parser.ASTReference;
+import org.apache.commons.jexl3.parser.ASTReferenceExpression;
+import org.apache.commons.jexl3.parser.ASTReturnStatement;
+import org.apache.commons.jexl3.parser.ASTSizeFunction;
+import org.apache.commons.jexl3.parser.ASTSizeMethod;
+import org.apache.commons.jexl3.parser.ASTStringLiteral;
+import org.apache.commons.jexl3.parser.ASTTernaryNode;
+import org.apache.commons.jexl3.parser.ASTTrueNode;
+import org.apache.commons.jexl3.parser.ASTUnaryMinusNode;
+import org.apache.commons.jexl3.parser.ASTWhileStatement;
+import org.apache.commons.jexl3.parser.Node;
+import org.apache.commons.jexl3.parser.ParserVisitor;
+
+import org.apache.commons.jexl3.introspection.Uberspect;
+import org.apache.commons.jexl3.introspection.JexlMethod;
+import org.apache.commons.jexl3.introspection.JexlPropertyGet;
+import org.apache.commons.jexl3.introspection.JexlPropertySet;
+import org.apache.commons.jexl3.parser.ASTVar;
 
 /**
  * An interpreter of JEXL syntax.
  *
  * @since 2.0
  */
-public class Interpreter implements ParserVisitor {
+public class Interpreter extends ParserVisitor {
     /** The logger. */
     protected final Log logger;
     /** The uberspect. */
@@ -265,7 +265,7 @@ public class Interpreter implements Pars
      */
     protected JexlNode findNullOperand(RuntimeException xrt, JexlNode node, Object left, Object right) {
         if (xrt instanceof ArithmeticException
-                && (Object) JexlException.NULL_OPERAND == xrt.getMessage()) {
+            && (Object) JexlException.NULL_OPERAND == xrt.getMessage()) {
             if (left == null) {
                 return node.jjtGetChild(0);
             }
@@ -364,7 +364,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTAdditiveNode node, Object data) {
+    protected Object visit(ASTAdditiveNode node, Object data) {
         /**
          * The pattern for exception mgmt is to let the child*.jjtAccept
          * out of the try/catch loop so that if one fails, the ex will
@@ -399,12 +399,12 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTAdditiveOperator node, Object data) {
+    protected Object visit(ASTAdditiveOperator node, Object data) {
         throw new UnsupportedOperationException("Shoud not be called.");
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTAndNode node, Object data) {
+    protected Object visit(ASTAndNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         try {
             boolean leftValue = arithmetic.toBoolean(left);
@@ -427,7 +427,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTArrayAccess node, Object data) {
+    protected Object visit(ASTArrayAccess node, Object data) {
         // first objectNode is the identifier
         Object object = node.jjtGetChild(0).jjtAccept(this, data);
         // can have multiple nodes - either an expression, integer literal or reference
@@ -446,7 +446,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTArrayLiteral node, Object data) {
+    protected Object visit(ASTArrayLiteral node, Object data) {
         Object literal = node.getLiteral();
         if (literal == null) {
             int childCount = node.jjtGetNumChildren();
@@ -462,7 +462,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTAssignment node, Object data) {
+    protected Object visit(ASTAssignment node, Object data) {
         // left contains the reference to assign to
         int register = -1;
         JexlNode left = node.jjtGetChild(0);
@@ -595,7 +595,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTBitwiseAndNode node, Object data) {
+    protected Object visit(ASTBitwiseAndNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -606,7 +606,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTBitwiseComplNode node, Object data) {
+    protected Object visit(ASTBitwiseComplNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         try {
             return arithmetic.bitwiseComplement(left);
@@ -616,7 +616,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTBitwiseOrNode node, Object data) {
+    protected Object visit(ASTBitwiseOrNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -627,7 +627,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTBitwiseXorNode node, Object data) {
+    protected Object visit(ASTBitwiseXorNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -638,7 +638,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTBlock node, Object data) {
+    protected Object visit(ASTBlock node, Object data) {
         int numChildren = node.jjtGetNumChildren();
         Object result = null;
         for (int i = 0; i < numChildren; i++) {
@@ -648,13 +648,13 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTDivNode node, Object data) {
+    protected Object visit(ASTDivNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
             return arithmetic.divide(left, right);
         } catch (ArithmeticException xrt) {
-            if (!strict && xrt instanceof ArithmeticException) {
+            if (!strict) {
                 return new Double(0.0);
             }
             JexlNode xnode = findNullOperand(xrt, node, left, right);
@@ -663,7 +663,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTEmptyFunction node, Object data) {
+    protected Object visit(ASTEmptyFunction node, Object data) {
         Object o = node.jjtGetChild(0).jjtAccept(this, data);
         if (o == null) {
             return Boolean.TRUE;
@@ -685,7 +685,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTEQNode node, Object data) {
+    protected Object visit(ASTEQNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -696,12 +696,12 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTFalseNode node, Object data) {
+    protected Object visit(ASTFalseNode node, Object data) {
         return Boolean.FALSE;
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTForeachStatement node, Object data) {
+    protected Object visit(ASTForeachStatement node, Object data) {
         Object result = null;
         /* first objectNode is the loop variable */
         ASTReference loopReference = (ASTReference) node.jjtGetChild(0);
@@ -737,7 +737,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTGENode node, Object data) {
+    protected Object visit(ASTGENode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -748,7 +748,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTGTNode node, Object data) {
+    protected Object visit(ASTGTNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -759,7 +759,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTERNode node, Object data) {
+    protected Object visit(ASTERNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -816,7 +816,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTIdentifier node, Object data) {
+    protected Object visit(ASTIdentifier node, Object data) {
         if (isCancelled()) {
             throw new JexlException.Cancel(node);
         }
@@ -841,12 +841,12 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTVar node, Object data) {
+    protected Object visit(ASTVar node, Object data) {
         return visit((ASTIdentifier) node, data);
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTIfStatement node, Object data) {
+    protected Object visit(ASTIfStatement node, Object data) {
         int n = 0;
         try {
             Object result = null;
@@ -873,7 +873,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTNumberLiteral node, Object data) {
+    protected Object visit(ASTNumberLiteral node, Object data) {
         if (data != null && node.isInteger()) {
             return getAttribute(data, node.getLiteral(), node);
         }
@@ -881,7 +881,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTJexlScript node, Object data) {
+    protected Object visit(ASTJexlScript node, Object data) {
         int numChildren = node.jjtGetNumChildren();
         Object result = null;
         for (int i = 0; i < numChildren; i++) {
@@ -892,7 +892,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTLENode node, Object data) {
+    protected Object visit(ASTLENode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -903,7 +903,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTLTNode node, Object data) {
+    protected Object visit(ASTLTNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -914,14 +914,14 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTMapEntry node, Object data) {
+    protected Object visit(ASTMapEntry node, Object data) {
         Object key = node.jjtGetChild(0).jjtAccept(this, data);
         Object value = node.jjtGetChild(1).jjtAccept(this, data);
         return new Object[]{key, value};
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTMapLiteral node, Object data) {
+    protected Object visit(ASTMapLiteral node, Object data) {
         int childCount = node.jjtGetNumChildren();
         Map<Object, Object> map = new HashMap<Object, Object>();
 
@@ -1024,7 +1024,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTMethodNode node, Object data) {
+    protected Object visit(ASTMethodNode node, Object data) {
         // the object to invoke the method on should be in the data argument
         if (data == null) {
             // if the method node is the first child of the (ASTReference) parent,
@@ -1044,7 +1044,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTFunctionNode node, Object data) {
+    protected Object visit(ASTFunctionNode node, Object data) {
         // objectNode 0 is the prefix
         String prefix = node.jjtGetChild(0).image;
         Object namespace = resolveNamespace(prefix, node);
@@ -1054,7 +1054,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTConstructorNode node, Object data) {
+    protected Object visit(ASTConstructorNode node, Object data) {
         if (isCancelled()) {
             throw new JexlException.Cancel(node);
         }
@@ -1107,7 +1107,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTModNode node, Object data) {
+    protected Object visit(ASTModNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -1122,7 +1122,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTMulNode node, Object data) {
+    protected Object visit(ASTMulNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -1134,7 +1134,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTNENode node, Object data) {
+    protected Object visit(ASTNENode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -1146,7 +1146,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTNRNode node, Object data) {
+    protected Object visit(ASTNRNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         Object right = node.jjtGetChild(1).jjtAccept(this, data);
         try {
@@ -1202,18 +1202,18 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTNotNode node, Object data) {
+    protected Object visit(ASTNotNode node, Object data) {
         Object val = node.jjtGetChild(0).jjtAccept(this, data);
         return arithmetic.toBoolean(val) ? Boolean.FALSE : Boolean.TRUE;
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTNullLiteral node, Object data) {
+    protected Object visit(ASTNullLiteral node, Object data) {
         return null;
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTOrNode node, Object data) {
+    protected Object visit(ASTOrNode node, Object data) {
         Object left = node.jjtGetChild(0).jjtAccept(this, data);
         try {
             boolean leftValue = arithmetic.toBoolean(left);
@@ -1236,7 +1236,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTReference node, Object data) {
+    protected Object visit(ASTReference node, Object data) {
         // could be array access, identifier or map literal
         // followed by zero or more ("." and array access, method, size,
         // identifier or integer literal)
@@ -1291,13 +1291,13 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTReferenceExpression node, Object data) {
+    protected Object visit(ASTReferenceExpression node, Object data) {
         ASTArrayAccess upper = node;
         return visit(upper, data);
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTReturnStatement node, Object data) {
+    protected Object visit(ASTReturnStatement node, Object data) {
         Object val = node.jjtGetChild(0).jjtAccept(this, data);
         throw new JexlException.Return(node, null, val);
     }
@@ -1322,7 +1322,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTSizeFunction node, Object data) {
+    protected Object visit(ASTSizeFunction node, Object data) {
         Object val = node.jjtGetChild(0).jjtAccept(this, data);
         if (val == null) {
             throw new JexlException(node, "size() : argument is null", null);
@@ -1331,12 +1331,12 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTSizeMethod node, Object data) {
+    protected Object visit(ASTSizeMethod node, Object data) {
         return Integer.valueOf(sizeOf(node, data));
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTStringLiteral node, Object data) {
+    protected Object visit(ASTStringLiteral node, Object data) {
         if (data != null) {
             return getAttribute(data, node.getLiteral(), node);
         }
@@ -1344,7 +1344,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTTernaryNode node, Object data) {
+    protected Object visit(ASTTernaryNode node, Object data) {
         Object condition = node.jjtGetChild(0).jjtAccept(this, data);
         if (node.jjtGetNumChildren() == 3) {
             if (condition != null && arithmetic.toBoolean(condition)) {
@@ -1361,12 +1361,12 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTTrueNode node, Object data) {
+    protected Object visit(ASTTrueNode node, Object data) {
         return Boolean.TRUE;
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTUnaryMinusNode node, Object data) {
+    protected Object visit(ASTUnaryMinusNode node, Object data) {
         JexlNode valNode = node.jjtGetChild(0);
         Object val = valNode.jjtAccept(this, data);
         try {
@@ -1382,7 +1382,7 @@ public class Interpreter implements Pars
     }
 
     /** {@inheritDoc} */
-    public Object visit(ASTWhileStatement node, Object data) {
+    protected Object visit(ASTWhileStatement node, Object data) {
         Object result = null;
         /* first objectNode is the expression */
         Node expressionNode = node.jjtGetChild(0);
@@ -1587,7 +1587,7 @@ public class Interpreter implements Pars
      * @param data the data
      * @return does not return
      */
-    public Object visit(SimpleNode node, Object data) {
+    protected Object visit(SimpleNode node, Object data) {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
@@ -1597,7 +1597,7 @@ public class Interpreter implements Pars
      * @param data the data
      * @return does not return
      */
-    public Object visit(ASTAmbiguous node, Object data) {
+    protected Object visit(ASTAmbiguous node, Object data) {
         throw new UnsupportedOperationException("unexpected type of node");
     }
 }

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Interpreter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java Tue Nov 29 16:18:59 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 import java.lang.reflect.Array;
 import java.lang.reflect.Field;
@@ -111,7 +111,7 @@ public class JexlArithmetic {
      * @param number the big decimal to round
      * @return the rounded big decimal
      */
-    public BigDecimal roundBigDecimal(final BigDecimal number) {
+    protected BigDecimal roundBigDecimal(final BigDecimal number) {
         int mscale = getMathScale();
         if (mscale >= 0) {
             return number.setScale(mscale, getMathContext().getRoundingMode());
@@ -193,6 +193,85 @@ public class JexlArithmetic {
                 || o instanceof Short
                 || o instanceof Character;
     }
+    
+    /**
+     * Whether we consider the narrow class as a potential candidate for narrowing the source.
+     * @param narrow the target narrow class
+     * @param source the orginal source class
+     * @return true if attempt to narrow source to target is accepted
+     */
+    protected boolean narrowAccept(Class<?> narrow, Class<?> source) {
+        return narrow == null || narrow.equals(source);
+    }
+
+    /**
+     * Given a Number, return back the value attempting to narrow it to a target class.
+     * @param original the original number
+     * @param narrow the attempted target class
+     * @return  the narrowed number or the source if no narrowing was possible
+     */
+    protected Number narrowNumber(Number original, Class<?> narrow) {
+        if (original == null) {
+            return original;
+        }
+        Number result = original;
+        if (original instanceof BigDecimal) {
+            BigDecimal bigd = (BigDecimal) original;
+            // if it's bigger than a double it can't be narrowed
+            if (bigd.compareTo(BIGD_DOUBLE_MAX_VALUE) > 0) {
+                return original;
+            } else {
+                try {
+                    long l = bigd.longValueExact();
+                    // coerce to int when possible (int being so often used in method parms)
+                    if (narrowAccept(narrow, Integer.class)
+                            && l <= Integer.MAX_VALUE
+                            && l >= Integer.MIN_VALUE) {
+                        return Integer.valueOf((int) l);
+                    } else if (narrowAccept(narrow, Long.class)) {
+                        return Long.valueOf(l);
+                    }
+                } catch (ArithmeticException xa) {
+                    // ignore, no exact value possible
+                }
+            }
+        }
+        if (original instanceof Double || original instanceof Float || original instanceof BigDecimal) {
+            double value = original.doubleValue();
+            if (narrowAccept(narrow, Float.class)
+                    && value <= Float.MAX_VALUE
+                    && value >= Float.MIN_VALUE) {
+                result = Float.valueOf(result.floatValue());
+            }
+            // else it fits in a double only
+        } else {
+            if (original instanceof BigInteger) {
+                BigInteger bigi = (BigInteger) original;
+                // if it's bigger than a Long it can't be narrowed
+                if (bigi.compareTo(BIGI_LONG_MAX_VALUE) > 0
+                        || bigi.compareTo(BIGI_LONG_MIN_VALUE) < 0) {
+                    return original;
+                }
+            }
+            long value = original.longValue();
+            if (narrowAccept(narrow, Byte.class)
+                    && value <= Byte.MAX_VALUE
+                    && value >= Byte.MIN_VALUE) {
+                // it will fit in a byte
+                result = Byte.valueOf((byte) value);
+            } else if (narrowAccept(narrow, Short.class)
+                    && value <= Short.MAX_VALUE
+                    && value >= Short.MIN_VALUE) {
+                result = Short.valueOf((short) value);
+            } else if (narrowAccept(narrow, Integer.class)
+                    && value <= Integer.MAX_VALUE
+                    && value >= Integer.MIN_VALUE) {
+                result = Integer.valueOf((int) value);
+            }
+            // else it fits in a long
+        }
+        return result;
+    }
 
     /**
      * Given a BigInteger, narrow it to an Integer or Long if it fits and the arguments
@@ -819,7 +898,7 @@ public class JexlArithmetic {
             controlNullOperand();
             return 0;
         } else if (val instanceof Double) {
-            if (!Double.isNaN((Double) val)) {
+            if (!Double.isNaN(((Double) val).doubleValue())) {
                 return 0;
             } else {
                 return ((Double) val).intValue();
@@ -852,7 +931,7 @@ public class JexlArithmetic {
             controlNullOperand();
             return 0L;
         } else if (val instanceof Double) {
-            if (!Double.isNaN((Double) val)) {
+            if (!Double.isNaN(((Double) val).doubleValue())) {
                 return 0;
             } else {
                 return ((Double) val).longValue();
@@ -889,7 +968,7 @@ public class JexlArithmetic {
         } else if (val instanceof BigInteger) {
             return (BigInteger) val;
         } else if (val instanceof Double) {
-            if (!Double.isNaN((Double) val)) {
+            if (!Double.isNaN(((Double) val).doubleValue())) {
                 return new BigInteger(val.toString());
             } else {
                 return BigInteger.ZERO;
@@ -932,7 +1011,7 @@ public class JexlArithmetic {
             }
             return roundBigDecimal(new BigDecimal(string, getMathContext()));
         } else if (val instanceof Double) {
-            if (!Double.isNaN((Double) val)) {
+            if (!Double.isNaN(((Double) val).doubleValue())) {
                 return roundBigDecimal(new BigDecimal(val.toString(), getMathContext()));
             } else {
                 return BigDecimal.ZERO;
@@ -997,7 +1076,7 @@ public class JexlArithmetic {
             return "";
         } else if (val instanceof Double) {
             Double dval = (Double) val;
-            if (Double.isNaN(dval)) {
+            if (Double.isNaN(dval.doubleValue())) {
                 return "";
             } else {
                 return dval.toString();
@@ -1021,82 +1100,4 @@ public class JexlArithmetic {
         return narrowNumber(original, null);
     }
 
-    /**
-     * Whether we consider the narrow class as a potential candidate for narrowing the source.
-     * @param narrow the target narrow class
-     * @param source the orginal source class
-     * @return true if attempt to narrow source to target is accepted
-     */
-    protected boolean narrowAccept(Class<?> narrow, Class<?> source) {
-        return narrow == null || narrow.equals(source);
-    }
-
-    /**
-     * Given a Number, return back the value attempting to narrow it to a target class.
-     * @param original the original number
-     * @param narrow the attempted target class
-     * @return  the narrowed number or the source if no narrowing was possible
-     */
-    protected Number narrowNumber(Number original, Class<?> narrow) {
-        if (original == null) {
-            return original;
-        }
-        Number result = original;
-        if (original instanceof BigDecimal) {
-            BigDecimal bigd = (BigDecimal) original;
-            // if it's bigger than a double it can't be narrowed
-            if (bigd.compareTo(BIGD_DOUBLE_MAX_VALUE) > 0) {
-                return original;
-            } else {
-                try {
-                    long l = bigd.longValueExact();
-                    // coerce to int when possible (int being so often used in method parms)
-                    if (narrowAccept(narrow, Integer.class)
-                            && l <= Integer.MAX_VALUE
-                            && l >= Integer.MIN_VALUE) {
-                        return Integer.valueOf((int) l);
-                    } else if (narrowAccept(narrow, Long.class)) {
-                        return Long.valueOf(l);
-                    }
-                } catch (ArithmeticException xa) {
-                    // ignore, no exact value possible
-                }
-            }
-        }
-        if (original instanceof Double || original instanceof Float || original instanceof BigDecimal) {
-            double value = original.doubleValue();
-            if (narrowAccept(narrow, Float.class)
-                    && value <= Float.MAX_VALUE
-                    && value >= Float.MIN_VALUE) {
-                result = Float.valueOf(result.floatValue());
-            }
-            // else it fits in a double only
-        } else {
-            if (original instanceof BigInteger) {
-                BigInteger bigi = (BigInteger) original;
-                // if it's bigger than a Long it can't be narrowed
-                if (bigi.compareTo(BIGI_LONG_MAX_VALUE) > 0
-                        || bigi.compareTo(BIGI_LONG_MIN_VALUE) < 0) {
-                    return original;
-                }
-            }
-            long value = original.longValue();
-            if (narrowAccept(narrow, Byte.class)
-                    && value <= Byte.MAX_VALUE
-                    && value >= Byte.MIN_VALUE) {
-                // it will fit in a byte
-                result = Byte.valueOf((byte) value);
-            } else if (narrowAccept(narrow, Short.class)
-                    && value <= Short.MAX_VALUE
-                    && value >= Short.MIN_VALUE) {
-                result = Short.valueOf((short) value);
-            } else if (narrowAccept(narrow, Integer.class)
-                    && value <= Integer.MAX_VALUE
-                    && value >= Integer.MIN_VALUE) {
-                result = Integer.valueOf((int) value);
-            }
-            // else it fits in a long
-        }
-        return result;
-    }
 }
\ No newline at end of file

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlContext.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlContext.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlContext.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java Tue Nov 29 16:18:59 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 /**
  * Manages variables which can be referenced in a JEXL expression.

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java Tue Nov 29 16:18:59 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -37,18 +37,17 @@ import java.util.Map.Entry;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.commons.jexl2.parser.ParseException;
-import org.apache.commons.jexl2.parser.Parser;
-import org.apache.commons.jexl2.parser.JexlNode;
-import org.apache.commons.jexl2.parser.TokenMgrError;
-import org.apache.commons.jexl2.parser.ASTJexlScript;
-
-import org.apache.commons.jexl2.introspection.Uberspect;
-import org.apache.commons.jexl2.introspection.UberspectImpl;
-import org.apache.commons.jexl2.introspection.JexlMethod;
-import org.apache.commons.jexl2.parser.ASTArrayAccess;
-import org.apache.commons.jexl2.parser.ASTIdentifier;
-import org.apache.commons.jexl2.parser.ASTReference;
+import org.apache.commons.jexl3.parser.ParseException;
+import org.apache.commons.jexl3.parser.Parser;
+import org.apache.commons.jexl3.parser.JexlNode;
+import org.apache.commons.jexl3.parser.TokenMgrError;
+import org.apache.commons.jexl3.parser.ASTJexlScript;
+
+import org.apache.commons.jexl3.introspection.Uberspect;
+import org.apache.commons.jexl3.introspection.JexlMethod;
+import org.apache.commons.jexl3.parser.ASTArrayAccess;
+import org.apache.commons.jexl3.parser.ASTIdentifier;
+import org.apache.commons.jexl3.parser.ASTReference;
 
 /**
  * <p>
@@ -126,7 +125,8 @@ public class JexlEngine {
      */
     private static final class UberspectHolder {
         /** The default uberspector that handles all introspection patterns. */
-        private static final Uberspect UBERSPECT = new UberspectImpl(LogFactory.getLog(JexlEngine.class));
+        private static final Uberspect UBERSPECT =
+                new org.apache.commons.jexl3.internal.introspection.Uberspect(LogFactory.getLog(JexlEngine.class));
 
         /** Non-instantiable. */
         private UberspectHolder() {
@@ -216,7 +216,7 @@ public class JexlEngine {
         if (logger == null || logger.equals(LogFactory.getLog(JexlEngine.class))) {
             return UberspectHolder.UBERSPECT;
         }
-        return new UberspectImpl(logger);
+        return new org.apache.commons.jexl3.internal.introspection.Uberspect(logger);
     }
 
     /**
@@ -280,7 +280,7 @@ public class JexlEngine {
      * as null.
      * <p>This method is <em>not</em> thread safe; it should be called as an optional step of the JexlEngine
      * initialization code before expression creation &amp; evaluation.</p>
-     * <p>As of 2.1, you need a JexlThreadedArithmetic instance for this call to also modify the JexlArithmetic
+     * <p>As of 3.0, you need a JexlThreadedArithmetic instance for this call to also modify the JexlArithmetic
      * leniency behavior.</p>
      * @see JexlEngine#setSilent
      * @see JexlEngine#setDebug
@@ -397,7 +397,7 @@ public class JexlEngine {
      * @return the script instance
      */
     protected Expression createExpression(ASTJexlScript tree, String text) {
-        return new ExpressionImpl(this, text, tree);
+        return new JexlScript(this, text, tree);
     }
 
     /**
@@ -443,7 +443,7 @@ public class JexlEngine {
      * @return A {@link Script} which can be executed using a {@link JexlContext}.
      * @throws JexlException if there is a problem parsing the script.
      */
-    public Script createScript(String scriptText) {
+    public JexlScript createScript(String scriptText) {
         return createScript(scriptText, null, null);
     }
 
@@ -456,7 +456,7 @@ public class JexlEngine {
      * @return A {@link Script} which can be executed using a {@link JexlContext}.
      * @throws JexlException if there is a problem parsing the script.
      */
-    public Script createScript(String scriptText, String... names) {
+    public JexlScript createScript(String scriptText, String... names) {
         return createScript(scriptText, null, names);
     }
 
@@ -472,7 +472,7 @@ public class JexlEngine {
      * @return A {@link Script} which can be executed using a {@link JexlContext}.
      * @throws JexlException if there is a problem parsing the script.
      */
-    public Script createScript(String scriptText, JexlInfo info, String[] names) {
+    public JexlScript createScript(String scriptText, JexlInfo info, String[] names) {
         if (scriptText == null) {
             throw new NullPointerException("scriptText is null");
         }
@@ -487,8 +487,8 @@ public class JexlEngine {
      * @param tree the parse AST tree
      * @return the script instance
      */
-    protected Script createScript(ASTJexlScript tree, String text) {
-        return new ExpressionImpl(this, text, tree);
+    protected JexlScript createScript(ASTJexlScript tree, String text) {
+        return new JexlScript(this, text, tree);
     }
 
     /**
@@ -664,11 +664,16 @@ public class JexlEngine {
     public Object invokeMethod(Object obj, String meth, Object... args) {
         JexlException xjexl = null;
         Object result = null;
-        JexlInfo info = debugInfo();
+        final JexlInfo info = jexlInfo();
+        JexlInfo.Handle handle = new JexlInfo.Handle() {
+            public JexlInfo jexlInfo() {
+                return info;
+            }
+        };
         try {
-            JexlMethod method = uberspect.getMethod(obj, meth, args, info);
+            JexlMethod method = uberspect.getMethod(obj, meth, args, handle);
             if (method == null && arithmetic.narrowArguments(args)) {
-                method = uberspect.getMethod(obj, meth, args, info);
+                method = uberspect.getMethod(obj, meth, args, handle);
             }
             if (method != null) {
                 result = method.invoke(obj, args);
@@ -722,11 +727,16 @@ public class JexlEngine {
     protected Object doCreateInstance(Object clazz, Object... args) {
         JexlException xjexl = null;
         Object result = null;
-        JexlInfo info = debugInfo();
+        final JexlInfo info = jexlInfo();
+        JexlInfo.Handle handle = new JexlInfo.Handle() {
+            public JexlInfo jexlInfo() {
+                return info;
+            }
+        };
         try {
-            JexlMethod ctor = uberspect.getConstructor(clazz, args, info);
+            JexlMethod ctor = uberspect.getConstructor(clazz, args, handle);
             if (ctor == null && arithmetic.narrowArguments(args)) {
-                ctor = uberspect.getConstructor(clazz, args, info);
+                ctor = uberspect.getConstructor(clazz, args, handle);
             }
             if (ctor != null) {
                 result = ctor.invoke(clazz, args);
@@ -877,14 +887,10 @@ public class JexlEngine {
      * @return the set of variables, each as a list of strings (ant-ish variables use more than 1 string)
      *         or the empty set if no variables are used
      */
-    public Set<List<String>> getVariables(Script script) {
-        if (script instanceof ExpressionImpl) {
-            Set<List<String>> refs = new LinkedHashSet<List<String>>();
-            getVariables(((ExpressionImpl) script).script, refs, null);
-            return refs;
-        } else {
-            return Collections.<List<String>>emptySet();
-        }
+    protected Set<List<String>> getVariables(JexlNode script) {
+        Set<List<String>> refs = new LinkedHashSet<List<String>>();
+        getVariables(script, refs, null);
+        return refs;
     }
 
     /**
@@ -952,30 +958,25 @@ public class JexlEngine {
      * Gets the array of parameters from a script.
      * @param script the script
      * @return the parameters which may be empty (but not null) if no parameters were defined
+     * @since 3.0
      */
-    protected String[] getParameters(Script script) {
-        if (script instanceof ExpressionImpl) {
-            return ((ExpressionImpl) script).getParameters();
-        } else {
-            return new String[0];
-        }
+    protected String[] getParameters(JexlScript script) {
+        return script.getParameters();
     }
 
     /**
      * Gets the array of local variable from a script.
      * @param script the script
      * @return the local variables array which may be empty (but not null) if no local variables were defined
+     * @since 3.0
      */
-    protected String[] getLocalVariables(Script script) {
-        if (script instanceof ExpressionImpl) {
-            return ((ExpressionImpl) script).getLocalVariables();
-        } else {
-            return new String[0];
-        }
+    protected String[] getLocalVariables(JexlScript script) {
+        return script.getLocalVariables();
     }
 
     /**
      * A script scope, stores the declaration of parameters and local variables.
+     * @since 3.0
      */
     public static final class Scope {
         /**
@@ -1103,7 +1104,7 @@ public class JexlEngine {
                 String[] pa = new String[parms];
                 int p = 0;
                 for (Map.Entry<String, Integer> entry : namedRegisters.entrySet()) {
-                    if (entry.getValue() < parms) {
+                    if (entry.getValue().intValue() < parms) {
                         pa[p++] = entry.getKey();
                     }
                 }
@@ -1122,7 +1123,7 @@ public class JexlEngine {
                 String[] pa = new String[parms];
                 int p = 0;
                 for (Map.Entry<String, Integer> entry : namedRegisters.entrySet()) {
-                    if (entry.getValue() >= parms) {
+                    if (entry.getValue().intValue() >= parms) {
                         pa[p++] = entry.getKey();
                     }
                 }
@@ -1135,6 +1136,7 @@ public class JexlEngine {
 
     /**
      * A call frame, created from a scope, stores the arguments and local variables as "registers".
+     * @since 3.0
      */
     public static final class Frame {
         /** Registers or arguments. */
@@ -1178,7 +1180,7 @@ public class JexlEngine {
     protected ASTJexlScript parse(CharSequence expression, JexlInfo info, Scope frame) {
         String expr = cleanExpression(expression);
         ASTJexlScript script = null;
-        DebugInfo dbgInfo = null;
+        JexlInfo jexlInfo = null;
         synchronized (parser) {
             if (cache != null) {
                 script = cache.get(expr);
@@ -1193,14 +1195,12 @@ public class JexlEngine {
                 Reader reader = new StringReader(expr);
                 // use first calling method of JexlEngine as debug info
                 if (info == null) {
-                    dbgInfo = debugInfo();
-                } else if (info instanceof DebugInfo) {
-                    dbgInfo = (DebugInfo) info;
+                    jexlInfo = jexlInfo();
                 } else {
-                    dbgInfo = info.debugInfo();
+                    jexlInfo = info;
                 }
                 parser.setFrame(frame);
-                script = parser.parse(reader, dbgInfo);
+                script = parser.parse(reader, jexlInfo);
                 // reaccess in case local variables have been declared
                 frame = parser.getFrame();
                 if (frame != null) {
@@ -1210,9 +1210,9 @@ public class JexlEngine {
                     cache.put(expr, script);
                 }
             } catch (TokenMgrError xtme) {
-                throw new JexlException.Tokenization(dbgInfo, expression, xtme);
+                throw new JexlException.Tokenization(jexlInfo, expression, xtme);
             } catch (ParseException xparse) {
-                throw new JexlException.Parsing(dbgInfo, expression, xparse);
+                throw new JexlException.Parsing(jexlInfo, expression, xparse);
             } finally {
                 parser.setFrame(null);
             }
@@ -1227,8 +1227,8 @@ public class JexlEngine {
      * @param c column number
      * @return a JexlInfo instance
      */
-    protected DebugInfo createInfo(String fn, int l, int c) {
-        return new DebugInfo(fn, l, c);
+    protected JexlInfo createInfo(String fn, int l, int c) {
+        return new JexlInfo(fn, l, c);
     }
 
     /**
@@ -1237,8 +1237,8 @@ public class JexlEngine {
      * not owned by JexlEngine, UnifiedJEXL or {Script,Expression}Factory.</p>
      * @return an Info if debug is set, null otherwise
      */
-    protected DebugInfo debugInfo() {
-        DebugInfo info = null;
+    protected JexlInfo jexlInfo() {
+        JexlInfo info = null;
         if (debug) {
             Throwable xinfo = new Throwable();
             xinfo.fillInStackTrace();

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlException.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlException.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlException.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java Tue Nov 29 16:18:59 2011
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.UndeclaredThrowableException;
-import org.apache.commons.jexl2.parser.JexlNode;
-import org.apache.commons.jexl2.parser.ParseException;
-import org.apache.commons.jexl2.parser.TokenMgrError;
+import org.apache.commons.jexl3.parser.JexlNode;
+import org.apache.commons.jexl3.parser.ParseException;
+import org.apache.commons.jexl3.parser.TokenMgrError;
 
 /**
  * Wraps any error that might occur during interpretation of a script or expression.
@@ -46,7 +46,7 @@ public class JexlException extends Runti
     public JexlException(JexlNode node, String msg) {
         super(msg);
         mark = node;
-        info = node != null ? node.debugInfo() : null;
+        info = node != null ? node.jexlInfo() : null;
 
     }
 
@@ -59,7 +59,7 @@ public class JexlException extends Runti
     public JexlException(JexlNode node, String msg, Throwable cause) {
         super(msg, unwrap(cause));
         mark = node;
-        info = node != null ? node.debugInfo() : null;
+        info = node != null ? node.jexlInfo() : null;
     }
 
     /**
@@ -115,7 +115,7 @@ public class JexlException extends Runti
      * @return the formatted message
      */
     protected String parserError(String prefix, String expr) {
-        int begin = info.debugInfo().getColumn();
+        int begin = info.getColumn();
         int end = begin + MIN_EXCHARLOC;
         begin -= MIN_EXCHARLOC;
         if (begin < 0) {
@@ -133,6 +133,7 @@ public class JexlException extends Runti
 
     /**
      * Thrown when tokenization fails.
+     * @since 3.0
      */
     public static class Tokenization extends JexlException {
         /**
@@ -151,14 +152,14 @@ public class JexlException extends Runti
          * @param cause the cause
          * @return the info to use
          */
-        private static DebugInfo merge(JexlInfo node, TokenMgrError cause) {
-            DebugInfo dbgn = node != null ? node.debugInfo() : null;
+        private static JexlInfo merge(JexlInfo node, TokenMgrError cause) {
+            JexlInfo dbgn = node != null ? node : null;
             if (cause == null) {
                 return dbgn;
             } else if (dbgn == null) {
-                return new DebugInfo("", cause.getLine(), cause.getColumn());
+                return new JexlInfo("", cause.getLine(), cause.getColumn());
             } else {
-                return new DebugInfo(dbgn.getName(), cause.getLine(), cause.getColumn());
+                return new JexlInfo(dbgn.getName(), cause.getLine(), cause.getColumn());
             }
         }
 
@@ -177,6 +178,7 @@ public class JexlException extends Runti
 
     /**
      * Thrown when parsing fails.
+     * @since 3.0
      */
     public static class Parsing extends JexlException {
         /**
@@ -195,14 +197,14 @@ public class JexlException extends Runti
          * @param cause the cause
          * @return the info to use
          */
-        private static DebugInfo merge(JexlInfo node, ParseException cause) {
-            DebugInfo dbgn = node != null ? node.debugInfo() : null;
+        private static JexlInfo merge(JexlInfo node, ParseException cause) {
+            JexlInfo dbgn = node != null ? node : null;
             if (cause == null) {
                 return dbgn;
             } else if (dbgn == null) {
-                return new DebugInfo("", cause.getLine(), cause.getColumn());
+                return new JexlInfo("", cause.getLine(), cause.getColumn());
             } else {
-                return new DebugInfo(dbgn.getName(), cause.getLine(), cause.getColumn());
+                return new JexlInfo(dbgn.getName(), cause.getLine(), cause.getColumn());
             }
         }
 
@@ -221,6 +223,7 @@ public class JexlException extends Runti
 
     /**
      * Thrown when a variable is unknown.
+     * @since 3.0
      */
     public static class Variable extends JexlException {
         /**
@@ -247,6 +250,7 @@ public class JexlException extends Runti
 
     /**
      * Thrown when a property is unknown.
+     * @since 3.0
      */
     public static class Property extends JexlException {
         /**
@@ -273,6 +277,7 @@ public class JexlException extends Runti
 
     /**
      * Thrown when a method or ctor is unknown, ambiguous or inaccessible.
+     * @since 3.0
      */
     public static class Method extends JexlException {
         /**
@@ -299,6 +304,7 @@ public class JexlException extends Runti
 
     /**
      * Thrown to return a value.
+     * @since 3.0
      */
     protected static class Return extends JexlException {
         /** The returned value. */
@@ -325,6 +331,7 @@ public class JexlException extends Runti
 
     /**
      * Thrown to cancel a script execution.
+     * @since 3.0
      */
     protected static class Cancel extends JexlException {
         /**
@@ -372,7 +379,7 @@ public class JexlException extends Runti
         Debugger dbg = new Debugger();
         StringBuilder msg = new StringBuilder();
         if (info != null) {
-            msg.append(info.debugString());
+            msg.append(info.toString());
         }
         if (dbg.debug(mark)) {
             msg.append("![");

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlInfo.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlInfo.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlInfo.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java Tue Nov 29 16:18:59 2011
@@ -14,21 +14,84 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
+
 
 /**
- * Interface for objects carrying information usefull to debugging.
- * @since 1.0
+ * Helper class to carry in info such as a url/file name, line and column for
+ * debugging information reporting.
  */
-public interface JexlInfo {
+public class JexlInfo {
+    /** line number. */
+    protected final int line;
+    /** column number. */
+    protected final int column;
+    /** name. */
+    protected final String name;
+    
+    /** 
+     * Create info.
+     * @param tn template name
+     * @param l line number
+     * @param c column
+     */
+    public JexlInfo(String tn, int l, int c) {
+        name = tn;
+        line = l;
+        column = c;
+    }
+    
     /**
-     * Formats this information for debugging purpose.
-     * @return a human readable string.
+     * Denotes objects that can expose a JexlInfo instance.
      */
-    String debugString();
+    public interface Handle {
+        /**
+         * Gets the associated JexlInfo instance.
+         * @return the info
+         */
+        JexlInfo jexlInfo();
+    }
+
     /**
-     * Gets the underlying debugging information.
-     * @return a debug info instance
+     * Formats this info in the form 'name&#064;line:column'.
+     * @return the formatted info
      */
-    DebugInfo debugInfo();
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(name != null? name : "");
+        if (line > 0) {
+            sb.append("@");
+            sb.append(line);
+            if (column > 0) {
+                sb.append(":");
+                sb.append(column);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Gets the file/script/url name.
+     * @return template name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Gets the line number.
+     * @return line number.
+     */
+    public int getLine() {
+        return line;
+    }
+
+    /**
+     * Gets the column number.
+     * @return the column.
+     */
+    public int getColumn() {
+        return column;
+    }
 }
+

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java Tue Nov 29 16:18:59 2011
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.Callable;
 
-import org.apache.commons.jexl2.parser.ASTJexlScript;
+import org.apache.commons.jexl3.parser.ASTJexlScript;
 
 /**
- * Instances of ExpressionImpl are created by the {@link JexlEngine},
+ * Instances of JexlScript are created by the {@link JexlEngine},
  * and this is the default implementation of the {@link Expression} and
  * {@link Script} interface.
- * @since 1.0
+ * @since 3.0
  */
-public class ExpressionImpl implements Expression, Script {
+public class JexlScript implements Expression, Script {
     /** The engine for this expression. */
     protected final JexlEngine jexl;
     /**
@@ -47,7 +47,7 @@ public class ExpressionImpl implements E
      * @param expr the expression.
      * @param ref the parsed expression.
      */
-    protected ExpressionImpl(JexlEngine engine, String expr, ASTJexlScript ref) {
+    protected JexlScript(JexlEngine engine, String expr, ASTJexlScript ref) {
         jexl = engine;
         expression = expr;
         script = ref;
@@ -117,35 +117,50 @@ public class ExpressionImpl implements E
     }
 
     /**
-     * {@inheritDoc}
+     * Gets this script parameters.
+     * @return the parameters or null
+     * @since 3.0
      */
     public String[] getParameters() {
         return script.getParameters();
     }
 
     /**
-     * {@inheritDoc}
+     * Gets this script local variables.
+     * @return the local variables or null
      */
     public String[] getLocalVariables() {
         return script.getLocalVariables();
     }
 
     /**
-     * {@inheritDoc}
+     * Gets this script variables.
+     * <p>Note that since variables can be in an ant-ish form (ie foo.bar.quux), each variable is returned as 
+     * a list of strings where each entry is a fragment of the variable ({"foo", "bar", "quux"} in the example.</p>
+     * @return the variables or null
      */
     public Set<List<String>> getVariables() {
-        return jexl.getVariables(this);
+        return jexl.getVariables(script);
     }
 
     /**
-     * {@inheritDoc}
+     * Creates a Callable from this script.
+     * <p>This allows to submit it to an executor pool and provides support for asynchronous calls.</p>
+     * <p>The interpreter will handle interruption/cancellation gracefully if needed.</p>
+     * @param context the context
+     * @return the callable
      */
     public Callable<Object> callable(JexlContext context) {
         return callable(context, (Object[]) null);
     }
 
     /**
-     * {@inheritDoc}
+     * Creates a Callable from this script.
+     * <p>This allows to submit it to an executor pool and provides support for asynchronous calls.</p>
+     * <p>The interpreter will handle interruption/cancellation gracefully if needed.</p>
+     * @param context the context
+     * @param args the script arguments
+     * @return the callable
      */
     public Callable<Object> callable(JexlContext context, Object... args) {
         final Interpreter interpreter = jexl.createInterpreter(context);
@@ -161,8 +176,6 @@ public class ExpressionImpl implements E
                 }
                 return result;
             }
-
         };
     }
-
 }
\ No newline at end of file

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlThreadedArithmetic.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlThreadedArithmetic.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlThreadedArithmetic.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlThreadedArithmetic.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlThreadedArithmetic.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlThreadedArithmetic.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlThreadedArithmetic.java Tue Nov 29 16:18:59 2011
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 import java.math.MathContext;
 
 /**
  * A derived arithmetic that allows different threads to operate with
  * different strict/lenient/math modes using the same JexlEngine.
+ * @since 3.0
  */
 public class JexlThreadedArithmetic extends JexlArithmetic {
     

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlThreadedArithmetic.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Main.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Main.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Main.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Main.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Main.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Main.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Main.java Tue Nov 29 16:18:59 2011
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 import java.io.BufferedReader;
 import java.io.File;

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Main.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/MapContext.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/MapContext.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/MapContext.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java Tue Nov 29 16:18:59 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 import java.util.HashMap;
 import java.util.Map;

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/NamespaceResolver.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/NamespaceResolver.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/NamespaceResolver.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/NamespaceResolver.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/NamespaceResolver.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/NamespaceResolver.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/NamespaceResolver.java Tue Nov 29 16:18:59 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 /**
  * 
@@ -28,6 +28,7 @@ package org.apache.commons.jexl2;
  * JEXL itself reserves 'jexl' and 'ujexl' as namespaces for internal purpose; resolving those may lead to unexpected
  * results.
  * </p>
+ * @since 3.0
  */
 public interface NamespaceResolver {
     /**

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/NamespaceResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ObjectContext.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ObjectContext.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ObjectContext.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java Tue Nov 29 16:18:59 2011
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 /**
  * Wraps an Object as a Jexl context.
  * @param <T> the wrapped object type to use
+ * @since 3.0
  */
 public class ObjectContext<T> implements JexlContext {
     /** The property solving jexl engine. */

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ReadonlyContext.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ReadonlyContext.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ReadonlyContext.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ReadonlyContext.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ReadonlyContext.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ReadonlyContext.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ReadonlyContext.java Tue Nov 29 16:18:59 2011
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 /**
  * A readonly context wrapper.
+ * @since 3.0
  */
 public final class ReadonlyContext implements JexlContext {
     /** The wrapped context. */

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ReadonlyContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Script.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Script.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Script.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Script.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Script.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Script.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Script.java Tue Nov 29 16:18:59 2011
@@ -14,11 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
-
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.Callable;
+package org.apache.commons.jexl3;
 
 /**
  * <p>A JEXL Script.</p>
@@ -51,6 +47,7 @@ public interface Script {
      * @param args the arguments
      * @return The result of this script, usually the result of 
      *      the last statement.
+     * @since 3.0
      */
     Object execute(JexlContext context, Object... args);
 
@@ -59,43 +56,4 @@ public interface Script {
      * @return The script to be executed.
      */
     String getText();
-
-    /**
-     * Gets this script parameters.
-     * @return the parameters or null
-     */
-    String[] getParameters();
-
-    /**
-     * Gets this script local variables.
-     * @return the local variables or null
-     */
-    String[] getLocalVariables();
-
-    /**
-     * Gets this script variables.
-     * <p>Note that since variables can be in an ant-ish form (ie foo.bar.quux), each variable is returned as 
-     * a list of strings where each entry is a fragment of the variable ({"foo", "bar", "quux"} in the example.</p>
-     * @return the variables or null
-     */
-    Set<List<String>> getVariables();
-
-    /**
-     * Creates a Callable from this script.
-     * <p>This allows to submit it to an executor pool and provides support for asynchronous calls.</p>
-     * <p>The interpreter will handle interruption/cancellation gracefully if needed.</p>
-     * @param context the context
-     * @return the callable
-     */
-    Callable<Object> callable(JexlContext context);
-
-    /**
-     * Creates a Callable from this script.
-     * <p>This allows to submit it to an executor pool and provides support for asynchronous calls.</p>
-     * <p>The interpreter will handle interruption/cancellation gracefully if needed.</p>
-     * @param context the context
-     * @param args the script arguments
-     * @return the callable
-     */
-    Callable<Object> callable(JexlContext context, Object... args);
 }

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Script.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Script.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/UnifiedJEXL.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/UnifiedJEXL.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/UnifiedJEXL.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/UnifiedJEXL.java Tue Nov 29 16:18:59 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2;
+package org.apache.commons.jexl3;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -26,11 +26,11 @@ import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
-import org.apache.commons.jexl2.introspection.JexlMethod;
-import org.apache.commons.jexl2.introspection.Uberspect;
-import org.apache.commons.jexl2.parser.ASTJexlScript;
-import org.apache.commons.jexl2.parser.JexlNode;
-import org.apache.commons.jexl2.parser.StringParser;
+import org.apache.commons.jexl3.introspection.JexlMethod;
+import org.apache.commons.jexl3.introspection.Uberspect;
+import org.apache.commons.jexl3.parser.ASTJexlScript;
+import org.apache.commons.jexl3.parser.JexlNode;
+import org.apache.commons.jexl3.parser.StringParser;
 
 /**
  * An evaluator similar to the Unified EL evaluator used in JSP/JSF based on JEXL.
@@ -92,9 +92,9 @@ public final class UnifiedJEXL {
     /** The default cache size. */
     private static final int CACHE_SIZE = 256;
     /** The first character for immediate expressions. */
-    private static final char IMM_CHAR = '$';
+    private final char immediateChar;
     /** The first character for deferred expressions. */
-    private static final char DEF_CHAR = '#';
+    private final char deferredChar;
 
     /**
      * Creates a new instance of UnifiedJEXL with a default size cache.
@@ -110,8 +110,21 @@ public final class UnifiedJEXL {
      * @param cacheSize the number of expressions in this cache
      */
     public UnifiedJEXL(JexlEngine aJexl, int cacheSize) {
+        this(aJexl, cacheSize, '$', '#');
+    }
+    
+    /**
+     * Creates a new instance of UnifiedJEXL creating a local cache.
+     * @param aJexl the JexlEngine to use.
+     * @param cacheSize the number of expressions in this cache
+     * @param immediate the immediate expression character, default is '$'
+     * @param deferred the deferred expression character, default is '#'
+     */
+    public UnifiedJEXL(JexlEngine aJexl, int cacheSize, char immediate, char deferred) {
         this.jexl = aJexl;
         this.cache = aJexl.new SoftCache<String, Expression>(cacheSize);
+        immediateChar = immediate;
+        deferredChar = deferred;
     }
 
     /**
@@ -487,7 +500,7 @@ public final class UnifiedJEXL {
         /** {@inheritDoc} */
         @Override
         public StringBuilder asString(StringBuilder strb) {
-            strb.append(isImmediate() ? IMM_CHAR : DEF_CHAR);
+            strb.append(isImmediate() ? immediateChar : deferredChar);
             strb.append("{");
             strb.append(expr);
             strb.append("}");
@@ -620,7 +633,7 @@ public final class UnifiedJEXL {
         @Override
         protected Expression prepare(Interpreter interpreter) {
             String value = interpreter.interpret(node).toString();
-            JexlNode dnode = jexl.parse(value, jexl.isDebug() ? node.debugInfo() : null, null);
+            JexlNode dnode = jexl.parse(value, jexl.isDebug() ? node.jexlInfo() : null, null);
             return new ImmediateExpression(value, dnode, this);
         }
 
@@ -830,9 +843,9 @@ public final class UnifiedJEXL {
                 default: // in case we ever add new expression type
                     throw new UnsupportedOperationException("unexpected expression type");
                 case CONST:
-                    if (c == IMM_CHAR) {
+                    if (c == immediateChar) {
                         state = ParseState.IMMEDIATE0;
-                    } else if (c == DEF_CHAR) {
+                    } else if (c == deferredChar) {
                         inested = i;
                         state = ParseState.DEFERRED0;
                     } else if (c == '\\') {
@@ -853,7 +866,7 @@ public final class UnifiedJEXL {
                         }
                     } else {
                         // revert to CONST
-                        strb.append(IMM_CHAR);
+                        strb.append(immediateChar);
                         strb.append(c);
                         state = ParseState.CONST;
                     }
@@ -869,7 +882,7 @@ public final class UnifiedJEXL {
                         }
                     } else {
                         // revert to CONST
-                        strb.append(DEF_CHAR);
+                        strb.append(deferredChar);
                         strb.append(c);
                         state = ParseState.CONST;
                     }
@@ -898,7 +911,7 @@ public final class UnifiedJEXL {
                     }
                     // nested immediate in deferred; need to balance count of '{' & '}'
                     if (c == '{') {
-                        if (expr.charAt(i - 1) == IMM_CHAR) {
+                        if (expr.charAt(i - 1) == immediateChar) {
                             inner += 1;
                             strb.deleteCharAt(strb.length() - 1);
                             nested = true;
@@ -935,10 +948,10 @@ public final class UnifiedJEXL {
                     }
                     break;
                 case ESCAPE:
-                    if (c == DEF_CHAR) {
-                        strb.append(DEF_CHAR);
-                    } else if (c == IMM_CHAR) {
-                        strb.append(IMM_CHAR);
+                    if (c == deferredChar) {
+                        strb.append(deferredChar);
+                    } else if (c == immediateChar) {
+                        strb.append(immediateChar);
                     } else {
                         strb.append('\\');
                         strb.append(c);
@@ -1061,10 +1074,10 @@ public final class UnifiedJEXL {
             if (directive == null) {
                 throw new NullPointerException("null prefix");
             }
-            if ("$".equals(directive)
-                    || "${".equals(directive)
-                    || "#".equals(directive)
-                    || "#{".equals(directive)) {
+            if (Character.toString(immediateChar).equals(directive)
+                || (Character.toString(immediateChar) + "{").equals(directive)
+                || Character.toString(deferredChar).equals(directive)
+                || (Character.toString(deferredChar) + "{").equals(directive)) {
                 throw new IllegalArgumentException(directive + ": is not a valid directive pattern");
             }
             if (reader == null) {

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/UnifiedJEXL.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/UnifiedJEXL.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/AbstractExecutor.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/AbstractExecutor.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/AbstractExecutor.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/AbstractExecutor.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/AbstractExecutor.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/AbstractExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/AbstractExecutor.java Tue Nov 29 16:18:59 2011
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2.internal;
-import org.apache.commons.jexl2.internal.introspection.MethodKey;
-import org.apache.commons.jexl2.introspection.JexlMethod;
-import org.apache.commons.jexl2.introspection.JexlPropertySet;
-import org.apache.commons.jexl2.introspection.JexlPropertyGet;
+package org.apache.commons.jexl3.internal;
+import org.apache.commons.jexl3.internal.introspection.MethodKey;
+import org.apache.commons.jexl3.introspection.JexlMethod;
+import org.apache.commons.jexl3.introspection.JexlPropertySet;
+import org.apache.commons.jexl3.introspection.JexlPropertyGet;
 import java.lang.reflect.InvocationTargetException;
 
 /**

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/AbstractExecutor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/AbstractExecutor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/ArrayIterator.java (from r1206774, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/ArrayIterator.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/ArrayIterator.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/ArrayIterator.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/ArrayIterator.java&r1=1206774&r2=1207941&rev=1207941&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/ArrayIterator.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/ArrayIterator.java Tue Nov 29 16:18:59 2011
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.jexl2.internal;
+package org.apache.commons.jexl3.internal;
 
 import java.util.Iterator;
 import java.util.NoSuchElementException;



Mime
View raw message