Java Code Examples for com.sun.org.apache.xpath.internal.compiler.OpCodes#OP_VARIABLE
The following examples show how to use
com.sun.org.apache.xpath.internal.compiler.OpCodes#OP_VARIABLE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WalkerFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Analyze a step and give information about it's predicates. Right now this * just returns true or false if the step has a predicate. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param opPos The opcode position for the step. * @param stepType The type of step, one of OP_GROUP, etc. * * @return true if step has a predicate. * * @throws javax.xml.transform.TransformerException */ static boolean analyzePredicate(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { int argLen; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : argLen = compiler.getArgLength(opPos); break; default : argLen = compiler.getArgLengthOfStep(opPos); } int pos = compiler.getFirstPredicateOpPos(opPos); int nPredicates = compiler.countPredicates(pos); return (nPredicates > 0) ? true : false; }
Example 2
Source File: WalkerFactory.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Analyze a step and give information about it's predicates. Right now this * just returns true or false if the step has a predicate. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param opPos The opcode position for the step. * @param stepType The type of step, one of OP_GROUP, etc. * * @return true if step has a predicate. * * @throws javax.xml.transform.TransformerException */ static boolean analyzePredicate(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { int argLen; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : argLen = compiler.getArgLength(opPos); break; default : argLen = compiler.getArgLengthOfStep(opPos); } int pos = compiler.getFirstPredicateOpPos(opPos); int nPredicates = compiler.countPredicates(pos); return (nPredicates > 0) ? true : false; }
Example 3
Source File: WalkerFactory.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Analyze a step and give information about it's predicates. Right now this * just returns true or false if the step has a predicate. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param opPos The opcode position for the step. * @param stepType The type of step, one of OP_GROUP, etc. * * @return true if step has a predicate. * * @throws javax.xml.transform.TransformerException */ static boolean analyzePredicate(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { int argLen; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : argLen = compiler.getArgLength(opPos); break; default : argLen = compiler.getArgLengthOfStep(opPos); } int pos = compiler.getFirstPredicateOpPos(opPos); int nPredicates = compiler.countPredicates(pos); return (nPredicates > 0) ? true : false; }
Example 4
Source File: WalkerFactory.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Analyze a step and give information about it's predicates. Right now this * just returns true or false if the step has a predicate. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param opPos The opcode position for the step. * @param stepType The type of step, one of OP_GROUP, etc. * * @return true if step has a predicate. * * @throws javax.xml.transform.TransformerException */ static boolean analyzePredicate(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { int argLen; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : argLen = compiler.getArgLength(opPos); break; default : argLen = compiler.getArgLengthOfStep(opPos); } int pos = compiler.getFirstPredicateOpPos(opPos); int nPredicates = compiler.countPredicates(pos); return (nPredicates > 0) ? true : false; }
Example 5
Source File: WalkerFactory.java From hottub with GNU General Public License v2.0 | 5 votes |
static boolean isProximateInnerExpr(Compiler compiler, int opPos) { int op = compiler.getOp(opPos); int innerExprOpPos = opPos+2; switch(op) { case OpCodes.OP_ARGUMENT: if(isProximateInnerExpr(compiler, innerExprOpPos)) return true; break; case OpCodes.OP_VARIABLE: case OpCodes.OP_NUMBERLIT: case OpCodes.OP_LITERAL: case OpCodes.OP_LOCATIONPATH: break; // OK case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, opPos); if(isProx) return true; break; case OpCodes.OP_GT: case OpCodes.OP_GTE: case OpCodes.OP_LT: case OpCodes.OP_LTE: case OpCodes.OP_EQUALS: int leftPos = OpMap.getFirstChildPos(op); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true; break; default: return true; // be conservative... } return false; }
Example 6
Source File: WalkerFactory.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static boolean isProximateInnerExpr(Compiler compiler, int opPos) { int op = compiler.getOp(opPos); int innerExprOpPos = opPos+2; switch(op) { case OpCodes.OP_ARGUMENT: if(isProximateInnerExpr(compiler, innerExprOpPos)) return true; break; case OpCodes.OP_VARIABLE: case OpCodes.OP_NUMBERLIT: case OpCodes.OP_LITERAL: case OpCodes.OP_LOCATIONPATH: break; // OK case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, opPos); if(isProx) return true; break; case OpCodes.OP_GT: case OpCodes.OP_GTE: case OpCodes.OP_LT: case OpCodes.OP_LTE: case OpCodes.OP_EQUALS: int leftPos = OpMap.getFirstChildPos(op); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true; break; default: return true; // be conservative... } return false; }
Example 7
Source File: WalkerFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static boolean isProximateInnerExpr(Compiler compiler, int opPos) { int op = compiler.getOp(opPos); int innerExprOpPos = opPos+2; switch(op) { case OpCodes.OP_ARGUMENT: if(isProximateInnerExpr(compiler, innerExprOpPos)) return true; break; case OpCodes.OP_VARIABLE: case OpCodes.OP_NUMBERLIT: case OpCodes.OP_LITERAL: case OpCodes.OP_LOCATIONPATH: break; // OK case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, opPos); if(isProx) return true; break; case OpCodes.OP_GT: case OpCodes.OP_GTE: case OpCodes.OP_LT: case OpCodes.OP_LTE: case OpCodes.OP_EQUALS: int leftPos = OpMap.getFirstChildPos(op); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true; break; default: return true; // be conservative... } return false; }
Example 8
Source File: WalkerFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static boolean isProximateInnerExpr(Compiler compiler, int opPos) { int op = compiler.getOp(opPos); int innerExprOpPos = opPos+2; switch(op) { case OpCodes.OP_ARGUMENT: if(isProximateInnerExpr(compiler, innerExprOpPos)) return true; break; case OpCodes.OP_VARIABLE: case OpCodes.OP_NUMBERLIT: case OpCodes.OP_LITERAL: case OpCodes.OP_LOCATIONPATH: break; // OK case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, opPos); if(isProx) return true; break; case OpCodes.OP_GT: case OpCodes.OP_GTE: case OpCodes.OP_LT: case OpCodes.OP_LTE: case OpCodes.OP_EQUALS: int leftPos = OpMap.getFirstChildPos(op); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true; break; default: return true; // be conservative... } return false; }
Example 9
Source File: WalkerFactory.java From Bytecoder with Apache License 2.0 | 5 votes |
static boolean isProximateInnerExpr(Compiler compiler, int opPos) { int op = compiler.getOp(opPos); int innerExprOpPos = opPos+2; switch(op) { case OpCodes.OP_ARGUMENT: if(isProximateInnerExpr(compiler, innerExprOpPos)) return true; break; case OpCodes.OP_VARIABLE: case OpCodes.OP_NUMBERLIT: case OpCodes.OP_LITERAL: case OpCodes.OP_LOCATIONPATH: break; // OK case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, opPos); if(isProx) return true; break; case OpCodes.OP_GT: case OpCodes.OP_GTE: case OpCodes.OP_LT: case OpCodes.OP_LTE: case OpCodes.OP_EQUALS: int leftPos = OpMap.getFirstChildPos(op); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true; break; default: return true; // be conservative... } return false; }
Example 10
Source File: WalkerFactory.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static boolean isProximateInnerExpr(Compiler compiler, int opPos) { int op = compiler.getOp(opPos); int innerExprOpPos = opPos+2; switch(op) { case OpCodes.OP_ARGUMENT: if(isProximateInnerExpr(compiler, innerExprOpPos)) return true; break; case OpCodes.OP_VARIABLE: case OpCodes.OP_NUMBERLIT: case OpCodes.OP_LITERAL: case OpCodes.OP_LOCATIONPATH: break; // OK case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, opPos); if(isProx) return true; break; case OpCodes.OP_GT: case OpCodes.OP_GTE: case OpCodes.OP_LT: case OpCodes.OP_LTE: case OpCodes.OP_EQUALS: int leftPos = OpMap.getFirstChildPos(op); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true; break; default: return true; // be conservative... } return false; }
Example 11
Source File: UnionPathIterator.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Initialize the location path iterators. Recursive. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * @param count The insert position of the iterator. * * @throws javax.xml.transform.TransformerException */ protected void loadLocationPaths(Compiler compiler, int opPos, int count) throws javax.xml.transform.TransformerException { // TODO: Handle unwrapped FilterExpr int steptype = compiler.getOp(opPos); if (steptype == OpCodes.OP_LOCATIONPATH) { loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1); m_exprs[count] = createDTMIterator(compiler, opPos); m_exprs[count].exprSetParent(this); } else { // Have to check for unwrapped functions, which the LocPathIterator // doesn't handle. switch (steptype) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1); WalkingIterator iter = new WalkingIterator(compiler.getNamespaceContext()); iter.exprSetParent(this); if(compiler.getLocationPathDepth() <= 0) iter.setIsTopLevel(true); iter.m_firstWalker = new com.sun.org.apache.xpath.internal.axes.FilterExprWalker(iter); iter.m_firstWalker.init(compiler, opPos, steptype); m_exprs[count] = iter; break; default : m_exprs = new LocPathIterator[count]; } } }
Example 12
Source File: FilterExprWalker.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Init a FilterExprWalker. * * @param compiler non-null reference to the Compiler that is constructing. * @param opPos positive opcode position for this step. * @param stepType The type of step. * * @throws javax.xml.transform.TransformerException */ public void init(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { super.init(compiler, opPos, stepType); // Smooth over an anomily in the opcode map... switch (stepType) { case OpCodes.OP_FUNCTION : case OpCodes.OP_EXTFUNCTION : m_mustHardReset = true; case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : m_expr = compiler.compile(opPos); m_expr.exprSetParent(this); //if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof com.sun.org.apache.xalan.internal.templates.FuncKey)) if(m_expr instanceof com.sun.org.apache.xpath.internal.operations.Variable) { // hack/temp workaround m_canDetachNodeset = false; } break; default : m_expr = compiler.compile(opPos + 2); m_expr.exprSetParent(this); } // if(m_expr instanceof WalkingIterator) // { // WalkingIterator wi = (WalkingIterator)m_expr; // if(wi.getFirstWalker() instanceof FilterExprWalker) // { // FilterExprWalker fw = (FilterExprWalker)wi.getFirstWalker(); // if(null == fw.getNextWalker()) // { // m_expr = fw.m_expr; // m_expr.exprSetParent(this); // } // } // // } }
Example 13
Source File: WalkerFactory.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Special purpose function to see if we can optimize the pattern for * a DescendantIterator. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * * @return 32 bits as an integer that give information about the location * path as a whole. * * @throws javax.xml.transform.TransformerException */ public static int getAxisFromStep( Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { int stepType = compiler.getOp(stepOpCodePos); switch (stepType) { case OpCodes.FROM_FOLLOWING : return Axis.FOLLOWING; case OpCodes.FROM_FOLLOWING_SIBLINGS : return Axis.FOLLOWINGSIBLING; case OpCodes.FROM_PRECEDING : return Axis.PRECEDING; case OpCodes.FROM_PRECEDING_SIBLINGS : return Axis.PRECEDINGSIBLING; case OpCodes.FROM_PARENT : return Axis.PARENT; case OpCodes.FROM_NAMESPACE : return Axis.NAMESPACE; case OpCodes.FROM_ANCESTORS : return Axis.ANCESTOR; case OpCodes.FROM_ANCESTORS_OR_SELF : return Axis.ANCESTORORSELF; case OpCodes.FROM_ATTRIBUTES : return Axis.ATTRIBUTE; case OpCodes.FROM_ROOT : return Axis.ROOT; case OpCodes.FROM_CHILDREN : return Axis.CHILD; case OpCodes.FROM_DESCENDANTS_OR_SELF : return Axis.DESCENDANTORSELF; case OpCodes.FROM_DESCENDANTS : return Axis.DESCENDANT; case OpCodes.FROM_SELF : return Axis.SELF; case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : return Axis.FILTEREDLIST; } throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); }
Example 14
Source File: UnionPathIterator.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Initialize the location path iterators. Recursive. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * @param count The insert position of the iterator. * * @throws javax.xml.transform.TransformerException */ protected void loadLocationPaths(Compiler compiler, int opPos, int count) throws javax.xml.transform.TransformerException { // TODO: Handle unwrapped FilterExpr int steptype = compiler.getOp(opPos); if (steptype == OpCodes.OP_LOCATIONPATH) { loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1); m_exprs[count] = createDTMIterator(compiler, opPos); m_exprs[count].exprSetParent(this); } else { // Have to check for unwrapped functions, which the LocPathIterator // doesn't handle. switch (steptype) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1); WalkingIterator iter = new WalkingIterator(compiler.getNamespaceContext()); iter.exprSetParent(this); if(compiler.getLocationPathDepth() <= 0) iter.setIsTopLevel(true); iter.m_firstWalker = new com.sun.org.apache.xpath.internal.axes.FilterExprWalker(iter); iter.m_firstWalker.init(compiler, opPos, steptype); m_exprs[count] = iter; break; default : m_exprs = new LocPathIterator[count]; } } }
Example 15
Source File: UnionPathIterator.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Initialize the location path iterators. Recursive. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * @param count The insert position of the iterator. * * @throws javax.xml.transform.TransformerException */ protected void loadLocationPaths(Compiler compiler, int opPos, int count) throws javax.xml.transform.TransformerException { // TODO: Handle unwrapped FilterExpr int steptype = compiler.getOp(opPos); if (steptype == OpCodes.OP_LOCATIONPATH) { loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1); m_exprs[count] = createDTMIterator(compiler, opPos); m_exprs[count].exprSetParent(this); } else { // Have to check for unwrapped functions, which the LocPathIterator // doesn't handle. switch (steptype) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1); WalkingIterator iter = new WalkingIterator(compiler.getNamespaceContext()); iter.exprSetParent(this); if(compiler.getLocationPathDepth() <= 0) iter.setIsTopLevel(true); iter.m_firstWalker = new com.sun.org.apache.xpath.internal.axes.FilterExprWalker(iter); iter.m_firstWalker.init(compiler, opPos, steptype); m_exprs[count] = iter; break; default : m_exprs = new LocPathIterator[count]; } } }
Example 16
Source File: FilterExprWalker.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Init a FilterExprWalker. * * @param compiler non-null reference to the Compiler that is constructing. * @param opPos positive opcode position for this step. * @param stepType The type of step. * * @throws javax.xml.transform.TransformerException */ public void init(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { super.init(compiler, opPos, stepType); // Smooth over an anomily in the opcode map... switch (stepType) { case OpCodes.OP_FUNCTION : case OpCodes.OP_EXTFUNCTION : m_mustHardReset = true; case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : m_expr = compiler.compileExpression(opPos); m_expr.exprSetParent(this); //if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof com.sun.org.apache.xalan.internal.templates.FuncKey)) if(m_expr instanceof com.sun.org.apache.xpath.internal.operations.Variable) { // hack/temp workaround m_canDetachNodeset = false; } break; default : m_expr = compiler.compileExpression(opPos + 2); m_expr.exprSetParent(this); } // if(m_expr instanceof WalkingIterator) // { // WalkingIterator wi = (WalkingIterator)m_expr; // if(wi.getFirstWalker() instanceof FilterExprWalker) // { // FilterExprWalker fw = (FilterExprWalker)wi.getFirstWalker(); // if(null == fw.getNextWalker()) // { // m_expr = fw.m_expr; // m_expr.exprSetParent(this); // } // } // // } }
Example 17
Source File: WalkerFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Special purpose function to see if we can optimize the pattern for * a DescendantIterator. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * * @return 32 bits as an integer that give information about the location * path as a whole. * * @throws javax.xml.transform.TransformerException */ public static int getAxisFromStep( Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { int stepType = compiler.getOp(stepOpCodePos); switch (stepType) { case OpCodes.FROM_FOLLOWING : return Axis.FOLLOWING; case OpCodes.FROM_FOLLOWING_SIBLINGS : return Axis.FOLLOWINGSIBLING; case OpCodes.FROM_PRECEDING : return Axis.PRECEDING; case OpCodes.FROM_PRECEDING_SIBLINGS : return Axis.PRECEDINGSIBLING; case OpCodes.FROM_PARENT : return Axis.PARENT; case OpCodes.FROM_NAMESPACE : return Axis.NAMESPACE; case OpCodes.FROM_ANCESTORS : return Axis.ANCESTOR; case OpCodes.FROM_ANCESTORS_OR_SELF : return Axis.ANCESTORORSELF; case OpCodes.FROM_ATTRIBUTES : return Axis.ATTRIBUTE; case OpCodes.FROM_ROOT : return Axis.ROOT; case OpCodes.FROM_CHILDREN : return Axis.CHILD; case OpCodes.FROM_DESCENDANTS_OR_SELF : return Axis.DESCENDANTORSELF; case OpCodes.FROM_DESCENDANTS : return Axis.DESCENDANT; case OpCodes.FROM_SELF : return Axis.SELF; case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : return Axis.FILTEREDLIST; } throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); }
Example 18
Source File: FilterExprWalker.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Init a FilterExprWalker. * * @param compiler non-null reference to the Compiler that is constructing. * @param opPos positive opcode position for this step. * @param stepType The type of step. * * @throws javax.xml.transform.TransformerException */ public void init(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { super.init(compiler, opPos, stepType); // Smooth over an anomily in the opcode map... switch (stepType) { case OpCodes.OP_FUNCTION : case OpCodes.OP_EXTFUNCTION : m_mustHardReset = true; case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : m_expr = compiler.compile(opPos); m_expr.exprSetParent(this); //if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof com.sun.org.apache.xalan.internal.templates.FuncKey)) if(m_expr instanceof com.sun.org.apache.xpath.internal.operations.Variable) { // hack/temp workaround m_canDetachNodeset = false; } break; default : m_expr = compiler.compile(opPos + 2); m_expr.exprSetParent(this); } // if(m_expr instanceof WalkingIterator) // { // WalkingIterator wi = (WalkingIterator)m_expr; // if(wi.getFirstWalker() instanceof FilterExprWalker) // { // FilterExprWalker fw = (FilterExprWalker)wi.getFirstWalker(); // if(null == fw.getNextWalker()) // { // m_expr = fw.m_expr; // m_expr.exprSetParent(this); // } // } // // } }
Example 19
Source File: WalkerFactory.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Special purpose function to see if we can optimize the pattern for * a DescendantIterator. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * * @return 32 bits as an integer that give information about the location * path as a whole. * * @throws javax.xml.transform.TransformerException */ public static int getAxisFromStep( Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { int stepType = compiler.getOp(stepOpCodePos); switch (stepType) { case OpCodes.FROM_FOLLOWING : return Axis.FOLLOWING; case OpCodes.FROM_FOLLOWING_SIBLINGS : return Axis.FOLLOWINGSIBLING; case OpCodes.FROM_PRECEDING : return Axis.PRECEDING; case OpCodes.FROM_PRECEDING_SIBLINGS : return Axis.PRECEDINGSIBLING; case OpCodes.FROM_PARENT : return Axis.PARENT; case OpCodes.FROM_NAMESPACE : return Axis.NAMESPACE; case OpCodes.FROM_ANCESTORS : return Axis.ANCESTOR; case OpCodes.FROM_ANCESTORS_OR_SELF : return Axis.ANCESTORORSELF; case OpCodes.FROM_ATTRIBUTES : return Axis.ATTRIBUTE; case OpCodes.FROM_ROOT : return Axis.ROOT; case OpCodes.FROM_CHILDREN : return Axis.CHILD; case OpCodes.FROM_DESCENDANTS_OR_SELF : return Axis.DESCENDANTORSELF; case OpCodes.FROM_DESCENDANTS : return Axis.DESCENDANT; case OpCodes.FROM_SELF : return Axis.SELF; case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : return Axis.FILTEREDLIST; } throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); }
Example 20
Source File: WalkerFactory.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Special purpose function to see if we can optimize the pattern for * a DescendantIterator. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * * @return 32 bits as an integer that give information about the location * path as a whole. * * @throws javax.xml.transform.TransformerException */ public static int getAxisFromStep( Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { int stepType = compiler.getOp(stepOpCodePos); switch (stepType) { case OpCodes.FROM_FOLLOWING : return Axis.FOLLOWING; case OpCodes.FROM_FOLLOWING_SIBLINGS : return Axis.FOLLOWINGSIBLING; case OpCodes.FROM_PRECEDING : return Axis.PRECEDING; case OpCodes.FROM_PRECEDING_SIBLINGS : return Axis.PRECEDINGSIBLING; case OpCodes.FROM_PARENT : return Axis.PARENT; case OpCodes.FROM_NAMESPACE : return Axis.NAMESPACE; case OpCodes.FROM_ANCESTORS : return Axis.ANCESTOR; case OpCodes.FROM_ANCESTORS_OR_SELF : return Axis.ANCESTORORSELF; case OpCodes.FROM_ATTRIBUTES : return Axis.ATTRIBUTE; case OpCodes.FROM_ROOT : return Axis.ROOT; case OpCodes.FROM_CHILDREN : return Axis.CHILD; case OpCodes.FROM_DESCENDANTS_OR_SELF : return Axis.DESCENDANTORSELF; case OpCodes.FROM_DESCENDANTS : return Axis.DESCENDANT; case OpCodes.FROM_SELF : return Axis.SELF; case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : return Axis.FILTEREDLIST; } throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); }