com.sun.org.apache.xpath.internal.compiler.FunctionTable Java Examples

The following examples show how to use com.sun.org.apache.xpath.internal.compiler.FunctionTable. 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-8-source with GNU General Public License v2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #2
Source File: XPath.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compileExpression(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #3
Source File: WalkerFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #4
Source File: WalkerFactory.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #5
Source File: XPath.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #6
Source File: XPath.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #7
Source File: WalkerFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #8
Source File: WalkerFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #9
Source File: XPath.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compileExpression(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #10
Source File: WalkerFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #11
Source File: XPath.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #12
Source File: XPath.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #13
Source File: WalkerFactory.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #14
Source File: XPath.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #15
Source File: XPath.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #16
Source File: WalkerFactory.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #17
Source File: WalkerFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #18
Source File: XPath.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compileExpression(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #19
Source File: WalkerFactory.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #20
Source File: XPath.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #21
Source File: XPath.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Construct an XPath object.
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator,
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{
  m_funcTable = aTable;
  if(null == errorListener)
    errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();

  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
          new Object[]{Integer.toString(type)}));
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);

  if((null != locator) && locator instanceof ExpressionNode)
  {
      expr.exprSetParent((ExpressionNode)locator);
  }

}
 
Example #22
Source File: WalkerFactory.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
static boolean functionProximateOrContainsProximate(Compiler compiler,
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
Example #23
Source File: XPath.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * initial the function table
 */
private void initFunctionTable(){
            m_funcTable = new FunctionTable();
}
 
Example #24
Source File: XPath.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * initial the function table
 */
private void initFunctionTable(){
            m_funcTable = new FunctionTable();
}
 
Example #25
Source File: XPath.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * initial the function table
 */
private void initFunctionTable(){
            m_funcTable = new FunctionTable();
}
 
Example #26
Source File: XPath.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * initial the function table
 */
private void initFunctionTable(){
            m_funcTable = new FunctionTable();
}
 
Example #27
Source File: XPath.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * initial the function table
 */
private void initFunctionTable(){
            m_funcTable = new FunctionTable();
}
 
Example #28
Source File: XPath.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * initial the function table
 */
private void initFunctionTable(){
            m_funcTable = new FunctionTable();
}
 
Example #29
Source File: XPath.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * initial the function table
 */
private void initFunctionTable(){
            m_funcTable = new FunctionTable();
}
 
Example #30
Source File: XPath.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * initial the function table
 */
private void initFunctionTable(){
            m_funcTable = new FunctionTable();
}