/** * NCName ::= (Letter | '_') (NCNameChar) * NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender */ protected void NCName() { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), m_queueMark - 1); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); }
/** * Given a location step, get the length of that step. * * @param opPos Position of location step in op map. * * @return The length of the step. */ public int getArgLengthOfStep(int opPos) { return m_opMap.elementAt(opPos + MAPINDEX_LENGTH + 1) - 3; }
/** * initial the function table */ private void initFunctionTable(){ m_funcTable = new FunctionTable(); }
/** * * StringExpr ::= Expr * * * @throws javax.xml.transform.TransformerException */ protected void StringExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); appendOp(2, OpCodes.OP_STRING); Expr(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); }
/** * Compile a location step predicate expression. * * @param opPos The current position in the m_opMap array. * * @return the contained predicate expression. * * @throws TransformerException if a error occurs creating the Expression. */ public Expression predicate(int opPos) throws TransformerException { return compile(opPos + 2); }
/** * Figure out if we're executing a toplevel expression. * If so, we can't be inside of a predicate. */ public void postCompileStep(Compiler compiler) { m_isTopLevel = compiler.getLocationPathDepth() == -1; }
/** * * * Expr ::= OrExpr * * * @throws javax.xml.transform.TransformerException */ protected void Expr() throws javax.xml.transform.TransformerException { OrExpr(); }
/** * Set the op at index to the given int. * * @param opPos index into op map. * @param value Value to set */ public void setOp(int opPos, int value) { m_opMap.setElementAt(value,opPos); }
/** * Walk through the expression and build a token queue, and a map of the top-level * elements. * @param pat XSLT Expression. * * @throws javax.xml.transform.TransformerException */ void tokenize(String pat) throws javax.xml.transform.TransformerException { tokenize(pat, null); }
/** * * IdKeyPattern ::= 'id' '(' Literal ')' * | 'key' '(' Literal ',' Literal ')' * (Also handle doc()) * * * @throws javax.xml.transform.TransformerException */ protected void IdKeyPattern() throws javax.xml.transform.TransformerException { FunctionCall(); }
/** * * Argument ::= Expr * * * @throws javax.xml.transform.TransformerException */ protected void Argument() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); appendOp(2, OpCodes.OP_ARGUMENT); Expr(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); }
/** * NCName ::= (Letter | '_') (NCNameChar) * NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender */ protected void NCName() { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), m_queueMark - 1); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); }
/** * Get the test type of the step, i.e. NODETYPE_XXX value. * * @param opPosOfStep The position of the FROM_XXX step. * * @return NODETYPE_XXX value. */ public int getStepTestType(int opPosOfStep) { return m_opMap.elementAt(opPosOfStep + 3); // skip past op, len, len without predicates }
/** * Figure out if we're executing a toplevel expression. * If so, we can't be inside of a predicate. */ public void postCompileStep(Compiler compiler) { m_isTopLevel = compiler.getLocationPathDepth() == -1; }
/** * * * Expr ::= OrExpr * * * @throws javax.xml.transform.TransformerException */ protected void Expr() throws javax.xml.transform.TransformerException { OrExpr(); }
/** * * * NumberExpr ::= Expr * * * @throws javax.xml.transform.TransformerException */ protected void NumberExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); appendOp(2, OpCodes.OP_NUMBER); Expr(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); }
/** * Given an operation position, return the current op. * * @param opPos index into op map. * @return the op that corresponds to the opPos argument. */ public int getOp(int opPos) { return m_opMap.elementAt(opPos); }
/** * Given an operation position, return the end position, i.e. the * beginning of the next operation. * * @param opPos An op position of an operation for which there is a size * entry following. * @return position of next operation in m_opMap. */ public int getNextOpPos(int opPos) { return opPos + m_opMap.elementAt(opPos + 1); }
/** * Get the length of an operation. * * @param opPos The position of the operation in the op map. * * @return The size of the operation. */ public int getArgLength(int opPos) { return m_opMap.elementAt(opPos + MAPINDEX_LENGTH); }
/** * Given a location step, get the length of that step. * * @param opPos Position of location step in op map. * * @return The length of the step. */ public int getArgLengthOfStep(int opPos) { return m_opMap.elementAt(opPos + MAPINDEX_LENGTH + 1) - 3; }