commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r398166 [1/4] - /jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/
Date Sat, 29 Apr 2006 14:48:33 GMT
Author: dion
Date: Sat Apr 29 07:48:32 2006
New Revision: 398166

URL: http://svn.apache.org/viewcvs?rev=398166&view=rev
Log:
Checkstyle

Modified:
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTAssignment.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTEQNode.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTExpression.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTModNode.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/JJTParserState.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/Node.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ParseException.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/Parser.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ParserConstants.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ParserTokenManager.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ParserTreeConstants.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ParserVisitor.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/SimpleCharStream.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/SimpleNode.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/Token.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/TokenMgrError.java

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.java
Sat Apr 29 07:48:32 2006
@@ -27,7 +27,7 @@
 import java.lang.reflect.Array;
 
 /**
- * Like an ASTIdentifier, but with array access allowed
+ * Like an ASTIdentifier, but with array access allowed.
  * 
  * $foo[2]
  * 
@@ -35,8 +35,8 @@
  * @version $Id$
  */
 public class ASTArrayAccess extends SimpleNode {
-    /** dummy velocity info */
-    private static Info DUMMY = new Info("", 1, 1);
+    /** dummy velocity info. */
+    private static final Info DUMMY = new Info("", 1, 1);
 
     public ASTArrayAccess(int id) {
         super(id);

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTAssignment.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTAssignment.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTAssignment.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTAssignment.java
Sat Apr 29 07:48:32 2006
@@ -39,7 +39,7 @@
     }
 
     /**
-     * Handle assignment ( left = right )
+     * Handle assignment ( left = right ).
      */
     public Object value(JexlContext context) throws Exception {
         // left should be the variable (reference) to assign to

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTEQNode.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTEQNode.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTEQNode.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTEQNode.java
Sat Apr 29 07:48:32 2006
@@ -19,7 +19,23 @@
 import org.apache.commons.jexl.util.Coercion;
 
 /**
- * represents equality between integers - use .equals() for strings
+ * Represents equality between values.
+ * 
+ * If the values are of the same class, .equals() is used.
+ * 
+ * If either value is a {@link Float} or {@link Double} (but both are not the same class),
+ * the values are coerced to {@link Double}s before comparing.
+ * 
+ * If either value is a {@link Number} or {@link Character} (but both are not the same class),
+ * the values are coerced to {@link Long}s before comparing.
+ *
+ * If either value is a {@link Boolean} (but both are not the same class),
+ * the values are coerced to {@link Boolean}s before comparing.
+ * 
+ * If either value is a {@link String} (but both are not the same class),
+ * toString() is called on both before comparing.
+ * 
+ * Otherwise left.equals(right) is returned.
  * 
  * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  * @version $Id$

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTExpression.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTExpression.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTExpression.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTExpression.java
Sat Apr 29 07:48:32 2006
@@ -18,7 +18,7 @@
 import org.apache.commons.jexl.JexlContext;
 
 /**
- * AST node for expression
+ * AST node for expression.
  * 
  * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  * @version $Id$

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java
Sat Apr 29 07:48:32 2006
@@ -29,8 +29,8 @@
  * @since 1.1
  */
 public class ASTForeachStatement extends SimpleNode {
-    /** dummy velocity info */
-    private static Info DUMMY = new Info("", 1, 1);
+    /** dummy velocity info. */
+    private static final Info DUMMY = new Info("", 1, 1);
 
     public ASTForeachStatement(int id) {
         super(id);

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java
Sat Apr 29 07:48:32 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2002-2006 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.

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java
Sat Apr 29 07:48:32 2006
@@ -29,7 +29,7 @@
  */
 public class ASTMethod extends SimpleNode {
     /** dummy velocity info. */
-    private static Info DUMMY = new Info("", 1, 1);
+    private static final Info DUMMY = new Info("", 1, 1);
 
     public ASTMethod(int id) {
         super(id);

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTModNode.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTModNode.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTModNode.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTModNode.java
Sat Apr 29 07:48:32 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2003-2006 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.

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java
Sat Apr 29 07:48:32 2006
@@ -26,7 +26,7 @@
 import java.lang.reflect.Array;
 
 /**
- * generalized size() function for all classes we can think of
+ * generalized size() function for all classes we can think of.
  * 
  * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  * @author <a href="hw@kremvax.net">Mark H. Wilkinson</a>

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java
Sat Apr 29 07:48:32 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2003,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.

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java
Sat Apr 29 07:48:32 2006
@@ -18,7 +18,7 @@
 import org.apache.commons.jexl.JexlContext;
 
 /**
- * represents an string
+ * represents a quoted string.
  * 
  * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  * @version $Id$

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/JJTParserState.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/JJTParserState.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/JJTParserState.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/JJTParserState.java
Sat Apr 29 07:48:32 2006
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2002-2006 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.
+ */
 /* Generated By:JJTree: Do not edit this line. JJTParserState.java */
 
 package org.apache.commons.jexl.parser;
@@ -5,121 +20,130 @@
 import java.util.Stack;
 
 class JJTParserState {
-  private final Stack nodes;
-  private final Stack marks;
+    private final Stack nodes;
 
-  private int sp;		// number of nodes on stack
-  private int mk;		// current mark
-  private boolean node_created;
-
-  JJTParserState() {
-    nodes = new Stack();
-    marks = new Stack();
-    sp = 0;
-    mk = 0;
-  }
-
-  /* Determines whether the current node was actually closed and
-     pushed.  This should only be called in the final user action of a
-     node scope.  */
-  boolean nodeCreated() {
-    return node_created;
-  }
-
-  /* Call this to reinitialize the node stack.  It is called
-     automatically by the parser's ReInit() method. */
-  void reset() {
-    nodes.removeAllElements();
-    marks.removeAllElements();
-    sp = 0;
-    mk = 0;
-  }
-
-  /* Returns the root node of the AST.  It only makes sense to call
-     this after a successful parse. */
-  Node rootNode() {
-    return (Node)nodes.elementAt(0);
-  }
-
-  /* Pushes a node on to the stack. */
-  void pushNode(Node n) {
-    nodes.push(n);
-    ++sp;
-  }
-
-  /* Returns the node on the top of the stack, and remove it from the
-     stack.  */
-  Node popNode() {
-    if (--sp < mk) {
-      mk = ((Integer)marks.pop()).intValue();
-    }
-    return (Node)nodes.pop();
-  }
-
-  /* Returns the node currently on the top of the stack. */
-  Node peekNode() {
-    return (Node)nodes.peek();
-  }
-
-  /* Returns the number of children on the stack in the current node
-     scope. */
-  int nodeArity() {
-    return sp - mk;
-  }
-
-
-  void clearNodeScope(Node n) {
-    while (sp > mk) {
-      popNode();
-    }
-    mk = ((Integer)marks.pop()).intValue();
-  }
-
-
-  void openNodeScope(Node n) {
-    marks.push(new Integer(mk));
-    mk = sp;
-    n.jjtOpen();
-  }
-
-
-  /* A definite node is constructed from a specified number of
-     children.  That number of nodes are popped from the stack and
-     made the children of the definite node.  Then the definite node
-     is pushed on to the stack. */
-  void closeNodeScope(Node n, int num) {
-    mk = ((Integer)marks.pop()).intValue();
-    while (num-- > 0) {
-      Node c = popNode();
-      c.jjtSetParent(n);
-      n.jjtAddChild(c, num);
-    }
-    n.jjtClose();
-    pushNode(n);
-    node_created = true;
-  }
-
-
-  /* A conditional node is constructed if its condition is true.  All
-     the nodes that have been pushed since the node was opened are
-     made children of the the conditional node, which is then pushed
-     on to the stack.  If the condition is false the node is not
-     constructed and they are left on the stack. */
-  void closeNodeScope(Node n, boolean condition) {
-    if (condition) {
-      int a = nodeArity();
-      mk = ((Integer)marks.pop()).intValue();
-      while (a-- > 0) {
-	Node c = popNode();
-	c.jjtSetParent(n);
-	n.jjtAddChild(c, a);
-      }
-      n.jjtClose();
-      pushNode(n);
-      node_created = true;
-    } else {
-      mk = ((Integer)marks.pop()).intValue();
-      node_created = false;
+    private final Stack marks;
+
+    private int sp; // number of nodes on stack
+
+    private int mk; // current mark
+
+    private boolean node_created;
+
+    JJTParserState() {
+        nodes = new Stack();
+        marks = new Stack();
+        sp = 0;
+        mk = 0;
+    }
+
+    /*
+     * Determines whether the current node was actually closed and pushed. This
+     * should only be called in the final user action of a node scope.
+     */
+    boolean nodeCreated() {
+        return node_created;
+    }
+
+    /*
+     * Call this to reinitialize the node stack. It is called automatically by
+     * the parser's ReInit() method.
+     */
+    void reset() {
+        nodes.removeAllElements();
+        marks.removeAllElements();
+        sp = 0;
+        mk = 0;
+    }
+
+    /*
+     * Returns the root node of the AST. It only makes sense to call this after
+     * a successful parse.
+     */
+    Node rootNode() {
+        return (Node) nodes.elementAt(0);
+    }
+
+    /* Pushes a node on to the stack. */
+    void pushNode(Node n) {
+        nodes.push(n);
+        ++sp;
+    }
+
+    /*
+     * Returns the node on the top of the stack, and remove it from the stack.
+     */
+    Node popNode() {
+        if (--sp < mk) {
+            mk = ((Integer) marks.pop()).intValue();
+        }
+        return (Node) nodes.pop();
+    }
+
+    /* Returns the node currently on the top of the stack. */
+    Node peekNode() {
+        return (Node) nodes.peek();
+    }
+
+    /*
+     * Returns the number of children on the stack in the current node scope.
+     */
+    int nodeArity() {
+        return sp - mk;
+    }
+
+    void clearNodeScope(Node n) {
+        while (sp > mk) {
+            popNode();
+        }
+        mk = ((Integer) marks.pop()).intValue();
+    }
+
+    void openNodeScope(Node n) {
+        marks.push(new Integer(mk));
+        mk = sp;
+        n.jjtOpen();
+    }
+
+    /*
+     * A definite node is constructed from a specified number of children. That
+     * number of nodes are popped from the stack and made the children of the
+     * definite node. Then the definite node is pushed on to the stack.
+     */
+    void closeNodeScope(Node n, int num) {
+        mk = ((Integer) marks.pop()).intValue();
+        while (num-- > 0) {
+            Node c = popNode();
+            c.jjtSetParent(n);
+            n.jjtAddChild(c, num);
+        }
+        n.jjtClose();
+        pushNode(n);
+        node_created = true;
+    }
+
+    /*
+     * A conditional node is constructed if its condition is true. All the nodes
+     * that have been pushed since the node was opened are made children of the
+     * the conditional node, which is then pushed on to the stack. If the
+     * condition is false the node is not constructed and they are left on the
+     * stack.
+     */
+    void closeNodeScope(Node n, boolean condition) {
+        if (condition) {
+            int a = nodeArity();
+            mk = ((Integer) marks.pop()).intValue();
+            while (a-- > 0) {
+                Node c = popNode();
+                c.jjtSetParent(n);
+                n.jjtAddChild(c, a);
+            }
+            n.jjtClose();
+            pushNode(n);
+            node_created = true;
+        } else {
+            mk = ((Integer) marks.pop()).intValue();
+            node_created = false;
+        }
     }
-  }
 }

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/Node.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/Node.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/Node.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/Node.java Sat
Apr 29 07:48:32 2006
@@ -1,37 +1,62 @@
+/*
+ * Copyright 2002-2006 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.
+ */
 /* Generated By:JJTree: Do not edit this line. Node.java */
 
 package org.apache.commons.jexl.parser;
 
-/* All AST nodes must implement this interface.  It provides basic
-   machinery for constructing the parent and child relationships
-   between nodes. */
+/*
+ * All AST nodes must implement this interface. It provides basic machinery for
+ * constructing the parent and child relationships between nodes.
+ */
 
 public interface Node {
 
-  /** This method is called after the node has been made the current
-    node.  It indicates that child nodes can now be added to it. */
-  public void jjtOpen();
-
-  /** This method is called after all the child nodes have been
-    added. */
-  public void jjtClose();
-
-  /** This pair of methods are used to inform the node of its
-    parent. */
-  public void jjtSetParent(Node n);
-  public Node jjtGetParent();
-
-  /** This method tells the node to add its argument to the node's
-    list of children.  */
-  public void jjtAddChild(Node n, int i);
-
-  /** This method returns a child node.  The children are numbered
-     from zero, left to right. */
-  public Node jjtGetChild(int i);
+    /**
+     * This method is called after the node has been made the current node. It
+     * indicates that child nodes can now be added to it.
+     */
+     void jjtOpen();
+
+    /**
+     * This method is called after all the child nodes have been added.
+     */
+     void jjtClose();
+
+    /**
+     * This pair of methods are used to inform the node of its parent.
+     */
+     void jjtSetParent(Node n);
+
+     Node jjtGetParent();
+
+    /**
+     * This method tells the node to add its argument to the node's list of
+     * children.
+     */
+     void jjtAddChild(Node n, int i);
+
+    /**
+     * This method returns a child node. The children are numbered from zero,
+     * left to right.
+     */
+     Node jjtGetChild(int i);
 
-  /** Return the number of children the node has. */
-  public int jjtGetNumChildren();
+    /** Return the number of children the node has. */
+     int jjtGetNumChildren();
 
-  /** Accept the visitor. **/
-  public Object jjtAccept(ParserVisitor visitor, Object data);
+    /** Accept the visitor. * */
+     Object jjtAccept(ParserVisitor visitor, Object data);
 }

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ParseException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ParseException.java?rev=398166&r1=398165&r2=398166&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ParseException.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ParseException.java
Sat Apr 29 07:48:32 2006
@@ -1,195 +1,199 @@
+/*
+ * Copyright 2002-2006 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.
+ */
 /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 2.1 */
 package org.apache.commons.jexl.parser;
 
 /**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
+ * This exception is thrown when parse errors are encountered. You can
+ * explicitly create objects of this exception type by calling the method
+ * generateParseException in the generated parser.
+ * 
+ * You can modify this class to customize your error reporting mechanisms so
+ * long as you retain the public fields.
  */
 public class ParseException extends Exception {
-  
-  /** serialization version id jdk13 generated */
-  static final long serialVersionUID = 654626477565941968L;
-
-  /**
-   * This constructor is used by the method "generateParseException"
-   * in the generated parser.  Calling this constructor generates
-   * a new object of this type with the fields "currentToken",
-   * "expectedTokenSequences", and "tokenImage" set.  The boolean
-   * flag "specialConstructor" is also set to true to indicate that
-   * this constructor was used to create this object.
-   * This constructor calls its super class with the empty string
-   * to force the "toString" method of parent class "Throwable" to
-   * print the error message in the form:
-   *     ParseException: <result of getMessage>
-   */
-  public ParseException(Token currentTokenVal,
-                        int[][] expectedTokenSequencesVal,
-                        String[] tokenImageVal
-                       )
-  {
-    super("");
-    specialConstructor = true;
-    currentToken = currentTokenVal;
-    expectedTokenSequences = expectedTokenSequencesVal;
-    tokenImage = tokenImageVal;
-  }
-
-  /**
-   * The following constructors are for use by you for whatever
-   * purpose you can think of.  Constructing the exception in this
-   * manner makes the exception behave in the normal way - i.e., as
-   * documented in the class "Throwable".  The fields "errorToken",
-   * "expectedTokenSequences", and "tokenImage" do not contain
-   * relevant information.  The JavaCC generated code does not use
-   * these constructors.
-   */
-
-  public ParseException() {
-    super();
-    specialConstructor = false;
-  }
-
-  public ParseException(String message) {
-    super(message);
-    specialConstructor = false;
-  }
-
-  /**
-   * This variable determines which constructor was used to create
-   * this object and thereby affects the semantics of the
-   * "getMessage" method (see below).
-   */
-  protected boolean specialConstructor;
-
-  /**
-   * This is the last token that has been consumed successfully.  If
-   * this object has been created due to a parse error, the token
-   * followng this token will (therefore) be the first error token.
-   */
-  public Token currentToken;
-
-  /**
-   * Each entry in this array is an array of integers.  Each array
-   * of integers represents a sequence of tokens (by their ordinal
-   * values) that is expected at this point of the parse.
-   */
-  public int[][] expectedTokenSequences;
-
-  /**
-   * This is a reference to the "tokenImage" array of the generated
-   * parser within which the parse error occurred.  This array is
-   * defined in the generated ...Constants interface.
-   */
-  public String[] tokenImage;
-
-  /**
-   * This method has the standard behavior when this object has been
-   * created using the standard constructors.  Otherwise, it uses
-   * "currentToken" and "expectedTokenSequences" to generate a parse
-   * error message and returns it.  If this object has been created
-   * due to a parse error, and you do not catch it (it gets thrown
-   * from the parser), then this method is called during the printing
-   * of the final stack trace, and hence the correct error message
-   * gets displayed.
-   */
-  public String getMessage() {
-    if (!specialConstructor) {
-      return super.getMessage();
+
+    /** serialization version id jdk13 generated. */
+    static final long serialVersionUID = 654626477565941968L;
+
+    /**
+     * This constructor is used by the method "generateParseException" in the
+     * generated parser. Calling this constructor generates a new object of this
+     * type with the fields "currentToken", "expectedTokenSequences", and
+     * "tokenImage" set. The boolean flag "specialConstructor" is also set to
+     * true to indicate that this constructor was used to create this object.
+     * This constructor calls its super class with the empty string to force the
+     * "toString" method of parent class "Throwable" to print the error message
+     * in the form: ParseException: (result of getMessage)
+     */
+    public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[]
tokenImageVal) {
+        super("");
+        specialConstructor = true;
+        currentToken = currentTokenVal;
+        expectedTokenSequences = expectedTokenSequencesVal;
+        tokenImage = tokenImageVal;
     }
-    String expected = "";
-    int maxSize = 0;
-    for (int i = 0; i < expectedTokenSequences.length; i++) {
-      if (maxSize < expectedTokenSequences[i].length) {
-        maxSize = expectedTokenSequences[i].length;
-      }
-      for (int j = 0; j < expectedTokenSequences[i].length; j++) {
-        expected += tokenImage[expectedTokenSequences[i][j]] + " ";
-      }
-      if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
-        expected += "...";
-      }
-      expected += eol + "    ";
+
+    /**
+     * The following constructors are for use by you for whatever purpose you
+     * can think of. Constructing the exception in this manner makes the
+     * exception behave in the normal way - i.e., as documented in the class
+     * "Throwable". The fields "errorToken", "expectedTokenSequences", and
+     * "tokenImage" do not contain relevant information. The JavaCC generated
+     * code does not use these constructors.
+     */
+
+    public ParseException() {
+        super();
+        specialConstructor = false;
     }
-    String retval = "Encountered \"";
-    Token tok = currentToken.next;
-    for (int i = 0; i < maxSize; i++) {
-      if (i != 0) retval += " ";
-      if (tok.kind == 0) {
-        retval += tokenImage[0];
-        break;
-      }
-      retval += add_escapes(tok.image);
-      tok = tok.next; 
+
+    public ParseException(String message) {
+        super(message);
+        specialConstructor = false;
     }
-    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
-    retval += "." + eol;
-    if (expectedTokenSequences.length == 1) {
-      retval += "Was expecting:" + eol + "    ";
-    } else {
-      retval += "Was expecting one of:" + eol + "    ";
+
+    /**
+     * This variable determines which constructor was used to create this object
+     * and thereby affects the semantics of the "getMessage" method (see below).
+     */
+    protected boolean specialConstructor;
+
+    /**
+     * This is the last token that has been consumed successfully. If this
+     * object has been created due to a parse error, the token followng this
+     * token will (therefore) be the first error token.
+     */
+    public Token currentToken;
+
+    /**
+     * Each entry in this array is an array of integers. Each array of integers
+     * represents a sequence of tokens (by their ordinal values) that is
+     * expected at this point of the parse.
+     */
+    public int[][] expectedTokenSequences;
+
+    /**
+     * This is a reference to the "tokenImage" array of the generated parser
+     * within which the parse error occurred. This array is defined in the
+     * generated ...Constants interface.
+     */
+    public String[] tokenImage;
+
+    /**
+     * This method has the standard behavior when this object has been created
+     * using the standard constructors. Otherwise, it uses "currentToken" and
+     * "expectedTokenSequences" to generate a parse error message and returns
+     * it. If this object has been created due to a parse error, and you do not
+     * catch it (it gets thrown from the parser), then this method is called
+     * during the printing of the final stack trace, and hence the correct error
+     * message gets displayed.
+     */
+    public String getMessage() {
+        if (!specialConstructor) {
+            return super.getMessage();
+        }
+        String expected = "";
+        int maxSize = 0;
+        for (int i = 0; i < expectedTokenSequences.length; i++) {
+            if (maxSize < expectedTokenSequences[i].length) {
+                maxSize = expectedTokenSequences[i].length;
+            }
+            for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+                expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+            }
+            if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+                expected += "...";
+            }
+            expected += eol + "    ";
+        }
+        String retval = "Encountered \"";
+        Token tok = currentToken.next;
+        for (int i = 0; i < maxSize; i++) {
+            if (i != 0)
+                retval += " ";
+            if (tok.kind == 0) {
+                retval += tokenImage[0];
+                break;
+            }
+            retval += add_escapes(tok.image);
+            tok = tok.next;
+        }
+        retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+        retval += "." + eol;
+        if (expectedTokenSequences.length == 1) {
+            retval += "Was expecting:" + eol + "    ";
+        } else {
+            retval += "Was expecting one of:" + eol + "    ";
+        }
+        retval += expected;
+        return retval;
     }
-    retval += expected;
-    return retval;
-  }
-
-  /**
-   * The end of line string for this machine.
-   */
-  protected String eol = System.getProperty("line.separator", "\n");
- 
-  /**
-   * Used to convert raw characters to their escaped version
-   * when these raw version cannot be used as part of an ASCII
-   * string literal.
-   */
-  protected String add_escapes(String str) {
-      StringBuffer retval = new StringBuffer();
-      char ch;
-      for (int i = 0; i < str.length(); i++) {
-        switch (str.charAt(i))
-        {
-           case 0 :
-              continue;
-           case '\b':
-              retval.append("\\b");
-              continue;
-           case '\t':
-              retval.append("\\t");
-              continue;
-           case '\n':
-              retval.append("\\n");
-              continue;
-           case '\f':
-              retval.append("\\f");
-              continue;
-           case '\r':
-              retval.append("\\r");
-              continue;
-           case '\"':
-              retval.append("\\\"");
-              continue;
-           case '\'':
-              retval.append("\\\'");
-              continue;
-           case '\\':
-              retval.append("\\\\");
-              continue;
-           default:
-              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                 String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
-              } else {
-                 retval.append(ch);
-              }
-              continue;
+
+    /**
+     * The end of line string for this machine.
+     */
+    protected String eol = System.getProperty("line.separator", "\n");
+
+    /**
+     * Used to convert raw characters to their escaped version when these raw
+     * version cannot be used as part of an ASCII string literal.
+     */
+    protected String add_escapes(String str) {
+        StringBuffer retval = new StringBuffer();
+        char ch;
+        for (int i = 0; i < str.length(); i++) {
+            switch (str.charAt(i)) {
+                case 0:
+                    continue;
+                case '\b':
+                    retval.append("\\b");
+                    continue;
+                case '\t':
+                    retval.append("\\t");
+                    continue;
+                case '\n':
+                    retval.append("\\n");
+                    continue;
+                case '\f':
+                    retval.append("\\f");
+                    continue;
+                case '\r':
+                    retval.append("\\r");
+                    continue;
+                case '\"':
+                    retval.append("\\\"");
+                    continue;
+                case '\'':
+                    retval.append("\\\'");
+                    continue;
+                case '\\':
+                    retval.append("\\\\");
+                    continue;
+                default:
+                    if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+                        String s = "0000" + Integer.toString(ch, 16);
+                        retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
+                    } else {
+                        retval.append(ch);
+                    }
+                    continue;
+            }
         }
-      }
-      return retval.toString();
-   }
+        return retval.toString();
+    }
 
 }



---------------------------------------------------------------------
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