use of org.eclipse.wst.xml.xpath2.processor.internal.ast.FunctionCall in project webtools.sourceediting by eclipse.
the class Normalizer method make_function.
private XPathExpr make_function(QName name, Collection args) {
FunctionCall fc = new FunctionCall(name, args);
FilterExpr fe = new FilterExpr(fc, new ArrayList());
return new XPathExpr(0, fe);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.FunctionCall in project webtools.sourceediting by eclipse.
the class DefaultEvaluator method visit.
/**
* visit function call.
*
* @param e
* is the function call.
* @return a new function or null
*/
public Object visit(FunctionCall e) {
ArrayList args = new ArrayList();
for (Iterator i = e.iterator(); i.hasNext(); ) {
Expr arg = (Expr) i.next();
// each argument will produce a result sequence
args.add((ResultSequence) arg.accept(this));
}
try {
Function function = e.function();
if (function == null) {
function = _sc.resolveFunction(e.name().asQName(), args.size());
e.set_function(function);
}
return function.evaluate(args, _ec);
} catch (DynamicError err) {
report_error(err);
// unreach
return null;
}
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.FunctionCall in project webtools.sourceediting by eclipse.
the class StaticNameResolver method visit.
/**
* Validate a function call.
*
* @param e
* is the expression.
* @return null.
*/
public Object visit(FunctionCall e) {
QName name = e.name();
if (!expandFunctionQName(name))
reportBadPrefix(name.prefix());
javax.xml.namespace.QName qName = name.asQName();
Function f = _sc.resolveFunction(qName, e.arity());
if (f == null)
reportError(new StaticFunctNameError("Function does not exist: " + name.string() + " arity: " + e.arity()));
e.set_function(f);
_resolvedFunctions.add(qName);
visitExprs(e.iterator());
return null;
}
Aggregations