/** * Simplify the pattern by applying any context-independent optimisations. * Default implementation does nothing. * */ @Override public Pattern simplify() throws XPathException { wrappedPattern = wrappedPattern.simplify(); return this; }
/** * Simplify the pattern by applying any context-independent optimisations. * Default implementation does nothing. * */ @Override public Pattern simplify() throws XPathException { wrappedPattern = wrappedPattern.simplify(); return this; }
/** * Simplify an expression. This performs any static optimization (by rewriting the expression * as a different expression). The default implementation does nothing. * * @return the simplified expression * @throws XPathException if an error is discovered during expression * rewriting * @param visitor an expression visitor */ public Expression simplify(ExpressionVisitor visitor) throws XPathException { pattern = pattern.simplify(visitor); return this; }
/** * Simplify an expression. This performs any static optimization (by rewriting the expression * as a different expression). The default implementation does nothing. * * @return the simplified expression * @throws XPathException if an error is discovered during expression * rewriting * @param visitor an expression visitor */ public Expression simplify(ExpressionVisitor visitor) throws XPathException { pattern = pattern.simplify(visitor); return this; }
public Expression simplify(ExpressionVisitor visitor) throws XPathException { select = visitor.simplify(select); value = visitor.simplify(value); format = visitor.simplify(format); groupSize = visitor.simplify(groupSize); groupSeparator = visitor.simplify(groupSeparator); letterValue = visitor.simplify(letterValue); ordinal = visitor.simplify(ordinal); lang = visitor.simplify(lang); if (count != null) { count = count.simplify(visitor); } if (from != null) { from = from.simplify(visitor); } return this; }
public Expression simplify(ExpressionVisitor visitor) throws XPathException { select = visitor.simplify(select); value = visitor.simplify(value); format = visitor.simplify(format); groupSize = visitor.simplify(groupSize); groupSeparator = visitor.simplify(groupSeparator); letterValue = visitor.simplify(letterValue); ordinal = visitor.simplify(ordinal); lang = visitor.simplify(lang); if (count != null) { count = count.simplify(visitor); } if (from != null) { from = from.simplify(visitor); } return this; }
/** * Static method to make a Pattern by parsing a String. <br> * @param pattern The pattern text as a String * @param env An object defining the compile-time context for the expression * @param exec The executable containing this pattern * @return The pattern object */ public static Pattern make(String pattern, StaticContext env, Executable exec) throws XPathException { Pattern pat = (new ExpressionParser()).parsePattern(pattern, env); pat.setSystemId(env.getSystemId()); pat.setLineNumber(env.getLineNumber()); // System.err.println("Simplified [" + pattern + "] to " + pat.getClass() + " default prio = " + pat.getDefaultPriority()); // set the pattern text for use in diagnostics pat.setOriginalText(pattern); pat.setExecutable(exec); ExpressionVisitor visitor = ExpressionVisitor.make(env); visitor.setExecutable(exec); pat = pat.simplify(visitor); return pat; }
/** * Static method to make a Pattern by parsing a String. <br> * @param pattern The pattern text as a String * @param env An object defining the compile-time context for the expression * @param exec The executable containing this pattern * @return The pattern object */ public static Pattern make(String pattern, StaticContext env, Executable exec) throws XPathException { Pattern pat = (new ExpressionParser()).parsePattern(pattern, env); pat.setSystemId(env.getSystemId()); pat.setLineNumber(env.getLineNumber()); // System.err.println("Simplified [" + pattern + "] to " + pat.getClass() + " default prio = " + pat.getDefaultPriority()); // set the pattern text for use in diagnostics pat.setOriginalText(pattern); pat.setExecutable(exec); ExpressionVisitor visitor = ExpressionVisitor.make(env); visitor.setExecutable(exec); pat = pat.simplify(visitor); return pat; }
/** * Static method to make a Pattern by parsing a String. <br> * @param pattern The pattern text as a String * @param env An object defining the compile-time context for the expression * @param exec The executable containing this pattern * @return The pattern object */ public static Pattern make(String pattern, StaticContext env, Executable exec) throws XPathException { Pattern pat = (new ExpressionParser()).parsePattern(pattern, env); pat.setSystemId(env.getSystemId()); pat.setLineNumber(env.getLineNumber()); // System.err.println("Simplified [" + pattern + "] to " + pat.getClass() + " default prio = " + pat.getDefaultPriority()); // set the pattern text for use in diagnostics pat.setOriginalText(pattern); pat.setExecutable(exec); ExpressionVisitor visitor = ExpressionVisitor.make(env); visitor.setExecutable(exec); pat = pat.simplify(visitor); return pat; }
/** * Static factory method to make a Pattern by parsing a String. <br> * * @param pattern The pattern text as a String * @param env An object defining the compile-time context for the expression * @param packageData The package containing this pattern * @return The pattern object * @throws net.sf.saxon.trans.XPathException if the pattern is invalid */ public static Pattern make(String pattern, StaticContext env, PackageData packageData) throws XPathException { int languageLevel = env.getConfiguration().getConfigurationProperty(Feature.XPATH_VERSION_FOR_XSLT); if (languageLevel == 30) { languageLevel = 305; // XPath 3.0 + XSLT extensions } int lineNumber = env instanceof ExpressionContext ? ((ExpressionContext) env).getStyleElement().getLineNumber() : -1; PatternParser parser = (PatternParser) env.getConfiguration().newExpressionParser("PATTERN", false, languageLevel); ((XPathParser) parser).setLanguage(XPathParser.XSLT_PATTERN, 30); Pattern pat = parser.parsePattern(pattern, env); pat.setRetainedStaticContext(env.makeRetainedStaticContext()); // System.err.println("Simplified [" + pattern + "] to " + pat.getClass() + " default prio = " + pat.getDefaultPriority()); pat = pat.simplify(); return pat; }
/** * Static factory method to make a Pattern by parsing a String. <br> * * @param pattern The pattern text as a String * @param env An object defining the compile-time context for the expression * @param packageData The package containing this pattern * @return The pattern object * @throws net.sf.saxon.trans.XPathException if the pattern is invalid */ public static Pattern make(String pattern, StaticContext env, PackageData packageData) throws XPathException { int languageLevel = env.getConfiguration().getConfigurationProperty(Feature.XPATH_VERSION_FOR_XSLT); if (languageLevel == 30) { languageLevel = 305; // XPath 3.0 + XSLT extensions } int lineNumber = env instanceof ExpressionContext ? ((ExpressionContext) env).getStyleElement().getLineNumber() : -1; PatternParser parser = (PatternParser) env.getConfiguration().newExpressionParser("PATTERN", false, languageLevel); ((XPathParser) parser).setLanguage(XPathParser.XSLT_PATTERN, 30); Pattern pat = parser.parsePattern(pattern, env); pat.setRetainedStaticContext(env.makeRetainedStaticContext()); // System.err.println("Simplified [" + pattern + "] to " + pat.getClass() + " default prio = " + pat.getDefaultPriority()); pat = pat.simplify(); return pat; }