What bug?

Tom

[EMAIL PROTECTED] wrote:

> morten      01/06/19 03:44:19
>
>   Modified:    java/src/org/apache/xalan/xsltc/compiler ContainsCall.java
>                         FunctionCall.java If.java LogicalExpr.java
>                         Param.java QName.java StartsWithCall.java
>                         SymbolTable.java SyntaxTreeNode.java Template.java
>                         Variable.java xpath.cup
>                java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java
>   Log:
>   Fix for function calls used as clauses in logical expressions.
>   Submitted by: [EMAIL PROTECTED]
>   Reviewed by:  [EMAIL PROTECTED]
>
>   Revision  Changes    Path
>   1.2       +21 -8     
>xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ContainsCall.java
>
>   Index: ContainsCall.java
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ContainsCall.java,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- ContainsCall.java 2001/04/17 18:51:24     1.1
>   +++ ContainsCall.java 2001/06/19 10:44:09     1.2
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: ContainsCall.java,v 1.1 2001/04/17 18:51:24 sboag Exp $
>   + * @(#)$Id: ContainsCall.java,v 1.2 2001/06/19 10:44:09 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -77,28 +77,36 @@
>        private Expression _token = null;
>
>        /**
>   -     *
>   +     * Create a contains() call - two arguments, both strings
>         */
>        public ContainsCall(QName fname, Vector arguments) {
>         super(fname, arguments);
>        }
>
>        /**
>   -     *
>   +     * This XPath function returns true/false values
>         */
>   +    public boolean isBoolean() {
>   +     return true;
>   +    }
>   +
>   +    /**
>   +     * Type check the two parameters for this function
>   +     */
>        public Type typeCheck(SymbolTable stable) throws TypeCheckError {
>   +
>         // Check that the function was passed exactly two arguments
>         if (argumentCount() != 2) {
>   -         ErrorMsg msg = new ErrorMsg("Illegal number of arguments "+
>   -                                     "to contains() function");
>   -         throw new TypeCheckError(msg);
>   +         throw new TypeCheckError(ErrorMsg.FUNRESOL_ERR, getName());
>         }
>   -
>   +
>   +     // The first argument must be a String, or cast to a String
>         _base = argument(0);
>         Type baseType = _base.typeCheck(stable);
>         if (baseType != Type.String)
>             _base = new CastExpr(_base, Type.String);
>
>   +     // The second argument must also be a String, or cast to a String
>         _token = argument(1);
>         Type tokenType = _token.typeCheck(stable);
>         if (tokenType != Type.String)
>   @@ -107,12 +115,17 @@
>         return _type = Type.Boolean;
>        }
>
>   -
>   +    /**
>   +     * Compile the expression - leave boolean expression on stack
>   +     */
>        public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
>         translateDesynthesized(classGen, methodGen);
>         synthesize(classGen, methodGen);
>        }
>
>   +    /**
>   +     * Compile expression and update true/false-lists
>   +     */
>        public void translateDesynthesized(ClassGenerator classGen,
>                                        MethodGenerator methodGen) {
>         final ConstantPoolGen cpg = classGen.getConstantPool();
>
>
>
>   1.6       +28 -3     
>xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FunctionCall.java
>
>   Index: FunctionCall.java
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FunctionCall.java,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- FunctionCall.java 2001/06/17 12:23:29     1.5
>   +++ FunctionCall.java 2001/06/19 10:44:09     1.6
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: FunctionCall.java,v 1.5 2001/06/17 12:23:29 curcuru Exp $
>   + * @(#)$Id: FunctionCall.java,v 1.6 2001/06/19 10:44:09 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -164,6 +164,10 @@
>         this(fname, EmptyArgs);
>        }
>
>   +    public String getName() {
>   +     return(_fname.toString());
>   +    }
>   +
>        public void setParser(Parser parser) {
>         super.setParser(parser);
>         if (_arguments != null) {
>   @@ -175,7 +179,7 @@
>             }
>         }
>        }
>   -
>   +
>        /**
>         * Type check a function call. Since different type conversions apply,
>         * type checking is different for standard and external (Java) functions.
>   @@ -313,8 +317,29 @@
>         _arguments.setElementAt(exp, i);
>        }
>
>   +    /**
>   +     * Compile the function call and treat as an expression
>   +     * Update true/false-lists.
>   +     */
>   +    public void translateDesynthesized(ClassGenerator classGen,
>   +                                    MethodGenerator methodGen) {
>   +
>   +     Type type = Type.Boolean;
>   +     if (_chosenMethodType != null)
>   +         type = _chosenMethodType.resultType();
>   +
>   +     final InstructionList il = methodGen.getInstructionList();
>   +     translate(classGen, methodGen);
>   +
>   +     if ((type instanceof BooleanType) || (type instanceof IntType)) {
>   +         _falseList.add(il.append(new IFEQ(null)));
>   +     }
>   +    }
>   +
>   +
>        /**
>   -     * Translate a function call.
>   +     * Translate a function call. The compiled code will leave the function's
>   +     * return value on the JVM's stack.
>         */
>        public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
>         final int n = argumentCount();
>
>
>
>   1.5       +2 -1      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/If.java
>
>   Index: If.java
>   ===================================================================
>   RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/If.java,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- If.java   2001/06/11 12:03:32     1.4
>   +++ If.java   2001/06/19 10:44:10     1.5
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: If.java,v 1.4 2001/06/11 12:03:32 morten Exp $
>   + * @(#)$Id: If.java,v 1.5 2001/06/19 10:44:10 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -134,6 +134,7 @@
>         * The contents will be ignored if we know the test will always fail.
>         */
>        public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
>   +
>         final InstructionList il = methodGen.getInstructionList();
>         _test.translateDesynthesized(classGen, methodGen);
>         // remember end of condition
>
>
>
>   1.6       +11 -18    
>xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LogicalExpr.java
>
>   Index: LogicalExpr.java
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LogicalExpr.java,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- LogicalExpr.java  2001/06/15 09:57:12     1.5
>   +++ LogicalExpr.java  2001/06/19 10:44:10     1.6
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: LogicalExpr.java,v 1.5 2001/06/15 09:57:12 morten Exp $
>   + * @(#)$Id: LogicalExpr.java,v 1.6 2001/06/19 10:44:10 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -73,8 +73,9 @@
>        public static final int OR  = 0;
>        public static final int AND = 1;
>
>   -    private final int _op;
>   -    private Expression _left, _right;
>   +    private final int  _op;     // operator
>   +    private Expression _left;   // first operand
>   +    private Expression _right;  // second operand
>
>        private static final String[] Ops = { "or", "and" };
>
>   @@ -131,10 +132,12 @@
>         if (haveType != null) {
>             // Check if left-hand side operand must be type casted
>             Type arg1 = (Type)haveType.argsType().elementAt(0);
>   -         if (!arg1.identicalTo(tleft)) _left = new CastExpr(_left, arg1);
>   +         if (!arg1.identicalTo(tleft))
>   +             _left = new CastExpr(_left, arg1);
>             // Check if right-hand side operand must be type casted
>             Type arg2 = (Type) haveType.argsType().elementAt(1);
>   -         if (!arg2.identicalTo(tright)) _right = new CastExpr(_right, arg1);
>   +         if (!arg2.identicalTo(tright))
>   +             _right = new CastExpr(_right, arg1);
>             // Return the result type for the operator we will use
>             return _type = haveType.resultType();
>         }
>   @@ -163,18 +166,12 @@
>
>             // Translate left hand side - must be true
>             _left.translateDesynthesized(classGen, methodGen);
>   -         if ((_left instanceof FunctionCall) &&
>   -             (!(_left instanceof ContainsCall)))
>   -             _falseList.add(il.append(new IFEQ(null)));
>
>             // Need this for chaining any OR-expression children
>             InstructionHandle middle = il.append(NOP);
>
>             // Translate left right side - must be true
>             _right.translateDesynthesized(classGen, methodGen);
>   -         if ((_right instanceof FunctionCall) &&
>   -             (!(_right instanceof ContainsCall)))
>   -             _falseList.add(il.append(new IFEQ(null)));
>
>             // Need this for chaining any OR-expression children
>             InstructionHandle after = il.append(NOP);
>   @@ -182,7 +179,8 @@
>             // Append child expression false-lists to our false-list
>             _falseList.append(_right._falseList.append(_left._falseList));
>
>   -         // Special case for OR-expression as a left child of AND
>   +         // Special case for OR-expression as a left child of AND.
>   +         // The true-list of OR must point to second clause of AND.
>             if ((_left instanceof LogicalExpr) &&
>                 (((LogicalExpr)_left).getOp() == OR)) {
>                 ((LogicalExpr)_left).backPatchTrueList(middle);
>   @@ -192,6 +190,7 @@
>             }
>
>             // Special case for OR-expression as a right child of AND
>   +         // The true-list of OR must point to true-list of AND.
>             if ((_right instanceof LogicalExpr) &&
>                 (((LogicalExpr)_right).getOp() == OR)) {
>                 ((LogicalExpr)_right).backPatchTrueList(after);
>   @@ -205,9 +204,6 @@
>         else {
>             // Translate left-hand side expression and produce true/false list
>             _left.translateDesynthesized(classGen, methodGen);
>   -         if ((_left instanceof FunctionCall) &&
>   -             (!(_left instanceof ContainsCall)))
>   -             _falseList.add(il.append(new IFEQ(null)));
>
>             // This GOTO is used to skip over the code for the last test
>             // in the case where the the first test succeeds
>   @@ -215,9 +211,6 @@
>
>             // Translate right-hand side expression and produce true/false list
>             _right.translateDesynthesized(classGen, methodGen);
>   -         if ((_right instanceof FunctionCall) &&
>   -             (!(_right instanceof ContainsCall)))
>   -             _falseList.add(il.append(new IFEQ(null)));
>
>             _left._trueList.backPatch(ih);
>             _left._falseList.backPatch(ih.getNext());
>
>
>
>   1.5       +4 -3      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Param.java
>
>   Index: Param.java
>   ===================================================================
>   RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Param.java,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- Param.java        2001/06/07 15:15:56     1.4
>   +++ Param.java        2001/06/19 10:44:10     1.5
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: Param.java,v 1.4 2001/06/07 15:15:56 morten Exp $
>   + * @(#)$Id: Param.java,v 1.5 2001/06/19 10:44:10 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -145,6 +145,7 @@
>
>         if (name.length() > 0) {
>             _name = parser.getQName(name);
>   +         _name.clearDefaultNamespace();
>         }
>            else {
>             reportError(this, parser, ErrorMsg.NREQATTR_ERR, "name");
>   @@ -172,9 +173,9 @@
>             //!! check for redef
>             parser.getSymbolTable().addParam(this);
>         }
>   -     else {
>   +     else if (parent instanceof Template) {
>             _isLocal = true;
>   -         parent.addParam(this);
>   +         ((Template)parent).hasParams(true);
>         }
>        }
>
>
>
>
>   1.3       +2 -2      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/QName.java
>
>   Index: QName.java
>   ===================================================================
>   RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/QName.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- QName.java        2001/06/06 10:45:25     1.2
>   +++ QName.java        2001/06/19 10:44:11     1.3
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: QName.java,v 1.2 2001/06/06 10:45:25 morten Exp $
>   + * @(#)$Id: QName.java,v 1.3 2001/06/19 10:44:11 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -86,7 +86,7 @@
>        }
>
>        public void clearDefaultNamespace() {
>   -     if ((_prefix == null) || (_prefix.equals(""))) {
>   +     if ((_prefix == null) || (_prefix.equals(Constants.EMPTYSTRING))) {
>             _namespace = null;
>             _stringRep = _localname;
>             _hashCode  = _stringRep.hashCode() + 19; // cached for speed
>
>
>
>   1.2       +41 -3     
>xml-xalan/java/src/org/apache/xalan/xsltc/compiler/StartsWithCall.java
>
>   Index: StartsWithCall.java
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/StartsWithCall.java,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- StartsWithCall.java       2001/04/17 18:51:47     1.1
>   +++ StartsWithCall.java       2001/06/19 10:44:11     1.2
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: StartsWithCall.java,v 1.1 2001/04/17 18:51:47 sboag Exp $
>   + * @(#)$Id: StartsWithCall.java,v 1.2 2001/06/19 10:44:11 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -58,25 +58,63 @@
>     *
>     * @author Jacek Ambroziak
>     * @author Santiago Pericas-Geertsen
>   + * @author Morten Jorgensen
>     *
>     */
>
>    package org.apache.xalan.xsltc.compiler;
>
>    import java.util.Vector;
>   +
>   +import org.apache.xalan.xsltc.compiler.util.Type;
>    import de.fub.bytecode.generic.*;
>    import org.apache.xalan.xsltc.compiler.util.*;
>
>    final class StartsWithCall extends FunctionCall {
>   +
>   +    private Expression _base = null;
>   +    private Expression _token = null;
>   +
>   +    /**
>   +     * Create a starts-with() call - two arguments, both strings
>   +     */
>        public StartsWithCall(QName fname, Vector arguments) {
>         super(fname, arguments);
>        }
>
>   +    /**
>   +     * Type check the two parameters for this function
>   +     */
>   +    public Type typeCheck(SymbolTable stable) throws TypeCheckError {
>   +
>   +     // Check that the function was passed exactly two arguments
>   +     if (argumentCount() != 2) {
>   +         throw new TypeCheckError(ErrorMsg.FUNRESOL_ERR, getName());
>   +     }
>   +
>   +     // The first argument must be a String, or cast to a String
>   +     _base = argument(0);
>   +     Type baseType = _base.typeCheck(stable);
>   +     if (baseType != Type.String)
>   +         _base = new CastExpr(_base, Type.String);
>   +
>   +     // The second argument must also be a String, or cast to a String
>   +     _token = argument(1);
>   +     Type tokenType = _token.typeCheck(stable);
>   +     if (tokenType != Type.String)
>   +         _token = new CastExpr(_token, Type.String);
>   +
>   +     return _type = Type.Boolean;
>   +    }
>   +
>   +    /**
>   +     * Compile the expression - leave boolean expression on stack
>   +     */
>        public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
>         final ConstantPoolGen cpg = classGen.getConstantPool();
>         final InstructionList il = methodGen.getInstructionList();
>   -     argument(0).translate(classGen, methodGen);
>   -     argument(1).translate(classGen, methodGen);
>   +     _base.translate(classGen, methodGen);
>   +     _token.translate(classGen, methodGen);
>         il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
>                                                      "startsWith",
>                                                      "("+STRING_SIG+")Z")));
>
>
>
>   1.4       +5 -2      
>xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SymbolTable.java
>
>   Index: SymbolTable.java
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SymbolTable.java,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- SymbolTable.java  2001/06/06 10:45:30     1.3
>   +++ SymbolTable.java  2001/06/19 10:44:11     1.4
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: SymbolTable.java,v 1.3 2001/06/06 10:45:30 morten Exp $
>   + * @(#)$Id: SymbolTable.java,v 1.4 2001/06/19 10:44:11 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -92,10 +92,13 @@
>        }
>
>        public Template addTemplate(Template template) {
>   -     return (Template)_templates.put(template.getName(), template);
>   +     final QName name = template.getName();
>   +     name.clearDefaultNamespace();
>   +     return (Template)_templates.put(name, template);
>        }
>
>        public Template lookupTemplate(QName name) {
>   +     name.clearDefaultNamespace();
>         return (Template)_templates.get(name);
>        }
>
>
>
>
>   1.6       +1 -20     
>xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java
>
>   Index: SyntaxTreeNode.java
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- SyntaxTreeNode.java       2001/06/08 15:28:13     1.5
>   +++ SyntaxTreeNode.java       2001/06/19 10:44:11     1.6
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: SyntaxTreeNode.java,v 1.5 2001/06/08 15:28:13 morten Exp $
>   + * @(#)$Id: SyntaxTreeNode.java,v 1.6 2001/06/19 10:44:11 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -88,11 +88,6 @@
>        // Contains all child nodes of this node
>        private final Vector   _contents = new Vector(2);
>
>   -    // All parameters defined in this AST node
>   -    private Vector _params;
>   -    // All variables defined in this AST node
>   -    private Vector _vars;
>   -
>        // The QName of this element (contains uri, prefix and localname)
>        protected QName      _qname;
>        // The attributes (if any) of this element
>   @@ -251,20 +246,6 @@
>
>        public final XSLTC getXSLTC() {
>         return _parser.getXSLTC();
>   -    }
>   -
>   -    //!! are these needed?
>   -
>   -    public int addParam(Param param) {
>   -     if (_params == null) {
>   -         _params = new Vector(4);
>   -     }
>   -     _params.addElement(param);
>   -     return _params.size() - 1;
>   -    }
>   -
>   -    public final boolean hasParams() {
>   -     return _params != null;
>        }
>
>        /**
>
>
>
>   1.8       +10 -2     
>xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Template.java
>
>   Index: Template.java
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Template.java,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- Template.java     2001/06/06 17:48:58     1.7
>   +++ Template.java     2001/06/19 10:44:12     1.8
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: Template.java,v 1.7 2001/06/06 17:48:58 tmiller Exp $
>   + * @(#)$Id: Template.java,v 1.8 2001/06/19 10:44:12 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -92,8 +92,16 @@
>         * classes (e.g., predicates, xsl:number, xsl:sort).
>         */
>        private boolean _hasVariableFrame;
>   -
>   +    private boolean _hasParams = false;
>        private boolean _simplified = false;
>   +
>   +    public boolean hasParams() {
>   +     return _hasParams;
>   +    }
>   +
>   +    public void hasParams(boolean hasParams) {
>   +     _hasParams = hasParams;
>   +    }
>
>        public boolean isSimplified() {
>         return(_simplified);
>
>
>
>   1.6       +2 -1      
>xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Variable.java
>
>   Index: Variable.java
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Variable.java,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- Variable.java     2001/06/07 15:16:04     1.5
>   +++ Variable.java     2001/06/19 10:44:13     1.6
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: Variable.java,v 1.5 2001/06/07 15:16:04 morten Exp $
>   + * @(#)$Id: Variable.java,v 1.6 2001/06/19 10:44:13 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -184,6 +184,7 @@
>         final String name = getAttribute("name");
>         if (name.length() > 0) {
>             _name = parser.getQName(name);
>   +         _name.clearDefaultNamespace();
>         }
>            else {
>             reportError(this, parser, ErrorMsg.NREQATTR_ERR, "name");
>
>
>
>   1.4       +19 -11    xml-xalan/java/src/org/apache/xalan/xsltc/compiler/xpath.cup
>
>   Index: xpath.cup
>   ===================================================================
>   RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/xpath.cup,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- xpath.cup 2001/06/06 17:48:59     1.3
>   +++ xpath.cup 2001/06/19 10:44:13     1.4
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: xpath.cup,v 1.3 2001/06/06 17:48:59 tmiller Exp $
>   + * @(#)$Id: xpath.cup,v 1.4 2001/06/19 10:44:13 morten Exp $
>     *
>     * Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
>     *
>   @@ -181,7 +181,7 @@
>    non terminal Object NodeTestPattern, NameTestPattern;
>
>    non terminal Vector Predicates, NonemptyArgumentList;
>   -non terminal QName QName, FunctionName;
>   +non terminal QName QName, FunctionName, VariableName;
>    non terminal Integer AxisName, AxisSpecifier;
>    non terminal Integer ChildOrAttributeAxisSpecifier;
>
>   @@ -579,7 +579,7 @@
>         * namespace info in the literal expression. This is used for
>         * element-available and function-available functions.
>         */
>   -     final int index = string.indexOf(':');
>   +     final int index = string.lastIndexOf(':');
>         final String prefix = index >= 0
>                                         ? string.substring(0, index)
>                                         : Constants.EMPTYSTRING;
>   @@ -607,9 +607,12 @@
>            | FunctionCall:fc
>            {: RESULT = fc; :};
>
>   -VariableReference ::= DOLLAR QName:varName
>   +VariableReference ::= DOLLAR VariableName:varName
>            {:
>   +            // An empty qname prefix for a variable or parameter reference
>   +            // should map to the null namespace and not the default URI.
>                SyntaxTreeNode node = parser.lookupName(varName);
>   +
>                if (node != null) {
>                    if (node instanceof Variable) {
>                        RESULT = new VariableRef((Variable)node);
>   @@ -618,18 +621,17 @@
>                        RESULT = new ParameterRef((Param)node);
>                    }
>                    else {
>   -                    //node.getParser().addFatalError("Cannot resolve variable or 
>parameter feference to "+varName);
>   -                    node.getParser().reportError(Constants.FATAL,
>   -                     new ErrorMsg(
>   -                     "Cannot resolve variable or parameter feference to "+
>   -                     varName));
>   +                    node = null;
>                    }
>                }
>   -            else {
>   +
>   +            if (node == null) {
>   +             System.err.println("looking for var "+varName);
>                    RESULT = parser.DummyVarRef;
>   -                parser.addError(new ErrorMsg(ErrorMsg.VARUNDEF_ERR,
>   +                parser.addError(new ErrorMsg(ErrorMsg.VARUNDEF_ERR,
>                     parser.getLineNumber(), varName));
>                }
>   +
>            :};
>
>    FunctionCall ::= FunctionName:fname LPAREN RPAREN
>   @@ -770,6 +772,12 @@
>            {:
>                fname.clearDefaultNamespace();
>                RESULT = fname;
>   +        :};
>   +
>   +VariableName ::= QName:vname
>   +        {:
>   +            vname.clearDefaultNamespace();
>   +            RESULT = vname;
>            :};
>
>    Argument ::=    Expr:ex
>
>
>
>   1.6       +1 -4      
>xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java
>
>   Index: BasisLibrary.java
>   ===================================================================
>   RCS file: 
>/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- BasisLibrary.java 2001/06/17 12:23:36     1.5
>   +++ BasisLibrary.java 2001/06/19 10:44:18     1.6
>   @@ -1,5 +1,5 @@
>    /*
>   - * @(#)$Id: BasisLibrary.java,v 1.5 2001/06/17 12:23:36 curcuru Exp $
>   + * @(#)$Id: BasisLibrary.java,v 1.6 2001/06/19 10:44:18 morten Exp $
>     *
>     * The Apache Software License, Version 1.1
>     *
>   @@ -438,14 +438,11 @@
>         left.reset();
>
>         while ((lnode = left.next()) != NodeIterator.END) {
>   -         //System.out.println("lnode = " + lnode);
>             final String lvalue = dom.getNodeValue(lnode);
>   -         //System.out.println("lvalue = " + lvalue);
>
>             int rnode;
>             right.reset();
>             while ((rnode = right.next()) != NodeIterator.END) {
>   -
>                 if (compareStrings(lvalue, dom.getNodeValue(rnode), op, dom)) {
>                     return true;
>                 }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to