curcuru 2003/02/19 06:24:03
Modified: java/xpath_rwapi/src/org/apache/xpath/rwapi/expression Tag:
xslt20 OperatorExpr.java ForAndQuantifiedExpr.java
Expr.java
java/xpath_rwapi/src/org/apache/xpath/rwapi/test Tag: xslt20
xpathsamples.xml
java/xpath_rwapi/src/org/apache/xpath/rwapi/impl Tag: xslt20
KindTestImpl.java NameTestImpl.java
LiteralImpl.java StepExprImpl.java
ForAndQuantifiedExprImpl.java VariableImpl.java
java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser Tag:
xslt20 XPathTreeConstants.java XPathVisitor.java
SimpleNode.java
java/xpath_rwapi/grammar Tag: xslt20 xpath-grammar.xml
java/xpath_rwapi Tag: xslt20 build.xml
Added: java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser Tag:
xslt20 xpath-grammar.jj
Log:
An early implementation for 'for' and quantified expressions (not complete
yet)
Also fix one exception with casting to Axes
Submitted by: [EMAIL PROTECTED]
Revision Changes Path
No revision
No revision
1.1.2.4 +284 -287
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/expression/Attic/OperatorExpr.java
Index: OperatorExpr.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/expression/Attic/OperatorExpr.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- OperatorExpr.java 5 Feb 2003 16:09:46 -0000 1.1.2.3
+++ OperatorExpr.java 19 Feb 2003 14:24:01 -0000 1.1.2.4
@@ -1,287 +1,284 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, Lotus
- * Development Corporation., http://www.lotus.com. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.xpath.rwapi.expression;
-
-import org.apache.xpath.rwapi.XPathException;
-
-/**
- * Represents any expressions with one, two or more operands. This includes
the following XPath features:
- * <ul>
- * <li>combining sequences</li>
- * <li>unary and binary arithmetics expressions</li>
- * <li>comparison expressions</li>
- * <li>logical expressions</li>
- * <li>range expressions</li>
- * <li>path expressions (see <code>PathExpr</code>)</li>
- * <li>Parenthesized expression</li>
- * </ul>
- * <pre>
- * [14] UnionExpr ::= IntersectExceptExpr ( ("union" | "|")
IntersectExceptExpr )*
- * [15] IntersectExceptExpr ::= UnaryExpr ( ("intersect" | "except")
UnaryExpr )*
- * [12] AdditiveExpr ::= MultiplicativeExpr ( ("+" | "-")
MultiplicativeExpr )*
- * [13] MultiplicativeExpr ::= UnionExpr ( ("*" | "div" | "idiv" |
"mod") UnionExpr )*
- * [10] ComparisonExpr ::= RangeExpr ( (ValueComp| GeneralComp|
NodeComp| OrderComp) RangeExpr )?
- * [25] ValueComp ::= "eq" | "ne" | "lt" | "le" | "gt" | "ge"
- * [24] GeneralComp ::= "=" | "!=" | "<" | "<=" | ">" | ">="
- * [26] NodeComp ::= "is" | "isnot"
- * [27] OrderComp ::= "<<" | ">>"
- * [4] OrExpr ::= AndExpr ( "or" AndExpr )*
- * [5] AndExpr ::= ForExpr ( "and" ForExpr )*
- * [11] RangeExpr ::= AdditiveExpr ( "to" AdditiveExpr )*
- * [18] PathExpr ::= ("/" RelativePathExpr?) | ("//"
RelativePathExpr) | RelativePathExpr
- * [19] RelativePathExpr ::= StepExpr (("/" | "//") StepExpr)*
- * [46] ParenthesizedExpr ::= "(" ExprSequence? ")"
- * [25] ExprSequence ::= Expr ("," Expr)*
- * </pre>
- * @see <a href="http://www.w3.org/TR/xpath20">XPath 2.0 Specification</href>
- */
-public interface OperatorExpr extends Expr {
-
- /**
- *
- */
- short UNION_COMBINE = 0;
-
- /**
- *
- */
- short INTERSECT_COMBINE = 1;
-
- /**
- *
- */
- short EXCEPT_COMBINE = 2;
-
- /**
- *
- */
- short PLUS_ADDITIVE = 3;
-
- /**
- *
- */
- short MINUS_ADDITIVE = 4;
-
- /**
- *
- */
- short RANGE = 5;
-
- /**
- *
- */
- short EQUAL_VALUE_COMPARISON = 6;
-
- /**
- *
- */
- short NOTEQUAL_VALUE_COMPARISON = 7;
-
- /**
- *
- */
- short LESSTHAN_VALUE_COMPARISON = 8;
-
- /**
- *
- */
- short LESSOREQUALTHAN_VALUE_COMPARISON = 9;
-
- /**
- *
- */
- short GREATTHAN_VALUE_COMPARISON = 10;
-
- /**
- *
- */
- short GREATOREQUALTHAN_VALUE_COMPARISON = 11;
-
- /**
- *
- */
- short EQUAL_GENERAL_COMPARISON = 12;
-
- /**
- *
- */
- short NOTEQUAL_GENERAL_COMPARISON = 13;
-
- /**
- *
- */
- short LESSTHAN_GENERAL_COMPARISON = 14;
-
- /**
- *
- */
- short LESSOREQUALTHAN_GENERAL_COMPARISON = 15;
-
- /**
- *
- */
- short GREATTHAN_GENERAL_COMPARISON = 16;
-
- /**
- *
- */
- short GREATOREQUALTHAN_GENERAL_COMPARISON = 17;
-
- /**
- *
- */
- short IS_NODE_COMPARISON = 18;
-
- /**
- *
- */
- short ISNOT_NODE_COMPARISON = 19;
-
- /**
- *
- */
- short EARLIERTHAN_ORDER_COMPARISON = 20;
-
- /**
- *
- */
- short LATERTHAN_ORDER_COMPARISON = 21;
-
- /**
- *
- */
- short AND_LOGICAL = 22;
-
- /**
- *
- */
- short OR_LOGICAL = 23;
-
- /**
- *
- */
- short PLUS_UNARY = 24;
-
- /**
- *
- */
- short MINUS_UNARY = 25;
-
- /**
- *
- */
- short SLASH_STEP = 26;
-
- /**
- *
- */
- short SLASHSLASH_STEP = 27;
-
- /**
- *
- */
- short COMMA = 28;
-
-
- /**
- *
- */
- short MULT_PRODUCT = 29;
-
-
- /**
- *
- */
- short MULT_DIV = 30;
-
- /**
- *
- */
- short MULT_IDIV = 31;
-
- /**
- *
- */
- short MULT_MOD = 32;
-
-
- /**
- * Gets binary expression type.
- * @return
- */
- short getOperatorType();
-
- /**
- * Gets the operand at the ith position.
- */
- Expr getOperand(int i);
-
- /**
- * Gets the operand count
- */
- int getOperandCount();
-
- /**
- *
- */
- void addOperand(Expr operand) throws XPathException;
-
- /**
- *
- */
- void removeOperand(Expr operand) throws XPathException;
-
-}
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.xpath.rwapi.expression;
+
+import org.apache.xpath.rwapi.XPathException;
+
+
+/**
+ * Represents any expressions with one, two or more operands. This includes
the following XPath features:
+ * <ul>
+ * <li>combining sequences</li>
+ * <li>unary and binary arithmetics expressions</li>
+ * <li>comparison expressions</li>
+ * <li>logical expressions</li>
+ * <li>range expressions</li>
+ * <li>path expressions (see <code>PathExpr</code>)</li>
+ * <li>Parenthesized expression</li>
+ * </ul>
+ * <pre>
+ * [14] UnionExpr ::= IntersectExceptExpr ( ("union" | "|")
IntersectExceptExpr )*
+ * [15] IntersectExceptExpr ::= UnaryExpr ( ("intersect" | "except")
UnaryExpr )*
+ * [12] AdditiveExpr ::= MultiplicativeExpr ( ("+" | "-")
MultiplicativeExpr )*
+ * [13] MultiplicativeExpr ::= UnionExpr ( ("*" | "div" | "idiv" |
"mod") UnionExpr )*
+ * [10] ComparisonExpr ::= RangeExpr ( (ValueComp| GeneralComp|
NodeComp| OrderComp) RangeExpr )?
+ * [25] ValueComp ::= "eq" | "ne" | "lt" | "le" | "gt" | "ge"
+ * [24] GeneralComp ::= "=" | "!=" | "<" | "<=" | ">" | ">="
+ * [26] NodeComp ::= "is" | "isnot"
+ * [27] OrderComp ::= "<<" | ">>"
+ * [4] OrExpr ::= AndExpr ( "or" AndExpr )*
+ * [5] AndExpr ::= ForExpr ( "and" ForExpr )*
+ * [11] RangeExpr ::= AdditiveExpr ( "to" AdditiveExpr )*
+ * [18] PathExpr ::= ("/" RelativePathExpr?) | ("//"
RelativePathExpr) | RelativePathExpr
+ * [19] RelativePathExpr ::= StepExpr (("/" | "//") StepExpr)*
+ * [46] ParenthesizedExpr ::= "(" ExprSequence? ")"
+ * [25] ExprSequence ::= Expr ("," Expr)*
+ * </pre>
+ * @see <a href="http://www.w3.org/TR/xpath20">XPath 2.0 Specification</href>
+ */
+public interface OperatorExpr extends Expr
+{
+ /**
+ *
+ */
+ short UNION_COMBINE = 0;
+
+ /**
+ *
+ */
+ short INTERSECT_COMBINE = 1;
+
+ /**
+ *
+ */
+ short EXCEPT_COMBINE = 2;
+
+ /**
+ *
+ */
+ short PLUS_ADDITIVE = 3;
+
+ /**
+ *
+ */
+ short MINUS_ADDITIVE = 4;
+
+ /**
+ *
+ */
+ short RANGE = 5;
+
+ /**
+ *
+ */
+ short EQUAL_VALUE_COMPARISON = 6;
+
+ /**
+ *
+ */
+ short NOTEQUAL_VALUE_COMPARISON = 7;
+
+ /**
+ *
+ */
+ short LESSTHAN_VALUE_COMPARISON = 8;
+
+ /**
+ *
+ */
+ short LESSOREQUALTHAN_VALUE_COMPARISON = 9;
+
+ /**
+ *
+ */
+ short GREATTHAN_VALUE_COMPARISON = 10;
+
+ /**
+ *
+ */
+ short GREATOREQUALTHAN_VALUE_COMPARISON = 11;
+
+ /**
+ *
+ */
+ short EQUAL_GENERAL_COMPARISON = 12;
+
+ /**
+ *
+ */
+ short NOTEQUAL_GENERAL_COMPARISON = 13;
+
+ /**
+ *
+ */
+ short LESSTHAN_GENERAL_COMPARISON = 14;
+
+ /**
+ *
+ */
+ short LESSOREQUALTHAN_GENERAL_COMPARISON = 15;
+
+ /**
+ *
+ */
+ short GREATTHAN_GENERAL_COMPARISON = 16;
+
+ /**
+ *
+ */
+ short GREATOREQUALTHAN_GENERAL_COMPARISON = 17;
+
+ /**
+ *
+ */
+ short IS_NODE_COMPARISON = 18;
+
+ /**
+ *
+ */
+ short ISNOT_NODE_COMPARISON = 19;
+
+ /**
+ *
+ */
+ short EARLIERTHAN_ORDER_COMPARISON = 20;
+
+ /**
+ *
+ */
+ short LATERTHAN_ORDER_COMPARISON = 21;
+
+ /**
+ *
+ */
+ short AND_LOGICAL = 22;
+
+ /**
+ *
+ */
+ short OR_LOGICAL = 23;
+
+ /**
+ *
+ */
+ short PLUS_UNARY = 24;
+
+ /**
+ *
+ */
+ short MINUS_UNARY = 25;
+
+ /**
+ *
+ */
+ short SLASH_STEP = 26;
+
+ /**
+ *
+ */
+ short SLASHSLASH_STEP = 27;
+
+ /**
+ *
+ */
+ short COMMA = 28;
+
+ /**
+ *
+ */
+ short MULT_PRODUCT = 29;
+
+ /**
+ *
+ */
+ short MULT_DIV = 30;
+
+ /**
+ *
+ */
+ short MULT_IDIV = 31;
+
+ /**
+ *
+ */
+ short MULT_MOD = 32;
+
+ /**
+ * Gets the operator type
+ * @return
+ */
+ short getOperatorType();
+
+ /**
+ * Gets the operand at the ith position.
+ */
+ Expr getOperand(int i);
+
+ /**
+ * Gets the operand count
+ */
+ int getOperandCount();
+
+ /**
+ * Append an operand
+ */
+ void addOperand(Expr operand) throws XPathException;
+
+ /**
+ * Remove an operand
+ */
+ void removeOperand(Expr operand) throws XPathException;
+}
1.1.2.4 +103 -108
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/expression/Attic/ForAndQuantifiedExpr.java
Index: ForAndQuantifiedExpr.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/expression/Attic/ForAndQuantifiedExpr.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- ForAndQuantifiedExpr.java 5 Feb 2003 16:09:46 -0000 1.1.2.3
+++ ForAndQuantifiedExpr.java 19 Feb 2003 14:24:01 -0000 1.1.2.4
@@ -1,108 +1,103 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, Lotus
- * Development Corporation., http://www.lotus.com. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.xpath.rwapi.expression;
-
-import org.apache.xpath.rwapi.XPathException;
-
-/**
- * Represents for and quantified expressions.
- * <pre>
- * [6] ForExpr ::= (ForClause "return")* QuantifiedExpr
- * [21] ForClause ::= <"for" "$"> VarName "in" Expr ("," "$" VarName
"in" Expr)*
- * [7] QuantifiedExpr ::= ((<"some" "$"> | <"every" "$">) VarName
"in" Expr ("," "$" VarName "in" Expr)* "satisfies")* IfExpr
- * </pre>
- * @see <a
href="http://www.w3.org/TR/xpath20/#id-quantified-expressions">XPath 2.0
Specification</a>
- * @see <a href="http://www.w3.org/TR/xpath20/#id-flwr-expressions">XPath
2.0 Specification</a>
- */
-public interface ForAndQuantifiedExpr extends Expr {
-
- /**
- *
- * @return String
- */
- String getClauseVarName( int i );
-
- /**
- *
- */
- Expr getClauseExpr( int i );
-
- /**
- *
- */
- int getClauseCount();
-
- /**
- * @throws XPathException when expression type isn't a 'for' one.
- */
- Expr getReturnExpr() throws XPathException;
-
- /**
- * @throws XPathException when expression type isn't a quantified one.
- */
- Expr getSatisfyExpr() throws XPathException;
-
- /**
- *
- */
- void addClause( String varName, Expr expr );
-
- /**
- *
- */
- void removeClause( String varName );
-
-}
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.xpath.rwapi.expression;
+
+import org.apache.xpath.rwapi.XPathException;
+
+/**
+ * Represents for and quantified expressions.
+ * <pre>
+ * [6] ForExpr ::= (ForClause "return")* QuantifiedExpr
+ * [21] ForClause ::= <"for" "$"> VarName "in" Expr ("," "$" VarName
"in" Expr)*
+ * [7] QuantifiedExpr ::= ((<"some" "$"> | <"every" "$">) VarName
"in" Expr ("," "$" VarName "in" Expr)* "satisfies")* IfExpr
+ * </pre>
+ * @see <a
href="http://www.w3.org/TR/xpath20/#id-quantified-expressions">XPath 2.0
Specification</a>
+ * @see <a href="http://www.w3.org/TR/xpath20/#id-flwr-expressions">XPath
2.0 Specification</a>
+ */
+public interface ForAndQuantifiedExpr extends Expr {
+
+ /**
+ *
+ * @return String
+ */
+ Variable getClauseVarName( int i );
+
+ /**
+ *
+ */
+ Expr getClauseExpr( int i );
+
+ /**
+ *
+ */
+ int getClauseCount();
+
+ /**
+ *
+ */
+ Expr getResultingExpr();
+
+ /**
+ *
+ */
+ void addClause( String varName, Expr expr );
+
+ /**
+ *
+ */
+ void removeClause( String varName );
+
+}
1.1.2.5 +215 -211
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/expression/Attic/Expr.java
Index: Expr.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/expression/Attic/Expr.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- Expr.java 5 Feb 2003 16:09:46 -0000 1.1.2.4
+++ Expr.java 19 Feb 2003 14:24:01 -0000 1.1.2.5
@@ -1,211 +1,215 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, Lotus
- * Development Corporation., http://www.lotus.com. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.xpath.rwapi.expression;
-
-
-/**
- * This interface represents an XPath Expression.
- * <pre>
- * [1] XPath ::= ExprSequence?
- * [3] Expr ::= OrExpr
- * [7] QuantifiedExpr ::= ((<"some" "$"> | <"every" "$">) VarName
"in" Expr ("," "$" VarName "in" Expr)* "satisfies")* IfExpr
- * [10] ComparisonExpr ::= RangeExpr ( (ValueComp | GeneralComp |
NodeComp | OrderComp) RangeExpr )?
- * [18] PathExpr ::= ("/" RelativePathExpr?) | ("//" RelativePathExpr)
| RelativePathExpr
- * </pre>
- * @see <a
href="http://www.w3.org/TR/2002/WD-xpath20-20020816/#id-expressions">XPath 2.0
Specification</a>
- */
-public interface Expr extends Visitable {
-
- /**
- * Path expression type
- */
- short PATH_EXPR = 0;
-
- /**
- * Logical expression type.
- * Modelise 'or' and 'and' expressions
- */
- short LOGICAL_EXPR = 1;
-
- /**
- * Conditionnal expression type.
- * Modelise 'if' expressions
- */
- short CONDITIONAL_EXPR = 2;
-
- /**
- * Iteration expression type.
- * Modelise 'for' expressions
- */
- short ITERATION_EXPR = 3;
-
- /**
- * Quantified expression type.
- * Modelise 'every' and 'some' expressions
- */
- short QUANTIFIED_EXPR = 4;
-
- /**
- * Comparison expression type. Modelise value comparisons, general
- * comparisons, node comparisons, and order comparisons.
- */
- short COMPARISON_EXPR = 5;
-
- /**
- * Arithmetic expression type.
- * Modelise arithmetic operators for addition, subtraction,
multiplication, division, and modulus
- */
- short ARITHMETIC_EXPR = 6;
-
- /**
- * Sequence of expressions type.
- */
- short SEQUENCE_EXPR = 7;
-
- /**
- * Union and Intersection
- */
- short COMBINE_EXPR = 8;
-
- /**
- *
- */
- short PRIMARY_EXPR = 9;
-
- /**
- *
- */
- short VALIDATE_EXPR = 10;
-
- /**
- *
- */
- short NAMETEST_EXPR = 11;
-
- /**
- *
- */
- short KINDTEST_EXPR = 12;
-
-
- /**
- * Literal primary expression type constant
- */
- short LITERAL_EXPR = 13;
-
- /**
- * Function call primary expression type constant
- */
- short FUNCTION_CALL_EXPR = 14;
-
- /**
- * Variable reference primary expression type constant
- */
- short VARIABLE_REF_EXPR = 15;
-
- /**
- * Range expression type constant
- */
- short RANGE_EXPR = 16;
-
- /**
- * Step
- */
- short STEP = 17;
-
- /**
- * Instance of
- */
- short INSTANCE_OF_EXPR = 18;
-
- /**
- * Unary expression
- */
- short UNARY_EXPR = 19;
-
- /**
- * Cast expression
- */
- short CAST_EXPR = 20;
-
- /**
- * Castable expression
- */
- short CASTABLE_EXPR = 21;
-
- /**
- * Gets the expression or expression component type
- * @return The type of this expression: one of the constants define in
this
- * interface
- */
- short getExprType();
-
- /**
- * Clone the expression
- * @return A clone of this expression
- */
- Expr cloneExpression();
-
- /**
- * Gets the expression as a string (external form)
- * @param abbreviate Gets the string as an abbreviate form or not
- * @return The external form of this expression
- */
- String getString(boolean abbreviate);
-
-}
-
-
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.xpath.rwapi.expression;
+
+
+/**
+ * This interface represents an XPath Expression.
+ * <pre>
+ * [1] XPath ::= ExprSequence?
+ * [3] Expr ::= OrExpr
+ * [7] QuantifiedExpr ::= ((<"some" "$"> | <"every" "$">) VarName
"in" Expr ("," "$" VarName "in" Expr)* "satisfies")* IfExpr
+ * [10] ComparisonExpr ::= RangeExpr ( (ValueComp | GeneralComp |
NodeComp | OrderComp) RangeExpr )?
+ * [18] PathExpr ::= ("/" RelativePathExpr?) | ("//" RelativePathExpr)
| RelativePathExpr
+ * </pre>
+ * @see <a
href="http://www.w3.org/TR/2002/WD-xpath20-20020816/#id-expressions">XPath 2.0
Specification</a>
+ */
+public interface Expr extends Visitable {
+
+ /**
+ * Path expression type.
+ */
+ short PATH_EXPR = 0;
+
+ /**
+ * Logical expression type.
+ * Represents 'or' and 'and' expressions
+ */
+ short LOGICAL_EXPR = 1;
+
+ /**
+ * Conditionnal expression type.
+ * Represents 'if' expressions
+ */
+ short CONDITIONAL_EXPR = 2;
+
+ /**
+ * Iteration expression type.
+ * Represents 'for' expressions
+ */
+ short ITERATION_EXPR = 3;
+
+ /**
+ * 'Every' expression type.
+ */
+ short EVERY_EXPR = 4;
+
+ /**
+ * 'Some' expression type.
+ */
+ short SOME_EXPR = 22;
+
+ /**
+ * Comparison expression type. Represents value comparisons, general
+ * comparisons, node comparisons, and order comparisons.
+ */
+ short COMPARISON_EXPR = 5;
+
+ /**
+ * Arithmetic expression type.
+ * Represents arithmetic operators for addition, subtraction,
multiplication, division, and modulus
+ */
+ short ARITHMETIC_EXPR = 6;
+
+ /**
+ * Sequence of expressions type.
+ */
+ short SEQUENCE_EXPR = 7;
+
+ /**
+ * Union and Intersection
+ */
+ short COMBINE_EXPR = 8;
+
+ /**
+ *
+ */
+ short PRIMARY_EXPR = 9;
+
+ /**
+ *
+ */
+ short VALIDATE_EXPR = 10;
+
+ /**
+ *
+ */
+ short NAMETEST_EXPR = 11;
+
+ /**
+ *
+ */
+ short KINDTEST_EXPR = 12;
+
+
+ /**
+ * Literal primary expression type constant
+ */
+ short LITERAL_EXPR = 13;
+
+ /**
+ * Function call primary expression type constant
+ */
+ short FUNCTION_CALL_EXPR = 14;
+
+ /**
+ * Variable reference primary expression type constant
+ */
+ short VARIABLE_REF_EXPR = 15;
+
+ /**
+ * Range expression type constant
+ */
+ short RANGE_EXPR = 16;
+
+ /**
+ * Step
+ */
+ short STEP = 17;
+
+ /**
+ * Instance of
+ */
+ short INSTANCE_OF_EXPR = 18;
+
+ /**
+ * Unary expression
+ */
+ short UNARY_EXPR = 19;
+
+ /**
+ * Cast expression
+ */
+ short CAST_EXPR = 20;
+
+ /**
+ * Castable expression
+ */
+ short CASTABLE_EXPR = 21;
+
+ /**
+ * Gets the expression or expression component type
+ * @return The type of this expression: one of the constants define in
this
+ * interface
+ */
+ short getExprType();
+
+ /**
+ * Clone the expression
+ * @return A clone of this expression
+ */
+ Expr cloneExpression();
+
+ /**
+ * Gets the expression as a string (external form)
+ * @param abbreviate Gets the string as an abbreviate form or not
+ * @return The external form of this expression
+ */
+ String getString(boolean abbreviate);
+
+}
+
+
No revision
No revision
1.1.2.5 +88 -1
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/test/Attic/xpathsamples.xml
Index: xpathsamples.xml
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/test/Attic/xpathsamples.xml,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- xpathsamples.xml 12 Feb 2003 16:14:59 -0000 1.1.2.4
+++ xpathsamples.xml 19 Feb 2003 14:24:01 -0000 1.1.2.5
@@ -289,7 +289,7 @@
</expr>
- <!-- reverse axis -->
+ <!-- axis -->
<expr value="ancestor::toto">
<ast>
<node name="ExprSequence">
@@ -301,6 +301,18 @@
</node>
</ast>
</expr>
+
+ <expr value="attribute::*">
+ <ast>
+ <node name="ExprSequence">
+ <node name="PathExpr">
+ <node name="StepExpr">
+ <node name="NameTest"/>
+ </node>
+ </node>
+ </node>
+ </ast>
+ </expr>
<!-- path expr -->
<expr value="/">
@@ -784,8 +796,83 @@
</ast>
</expr>
+
+ <!-- For expr -->
+
+ <expr value="for $a in a return b">
+ <ast>
+ <node name="ExprSequence">
+ <node name="FLWRExpr">
+ <node name="Variable"/>
+ <node name="PathExpr">
+ <node name="StepExpr">
+ <node name="NameTest"/>
+ </node>
+ </node>
+ <node name="PathExpr">
+ <node name="StepExpr">
+ <node name="NameTest"/>
+ </node>
+ </node>
+ </node>
+ </node>
+ </ast>
+ </expr>
+
+ <expr value="for $a in a, $b in b return ($a,$b)">
+ <ast>
+ <node name="ExprSequence">
+ <node name="FLWRExpr">
+ <node name="Variable"/>
+ <node name="PathExpr">
+ <node name="StepExpr">
+ <node name="NameTest"/>
+ </node>
+ </node>
+ <node name="Variable"/>
+ <node name="PathExpr">
+ <node name="StepExpr">
+ <node name="NameTest"/>
+ </node>
+ </node>
+ <node name="ExprSequence">
+ <node name="PathExpr">
+ <node name="VarName"/>
+ </node>
+ <node name="PathExpr">
+ <node name="VarName"/>
+ </node>
+ </node>
+ </node>
+ </node>
+ </ast>
+ </expr>
+
+ <!-- Quantified expr -->
+
+ <expr value="some $a in a satisfies b">
+ <ast>
+ <node name="ExprSequence">
+ <node name="QuantifiedExpr">
+ <node name="Variable"/>
+ <node name="PathExpr">
+ <node name="StepExpr">
+ <node name="NameTest"/>
+ </node>
+ </node>
+ <node name="PathExpr">
+ <node name="StepExpr">
+ <node name="NameTest"/>
+ </node>
+ </node>
+ </node>
+ </node>
+ </ast>
+ </expr>
<!-- Semantically invalid expression (parser should return an error) -->
+ <expr value="9876543210" valid="false"/>
+
<expr value="toto/(45+23)" valid="false"/>
<expr value="a/(b,c)/d" valid="false"/>
No revision
No revision
1.1.2.6 +1 -1
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/KindTestImpl.java
Index: KindTestImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/KindTestImpl.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- KindTestImpl.java 13 Feb 2003 16:48:58 -0000 1.1.2.5
+++ KindTestImpl.java 19 Feb 2003 14:24:01 -0000 1.1.2.6
@@ -237,6 +237,6 @@
{
return XPathTreeConstants.jjtNodeName[id] + " "
+ getClass() + " "
- + getString(false);
+ + getString(true);
}
}
1.1.2.4 +194 -184
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/NameTestImpl.java
Index: NameTestImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/NameTestImpl.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- NameTestImpl.java 5 Feb 2003 16:09:47 -0000 1.1.2.3
+++ NameTestImpl.java 19 Feb 2003 14:24:01 -0000 1.1.2.4
@@ -1,184 +1,194 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, Lotus
- * Development Corporation., http://www.lotus.com. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.xpath.rwapi.impl;
-
-import org.apache.xpath.rwapi.XPathException;
-import org.apache.xpath.rwapi.expression.Expr;
-import org.apache.xpath.rwapi.expression.NodeTest;
-import org.apache.xpath.rwapi.impl.parser.Node;
-import org.apache.xpath.rwapi.impl.parser.QName;
-import org.apache.xpath.rwapi.impl.parser.Token;
-import org.apache.xpath.rwapi.impl.parser.XPathTreeConstants;
-
-/**
- *
- */
-public class NameTestImpl extends ExprImpl implements NodeTest {
-
- String m_localPart;
- String m_prefix;
-
-
- /**
- * Constructor for NameTestImpl.
- * @param i
- */
- public NameTestImpl(int i) {
- super(i);
- }
-
- /**
- * Constructor for NodeTestImpl.
- * @param p
- * @param i
- */
- public NameTestImpl(String localPart, String prefix) {
- super(XPathTreeConstants.JJTNAMETEST);
- m_localPart = localPart;
- m_prefix = prefix;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.NodeTest#isNameTest()
- */
- public boolean isNameTest() {
- return true;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.NodeTest#isKindTest()
- */
- public boolean isKindTest() {
- return false;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.NodeTest#getKindTest()
- */
- public short getKindTest() throws XPathException {
- throw new XPathException("Invalid call of this method on NameTest
node"); //I8
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.NodeTest#getLocalNameTest()
- */
- public String getLocalNameTest() throws XPathException {
- return m_localPart;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.NodeTest#getPrefix()
- */
- public String getPrefix() throws XPathException {
- return m_prefix;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#getExprType()
- */
- public short getExprType() {
- return Expr.NAMETEST_EXPR;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#cloneExpression()
- */
- public Expr cloneExpression() {
- return new NameTestImpl(m_localPart, m_prefix);
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#getString(boolean)
- */
- public String getString(boolean abbreviate) {
- return (m_prefix != null) ? m_prefix + ":" + m_localPart :
m_localPart;
- }
-
- /**
- * @see
org.apache.xpath.rwapi.impl.parser.SimpleNode#processToken(Token)
- */
- public void processToken(Token token) {
-
- }
-
- /**
- * @see org.apache.xpath.rwapi.impl.parser.SimpleNode#canBeFiltered()
- */
- protected boolean canBeFiltered() {
- return false;
- }
-
- /**
- * @see org.apache.xpath.rwapi.impl.parser.Node#jjtAddChild(Node, int)
- */
- public void jjtAddChild(Node n, int i) {
- // don't add n in the tree
- m_localPart = ((QName) n).getLocalPart();
- m_prefix = ((QName) n).getPrefix();
- }
-
- /**
- * @see org.apache.xpath.rwapi.impl.ExprImpl#getString(StringBuffer,
boolean)
- */
- protected void getString(StringBuffer expr, boolean abbreviate) {
- if ( m_prefix != null ) {
- expr.append(m_prefix).append(":").append(m_localPart);
- } else {
- expr.append(m_localPart);
- }
- }
-
-}
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.xpath.rwapi.impl;
+
+import org.apache.xpath.rwapi.XPathException;
+import org.apache.xpath.rwapi.expression.Expr;
+import org.apache.xpath.rwapi.expression.NodeTest;
+import org.apache.xpath.rwapi.impl.parser.Node;
+import org.apache.xpath.rwapi.impl.parser.QName;
+import org.apache.xpath.rwapi.impl.parser.Token;
+import org.apache.xpath.rwapi.impl.parser.XPathTreeConstants;
+
+/**
+ *
+ */
+public class NameTestImpl extends ExprImpl implements NodeTest {
+
+ String m_localPart;
+ String m_prefix;
+
+
+ /**
+ * Constructor for NameTestImpl.
+ * @param i
+ */
+ public NameTestImpl(int i) {
+ super(i);
+ }
+
+ /**
+ * Constructor for NodeTestImpl.
+ * @param p
+ * @param i
+ */
+ public NameTestImpl(String localPart, String prefix) {
+ super(XPathTreeConstants.JJTNAMETEST);
+ m_localPart = localPart;
+ m_prefix = prefix;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.NodeTest#isNameTest()
+ */
+ public boolean isNameTest() {
+ return true;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.NodeTest#isKindTest()
+ */
+ public boolean isKindTest() {
+ return false;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.NodeTest#getKindTest()
+ */
+ public short getKindTest() throws XPathException {
+ throw new XPathException("Invalid call of this method on NameTest
node"); //I8
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.NodeTest#getLocalNameTest()
+ */
+ public String getLocalNameTest() throws XPathException {
+ return m_localPart;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.NodeTest#getPrefix()
+ */
+ public String getPrefix() throws XPathException {
+ return m_prefix;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#getExprType()
+ */
+ public short getExprType() {
+ return Expr.NAMETEST_EXPR;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#cloneExpression()
+ */
+ public Expr cloneExpression() {
+ return new NameTestImpl(m_localPart, m_prefix);
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#getString(boolean)
+ */
+ public String getString(boolean abbreviate) {
+ return (m_prefix != null) ? m_prefix + ":" + m_localPart :
m_localPart;
+ }
+
+ /**
+ * @see
org.apache.xpath.rwapi.impl.parser.SimpleNode#processToken(Token)
+ */
+ public void processToken(Token token) {
+
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.impl.parser.SimpleNode#canBeFiltered()
+ */
+ protected boolean canBeFiltered() {
+ return false;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.impl.parser.Node#jjtAddChild(Node, int)
+ */
+ public void jjtAddChild(Node n, int i) {
+ // don't add n in the tree
+ m_localPart = ((QName) n).getLocalPart();
+ m_prefix = ((QName) n).getPrefix();
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.impl.ExprImpl#getString(StringBuffer,
boolean)
+ */
+ protected void getString(StringBuffer expr, boolean abbreviate) {
+ if ( m_prefix != null ) {
+ expr.append(m_prefix).append(":").append(m_localPart);
+ } else {
+ expr.append(m_localPart);
+ }
+ }
+
+ /**
+ * Override to print out useful instance data.
+ * @see org.apache.xpath.rwapi.impl.parser.SimpleNode#toString()
+ */
+ public String toString()
+ {
+ return XPathTreeConstants.jjtNodeName[id] + " "
+ + getClass() + " "
+ + getString(false);
+ }
+}
1.1.2.5 +309 -298
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/LiteralImpl.java
Index: LiteralImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/LiteralImpl.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- LiteralImpl.java 5 Feb 2003 16:09:47 -0000 1.1.2.4
+++ LiteralImpl.java 19 Feb 2003 14:24:01 -0000 1.1.2.5
@@ -1,298 +1,309 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, Lotus
- * Development Corporation., http://www.lotus.com. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.xpath.rwapi.impl;
-
-import org.apache.xpath.rwapi.XPathException;
-import org.apache.xpath.rwapi.expression.Expr;
-import org.apache.xpath.rwapi.expression.Literal;
-import org.apache.xpath.rwapi.expression.Visitor;
-import org.apache.xpath.rwapi.impl.parser.Token;
-import org.apache.xpath.rwapi.impl.parser.XPath;
-import org.apache.xpath.rwapi.impl.parser.XPathTreeConstants;
-
-
-/**
- *
- */
-public class LiteralImpl extends ExprImpl implements Literal
-{
- Object m_literal;
-
- /**
- *
- *
- */
- protected LiteralImpl()
- {
- super();
- }
-
- /**
- * Constructor for PrimaryExprImpl.
- * @param i
- */
- public LiteralImpl(int i)
- {
- super(i);
- }
-
- /**
- * Constructor for PrimaryExprImpl.
- * @param p
- * @param i
- */
- public LiteralImpl(XPath p, int i)
- {
- super(p, i);
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#getExprType()
- */
- public short getExprType()
- {
- return Expr.LITERAL_EXPR;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#cloneExpression()
- */
- public Expr cloneExpression()
- {
- return null;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Literal#getDecimalLiteral()
- */
- public float getDecimalLiteral() throws XPathException
- {
- if (getLiteralType() == DECIMAL_LITERAL)
- {
- return ((Float) m_literal).floatValue();
- }
-
- throw new XPathException(
- "Invalid method call: the literal is not a decimal");
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Literal#getDoubleLiteral()
- */
- public double getDoubleLiteral() throws XPathException
- {
- if (getLiteralType() == DOUBLE_LITERAL)
- {
- return ((Double) m_literal).doubleValue();
- }
-
- throw new XPathException(
- "Invalid method call: the literal is not a double");
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Literal#getIntegerLiteral()
- */
- public int getIntegerLiteral() throws XPathException
- {
- if (getLiteralType() == INTEGER_LITERAL)
- {
- return ((Integer) m_literal).intValue();
- }
-
- throw new XPathException(
- "Invalid method call: the literal is not a integer");
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Literal#getLiteralType()
- */
- public short getLiteralType()
- {
- switch (id)
- {
- case XPathTreeConstants.JJTINTEGERLITERAL:
- return INTEGER_LITERAL;
-
- //break;
- case XPathTreeConstants.JJTDOUBLELITERAL:
- return DOUBLE_LITERAL;
-
- //break;
- case XPathTreeConstants.JJTSTRINGLITERAL:
- return STRING_LITERAL;
-
- //break;
- case XPathTreeConstants.JJTDECIMALLITERAL:
- return DECIMAL_LITERAL;
-
- //break;
- default:
-
- // bug
- throw new RuntimeException("Invalid JJTree id:" + id);
- }
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Literal#getStringLiteral()
- */
- public String getStringLiteral() throws XPathException
- {
- if (getLiteralType() == STRING_LITERAL)
- {
- return (String) m_literal;
- }
-
- throw new XPathException(
- "Invalid method call: the literal is not a string");
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#getString(boolean)
- */
- public String getString(boolean abbreviate)
- {
- return m_literal.toString();
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Visitable#visited(Visitor)
- */
- public void visited(Visitor visitor) {}
-
- /**
- * @see org.apache.xpath.rwapi.impl.parser.SimpleNode#processToken(Token)
- */
- public void processToken(Token token)
- {
- super.processToken(token);
-
- switch (id)
- {
- case XPathTreeConstants.JJTINTEGERLITERAL:
- m_literal = new Integer(token.image);
-
- break;
-
- case XPathTreeConstants.JJTDOUBLELITERAL:
- m_literal = new Double(token.image);
-
- //break;
- case XPathTreeConstants.JJTSTRINGLITERAL:
- m_literal = token.image;
-
- break;
-
- case XPathTreeConstants.JJTDECIMALLITERAL:
- m_literal = new Float(token.image);
-
- break;
-
- default:
-
- // bug
- throw new RuntimeException("Invalid JJTree id:" + id);
- }
- }
-
- /**
- * @see org.apache.xpath.rwapi.impl.ExprImpl#getString(StringBuffer,
boolean)
- */
- protected void getString(StringBuffer expr, boolean abbreviate)
- {
- expr.append(m_literal.toString());
- }
-
- /**
- * @param value
- */
- protected void setIntValue(int value)
- {
- m_literal = new Integer(value);
- id = XPathTreeConstants.JJTINTEGERLITERAL;
- }
-
- /**
- *
- * @param value
- */
- protected void setDecimalValue(float value)
- {
- m_literal = new Float(value);
- id = XPathTreeConstants.JJTDECIMALLITERAL;
- }
-
- /**
- *
- * @param value
- */
- protected void setStringValue(String value)
- {
- m_literal = value;
- id = XPathTreeConstants.JJTSTRINGLITERAL;
- }
-
- /**
- *
- * @param value
- */
- protected void setDoubleValue(double value)
- {
- m_literal = new Double(value);
- id = XPathTreeConstants.JJTDOUBLELITERAL;
- }
-}
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.xpath.rwapi.impl;
+
+import org.apache.xpath.rwapi.XPathException;
+import org.apache.xpath.rwapi.expression.Expr;
+import org.apache.xpath.rwapi.expression.Literal;
+import org.apache.xpath.rwapi.expression.Visitor;
+import org.apache.xpath.rwapi.impl.parser.Token;
+import org.apache.xpath.rwapi.impl.parser.XPath;
+import org.apache.xpath.rwapi.impl.parser.XPathTreeConstants;
+
+
+/**
+ *
+ */
+public class LiteralImpl extends ExprImpl implements Literal
+{
+ Object m_literal;
+
+ /**
+ *
+ *
+ */
+ protected LiteralImpl()
+ {
+ super();
+ }
+
+ /**
+ * Constructor for PrimaryExprImpl.
+ * @param i
+ */
+ public LiteralImpl(int i)
+ {
+ super(i);
+ }
+
+ /**
+ * Constructor for PrimaryExprImpl.
+ * @param p
+ * @param i
+ */
+ public LiteralImpl(XPath p, int i)
+ {
+ super(p, i);
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#getExprType()
+ */
+ public short getExprType()
+ {
+ return Expr.LITERAL_EXPR;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#cloneExpression()
+ */
+ public Expr cloneExpression()
+ {
+ return null;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Literal#getDecimalLiteral()
+ */
+ public float getDecimalLiteral() throws XPathException
+ {
+ if (getLiteralType() == DECIMAL_LITERAL)
+ {
+ return ((Float) m_literal).floatValue();
+ }
+
+ throw new XPathException(
+ "Invalid method call: the literal is not a decimal");
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Literal#getDoubleLiteral()
+ */
+ public double getDoubleLiteral() throws XPathException
+ {
+ if (getLiteralType() == DOUBLE_LITERAL)
+ {
+ return ((Double) m_literal).doubleValue();
+ }
+
+ throw new XPathException(
+ "Invalid method call: the literal is not a double");
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Literal#getIntegerLiteral()
+ */
+ public int getIntegerLiteral() throws XPathException
+ {
+ if (getLiteralType() == INTEGER_LITERAL)
+ {
+ return ((Integer) m_literal).intValue();
+ }
+
+ throw new XPathException(
+ "Invalid method call: the literal is not a integer");
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Literal#getLiteralType()
+ */
+ public short getLiteralType()
+ {
+ switch (id)
+ {
+ case XPathTreeConstants.JJTINTEGERLITERAL:
+ return INTEGER_LITERAL;
+
+ //break;
+ case XPathTreeConstants.JJTDOUBLELITERAL:
+ return DOUBLE_LITERAL;
+
+ //break;
+ case XPathTreeConstants.JJTSTRINGLITERAL:
+ return STRING_LITERAL;
+
+ //break;
+ case XPathTreeConstants.JJTDECIMALLITERAL:
+ return DECIMAL_LITERAL;
+
+ //break;
+ default:
+
+ // bug
+ throw new RuntimeException("Invalid JJTree id:" + id);
+ }
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Literal#getStringLiteral()
+ */
+ public String getStringLiteral() throws XPathException
+ {
+ if (getLiteralType() == STRING_LITERAL)
+ {
+ return (String) m_literal;
+ }
+
+ throw new XPathException(
+ "Invalid method call: the literal is not a string");
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#getString(boolean)
+ */
+ public String getString(boolean abbreviate)
+ {
+ return m_literal.toString();
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Visitable#visited(Visitor)
+ */
+ public void visited(Visitor visitor) {}
+
+ /**
+ * @see org.apache.xpath.rwapi.impl.parser.SimpleNode#processToken(Token)
+ */
+ public void processToken(Token token)
+ {
+ super.processToken(token);
+
+ switch (id)
+ {
+ case XPathTreeConstants.JJTINTEGERLITERAL:
+ m_literal = new Integer(token.image);
+
+ break;
+
+ case XPathTreeConstants.JJTDOUBLELITERAL:
+ m_literal = new Double(token.image);
+
+ break;
+ case XPathTreeConstants.JJTSTRINGLITERAL:
+ m_literal = token.image;
+
+ break;
+
+ case XPathTreeConstants.JJTDECIMALLITERAL:
+ m_literal = new Float(token.image);
+
+ break;
+
+ default:
+
+ // bug
+ throw new RuntimeException("Invalid JJTree id:" + id);
+ }
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.impl.ExprImpl#getString(StringBuffer,
boolean)
+ */
+ protected void getString(StringBuffer expr, boolean abbreviate)
+ {
+ expr.append(m_literal.toString());
+ }
+
+ /**
+ * @param value
+ */
+ protected void setIntValue(int value)
+ {
+ m_literal = new Integer(value);
+ id = XPathTreeConstants.JJTINTEGERLITERAL;
+ }
+
+ /**
+ *
+ * @param value
+ */
+ protected void setDecimalValue(float value)
+ {
+ m_literal = new Float(value);
+ id = XPathTreeConstants.JJTDECIMALLITERAL;
+ }
+
+ /**
+ *
+ * @param value
+ */
+ protected void setStringValue(String value)
+ {
+ m_literal = value;
+ id = XPathTreeConstants.JJTSTRINGLITERAL;
+ }
+
+ /**
+ *
+ * @param value
+ */
+ protected void setDoubleValue(double value)
+ {
+ m_literal = new Double(value);
+ id = XPathTreeConstants.JJTDOUBLELITERAL;
+ }
+
+ /**
+ * Override to print out useful instance data.
+ * @see org.apache.xpath.rwapi.impl.parser.SimpleNode#toString()
+ */
+ public String toString()
+ {
+ return XPathTreeConstants.jjtNodeName[id] + " "
+ + getClass() + " "
+ + getString(false);
+ }
+}
1.1.2.7 +2 -0
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/StepExprImpl.java
Index: StepExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/StepExprImpl.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- StepExprImpl.java 13 Feb 2003 16:48:58 -0000 1.1.2.6
+++ StepExprImpl.java 19 Feb 2003 14:24:01 -0000 1.1.2.7
@@ -296,6 +296,8 @@
case XPathTreeConstants.JJTAXISPRECEDINGSIBLING:
case XPathTreeConstants.JJTAXISPRECEDING:
case XPathTreeConstants.JJTAXISANCESTORORSELF:
+ case XPathTreeConstants.JJTAXISATTRIBUTE:
+
m_axisType = ((Axis) n).getAxis();
break;
1.1.2.4 +271 -182
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/ForAndQuantifiedExprImpl.java
Index: ForAndQuantifiedExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/ForAndQuantifiedExprImpl.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- ForAndQuantifiedExprImpl.java 5 Feb 2003 16:09:47 -0000 1.1.2.3
+++ ForAndQuantifiedExprImpl.java 19 Feb 2003 14:24:01 -0000 1.1.2.4
@@ -1,182 +1,271 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, Lotus
- * Development Corporation., http://www.lotus.com. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.xpath.rwapi.impl;
-
-import org.apache.xpath.rwapi.XPathException;
-import org.apache.xpath.rwapi.expression.Expr;
-import org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr;
-import org.apache.xpath.rwapi.expression.Visitor;
-import org.apache.xpath.rwapi.impl.parser.Node;
-import org.apache.xpath.rwapi.impl.parser.SimpleNode;
-import org.apache.xpath.rwapi.impl.parser.XPath;
-
-/**
- *
- */
-public class ForAndQuantifiedExprImpl extends SimpleNode implements
ForAndQuantifiedExpr {
-
- /**
- * Constructor for ForAndQuantifiedExprImpl.
- * @param i
- */
- public ForAndQuantifiedExprImpl(int i) {
- super(i);
- }
-
- /**
- * Constructor for ForAndQuantifiedExprImpl.
- * @param p
- * @param i
- */
- public ForAndQuantifiedExprImpl(XPath p, int i) {
- super(p, i);
- }
-
- /**
- * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#getClauseVarName(int)
- */
- public String getClauseVarName(int i) {
- return null;
- }
-
- /**
- * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#getClauseExpr(int)
- */
- public Expr getClauseExpr(int i) {
- return null;
- }
-
- /**
- * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#getClauseCount()
- */
- public int getClauseCount() {
- return 0;
- }
-
- /**
- * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#getReturnExpr()
- */
- public Expr getReturnExpr() throws XPathException {
- return null;
- }
-
- /**
- * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#getSatisfyExpr()
- */
- public Expr getSatisfyExpr() throws XPathException {
- return null;
- }
-
- /**
- * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#addClause(String, Expr)
- */
- public void addClause(String varName, Expr expr) {
- }
-
- /**
- * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#removeClause(String)
- */
- public void removeClause(String varName) {
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#getExprType()
- */
- public short getExprType() {
- return 0;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#cloneExpression()
- */
- public Expr cloneExpression() {
- return null;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#getString(boolean)
- */
- public String getString(boolean abbreviate) {
- return null;
- }
-
-
- /**
- * @see org.apache.xpath.rwapi.impl.parser.Node#jjtAddChild(Node, int)
- */
- public void jjtAddChild(Node n, int i) {
- if (((SimpleNode) n).canBeReduced()) {
- super.jjtAddChild(n.jjtGetChild(0), i);
- } else {
- super.jjtAddChild(n, i);
- }
- }
-
- /**
- * @see org.apache.xpath.rwapi.impl.parser.SimpleNode#canBeReduced()
- */
- public boolean canBeReduced() {
- return children.length == 1; // means that there is no???
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Visitable#visit(Visitor)
- */
- public void visit(Visitor visitor) {
- // TODO:
- }
-
-}
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.xpath.rwapi.impl;
+
+import org.apache.xpath.rwapi.expression.Expr;
+import org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr;
+import org.apache.xpath.rwapi.expression.Variable;
+import org.apache.xpath.rwapi.expression.Visitor;
+import org.apache.xpath.rwapi.impl.parser.Node;
+import org.apache.xpath.rwapi.impl.parser.SimpleNode;
+import org.apache.xpath.rwapi.impl.parser.XPath;
+import org.apache.xpath.rwapi.impl.parser.XPathTreeConstants;
+
+
+/**
+ * AST node for 'for' and quantified (some, every) expressions
+ */
+public class ForAndQuantifiedExprImpl extends ExprImpl
+ implements ForAndQuantifiedExpr
+{
+ /**
+ * The expression of for/quantified clauses
+ */
+ ExprImpl[] m_exprs;
+
+ /**
+ * The variable name of for/quantified clauses
+ */
+ VariableImpl[] m_varNames;
+
+ /**
+ * The return/satisfies expr
+ */
+ ExprImpl m_resExpr;
+
+ /**
+ * Constructor for ForAndQuantifiedExprImpl.
+ * @param i
+ */
+ public ForAndQuantifiedExprImpl(int i)
+ {
+ super(i);
+ }
+
+ /**
+ * Constructor for ForAndQuantifiedExprImpl.
+ * @param p
+ * @param i
+ */
+ public ForAndQuantifiedExprImpl(XPath p, int i)
+ {
+ super(p, i);
+ }
+
+ /**
+ * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#getClauseVarName(int)
+ */
+ public Variable getClauseVarName(int i) throws IndexOutOfBoundsException
+ {
+ return m_varNames[i];
+ }
+
+ /**
+ * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#getClauseExpr(int)
+ */
+ public Expr getClauseExpr(int i) throws IndexOutOfBoundsException
+ {
+ return m_exprs[i];
+ }
+
+ /**
+ * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#getClauseCount()
+ */
+ public int getClauseCount()
+ {
+ return (m_varNames == null) ? 0 : m_varNames.length;
+ }
+
+ /**
+ * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#getResultingExpr()
+ */
+ public Expr getResultingExpr()
+ {
+ return m_resExpr;
+ }
+
+ /**
+ * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#addClause(String, Expr)
+ */
+ public void addClause(String varName, Expr expr)
+ {
+ // TODO
+ }
+
+ /**
+ * @see
org.apache.xpath.rwapi.expression.ForAndQuantifiedExpr#removeClause(String)
+ */
+ public void removeClause(String varName)
+ {
+ // TODO
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#getExprType()
+ */
+ public short getExprType()
+ {
+ switch (id)
+ {
+ case XPathTreeConstants.JJTFLWREXPR:
+ return ITERATION_EXPR;
+
+ case XPathTreeConstants.JJTEVERY:
+ return EVERY_EXPR;
+
+ case XPathTreeConstants.JJTSOME:
+ return SOME_EXPR;
+ }
+
+ // bug
+ throw new RuntimeException("Invalid object state");
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#cloneExpression()
+ */
+ public Expr cloneExpression()
+ {
+ // TODO
+ return null;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.impl.parser.Node#jjtAddChild(Node, int)
+ */
+ final public void jjtAddChild(Node n, int i)
+ {
+
+ if (((SimpleNode) n).canBeReduced())
+ {
+ super.jjtAddChild(n.jjtGetChild(0), i);
+ }
+ else
+ {
+ super.jjtAddChild(n, i);
+ }
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.impl.parser.SimpleNode#canBeReduced()
+ */
+ public boolean canBeReduced()
+ {
+ return children.length == 1; // means that there is no???
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Visitable#visit(Visitor)
+ */
+ public void visit(Visitor visitor)
+ {
+ // TODO:
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.xpath.rwapi.impl.ExprImpl#getString(java.lang.StringBuffer, boolean)
+ */
+ protected void getString(StringBuffer expr, boolean abbreviate)
+ {
+ switch (getExprType())
+ {
+ case ITERATION_EXPR:
+ expr.append("for ");
+
+ break;
+
+ case EVERY_EXPR:
+ expr.append("every ");
+
+ break;
+
+ case SOME_EXPR:
+ expr.append("some ");
+
+ break;
+
+ default:
+ throw new RuntimeException("Invalid object state");
+ }
+
+ for (int i = 0; i < m_varNames.length; i++)
+ {
+ expr.append(m_varNames[i].getVariableName()).append(" in ");
+ m_exprs[i].getString(expr, abbreviate);
+ }
+
+ switch (getExprType())
+ {
+ case ITERATION_EXPR:
+ expr.append(" return ");
+
+ break;
+
+ case EVERY_EXPR:
+ case SOME_EXPR:
+ expr.append(" satifies ");
+
+ break;
+
+ default:
+ throw new RuntimeException("Invalid object state");
+ }
+
+ m_resExpr.getString(expr, abbreviate);
+ }
+
+
+}
1.1.2.4 +131 -130
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/VariableImpl.java
Index: VariableImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/Attic/VariableImpl.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- VariableImpl.java 5 Feb 2003 16:09:47 -0000 1.1.2.3
+++ VariableImpl.java 19 Feb 2003 14:24:01 -0000 1.1.2.4
@@ -1,130 +1,131 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, Lotus
- * Development Corporation., http://www.lotus.com. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.xpath.rwapi.impl;
-
-import org.apache.xpath.rwapi.expression.Expr;
-import org.apache.xpath.rwapi.expression.Variable;
-import org.apache.xpath.rwapi.expression.Visitor;
-import org.apache.xpath.rwapi.impl.parser.Token;
-import org.apache.xpath.rwapi.impl.parser.XPath;
-
-/**
- *
- */
-public class VariableImpl extends ExprImpl implements Variable {
-
- String m_varName;
-
- /**
- * Constructor for VariableImpl.
- * @param i
- */
- public VariableImpl(int i) {
- super(i);
- }
-
- /**
- * Constructor for VariableImpl.
- * @param p
- * @param i
- */
- public VariableImpl(XPath p, int i) {
- super(p, i);
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Variable#getVariableName()
- */
- public String getVariableName() {
- return null;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#getExprType()
- */
- public short getExprType() {
- return VARIABLE_REF_EXPR;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Expr#cloneExpression()
- */
- public Expr cloneExpression() {
- return null;
- }
-
- /**
- * @see org.apache.xpath.rwapi.expression.Visitable#visited(Visitor)
- */
- public void visited(Visitor visitor) {
- }
-
- /**
- * @see
org.apache.xpath.rwapi.impl.parser.SimpleNode#processToken(Token)
- */
- public void processToken(Token token) {
- super.processToken(token);
- m_varName = token.image.trim();
- }
-
- /**
- * @see org.apache.xpath.rwapi.impl.ExprImpl#getString(StringBuffer,
boolean)
- */
- protected void getString(StringBuffer expr, boolean abbreviate) {
- expr.append('$').append(m_varName);
- }
-
-}
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.xpath.rwapi.impl;
+
+import org.apache.xpath.rwapi.expression.Expr;
+import org.apache.xpath.rwapi.expression.Variable;
+import org.apache.xpath.rwapi.expression.Visitor;
+import org.apache.xpath.rwapi.impl.parser.Token;
+import org.apache.xpath.rwapi.impl.parser.XPath;
+
+/**
+ *
+ */
+public class VariableImpl extends ExprImpl implements Variable {
+
+ String m_varName;
+
+ /**
+ * Constructor for VariableImpl.
+ * @param i
+ */
+ public VariableImpl(int i) {
+ super(i);
+ }
+
+ /**
+ * Constructor for VariableImpl.
+ * @param p
+ * @param i
+ */
+ public VariableImpl(XPath p, int i) {
+ super(p, i);
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Variable#getVariableName()
+ */
+ public String getVariableName() {
+ return m_varName;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#getExprType()
+ */
+ public short getExprType() {
+ return VARIABLE_REF_EXPR;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Expr#cloneExpression()
+ */
+ public Expr cloneExpression() {
+ // TODO
+ return null;
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.expression.Visitable#visited(Visitor)
+ */
+ public void visited(Visitor visitor) {
+ }
+
+ /**
+ * @see
org.apache.xpath.rwapi.impl.parser.SimpleNode#processToken(Token)
+ */
+ public void processToken(Token token) {
+ super.processToken(token);
+ m_varName = token.image.trim();
+ }
+
+ /**
+ * @see org.apache.xpath.rwapi.impl.ExprImpl#getString(StringBuffer,
boolean)
+ */
+ protected void getString(StringBuffer expr, boolean abbreviate) {
+ expr.append('$').append(m_varName);
+ }
+
+}
No revision
No revision
1.1.2.4 +1 -1
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser/Attic/XPathTreeConstants.java
Index: XPathTreeConstants.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser/Attic/XPathTreeConstants.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- XPathTreeConstants.java 12 Feb 2003 16:14:56 -0000 1.1.2.3
+++ XPathTreeConstants.java 19 Feb 2003 14:24:02 -0000 1.1.2.4
@@ -1,4 +1,4 @@
-/* Generated By:JJTree: Do not edit this line.
C:/data/projects/xalanxslt2-base/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser\XPathTreeConstants.java
*/
+/* Generated By:JJTree: Do not edit this line.
E:/ast/xslt20/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser\XPathTreeConstants.java
*/
package org.apache.xpath.rwapi.impl.parser;
1.1.2.4 +1 -1
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser/Attic/XPathVisitor.java
Index: XPathVisitor.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser/Attic/XPathVisitor.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- XPathVisitor.java 12 Feb 2003 16:14:56 -0000 1.1.2.3
+++ XPathVisitor.java 19 Feb 2003 14:24:02 -0000 1.1.2.4
@@ -1,4 +1,4 @@
-/* Generated By:JJTree: Do not edit this line.
C:/data/projects/xalanxslt2-base/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser\XPathVisitor.java
*/
+/* Generated By:JJTree: Do not edit this line.
E:/ast/xslt20/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser\XPathVisitor.java
*/
package org.apache.xpath.rwapi.impl.parser;
1.1.2.6 +1 -0
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser/Attic/SimpleNode.java
Index: SimpleNode.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser/Attic/SimpleNode.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- SimpleNode.java 13 Feb 2003 16:49:44 -0000 1.1.2.5
+++ SimpleNode.java 19 Feb 2003 14:24:02 -0000 1.1.2.6
@@ -388,6 +388,7 @@
case XPathTreeConstants.JJTOCCURRENCEINDICATOR: //105;
case XPathTreeConstants.JJTMULTIPLY: //106;
case XPathTreeConstants.JJTQMARK: //107;
+
default:
No revision
No revision
1.1.2.1 +4522 -0
xml-xalan/java/xpath_rwapi/src/org/apache/xpath/rwapi/impl/parser/Attic/xpath-grammar.jj
No revision
No revision
1.1.2.5 +1 -1
xml-xalan/java/xpath_rwapi/grammar/Attic/xpath-grammar.xml
Index: xpath-grammar.xml
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/grammar/Attic/xpath-grammar.xml,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- xpath-grammar.xml 12 Feb 2003 16:14:51 -0000 1.1.2.4
+++ xpath-grammar.xml 19 Feb 2003 14:24:02 -0000 1.1.2.5
@@ -1733,7 +1733,7 @@
</production>
<!-- SimpleForClause is slightly different now for XQuery vs. XPath. -sb
-->
- <production name="SimpleForClause" if="xpath">
+ <production name="SimpleForClause" if="xpath" node-type="void">
<ref name="ForVariable"/>
<ref name="VarName"/>
<ref name="In"/>
No revision
No revision
1.1.2.7 +17 -8 xml-xalan/java/xpath_rwapi/Attic/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-xalan/java/xpath_rwapi/Attic/build.xml,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- build.xml 13 Feb 2003 16:55:21 -0000 1.1.2.6
+++ build.xml 19 Feb 2003 14:24:02 -0000 1.1.2.7
@@ -40,6 +40,10 @@
<property name="build.dir" value="../build"/>
<property name="build.classes" value="${build.dir}/classes"/>
+ <property name="build.debug" value="on"/>
+ <property name="bin.dir" value="../bin"/>
+ <property name="jarfilename" value="xpathapi.jar"/>
+
<property name="spec" value="xpath"/>
<property name="grammar.dir" value="grammar"/>
<property name="tree.xsl" value="${grammar.dir}/etree.xsl"/>
@@ -52,14 +56,20 @@
<property name="test.expr" value="a/b/c"/>
<path id="classpath">
- <fileset dir="../bin" includes="*.jar"/>
+ <fileset dir="${bin.dir}" includes="*.jar"/>
</path>
<path id="test.classpath">
- <fileset dir="build" includes="*.jar"/>
- <fileset dir="../bin" includes="*.jar"/>
+ <fileset dir="${build.dir}" includes="*.jar"/>
+ <fileset dir="${bin.dir}" includes="*.jar"/>
</path>
+ <target name="clean"
+ description="Clean up ALL classfiles and jars (but not generated .java
source)">
+ <delete dir="${build.classes}"/>
+ <delete file="${build.dir}/${jarfilename}"/>
+ </target>
+
<target name="gen-grammar">
<mkdir dir="${target.parser}"/>
@@ -77,7 +87,7 @@
<target name="jjtree" depends="gen-grammar">
<jjtree target="${target.parser}/xpath-grammar.jjt"
- javacchome="../bin"
+ javacchome="${bin.dir}"
outputdirectory="${target.parser}"
static="false"/>
</target>
@@ -85,7 +95,7 @@
<target name="javacc" depends="jjtree">
<javacc target="${target.parser}/xpath-grammar.jj"
- javacchome="../bin"
+ javacchome="${bin.dir}"
debugtokenmanager="${debug}"
debugparser="${debug}"
sanitycheck="true"
@@ -100,14 +110,13 @@
</target>
<target name="compile" depends="prepare">
- <javac srcdir="src" destdir="${build.classes}">
+ <javac srcdir="src" destdir="${build.classes}" debug="${build.debug}">
<classpath refid="classpath"/>
</javac>
</target>
<target name="jar" depends="compile">
- <echo message="Jarring classes in: ${build.classes} spec:
${rwapi.package}/**"/>
- <jar jarfile="${build.dir}/xpathapi.jar">
+ <jar jarfile="${build.dir}/${jarfilename}">
<fileset dir="${build.classes}"
includes="${rwapi.package}/**"/>
</jar>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]