use of org.eclipse.wst.xml.xpath2.processor.internal.ast.Expr in project webtools.sourceediting by eclipse.
the class Normalizer method visit.
/**
* Returns the normalized tree
*
* @param xp
* is the xpath expression.
* @return the xpath expressions.
*/
public Object visit(XPath xp) {
Collection exprs = new ArrayList();
for (Iterator i = xp.iterator(); i.hasNext(); ) {
Expr e = (Expr) i.next();
Expr n = (Expr) e.accept(this);
exprs.add(n);
}
return new XPath(exprs);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.Expr in project webtools.sourceediting by eclipse.
the class StaticNameResolver method visit.
/**
* Validate an XPath by visiting all the nodes.
*
* @param xp
* is the XPath.
* @return null.
*/
public Object visit(XPath xp) {
for (Iterator i = xp.iterator(); i.hasNext(); ) {
Expr e = (Expr) i.next();
e.accept(this);
}
return null;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.Expr in project webtools.sourceediting by eclipse.
the class StaticNameResolver method doForExpr.
// does a for and a quantified expression
// takes the iterator for var expr paris
private void doForExpr(Iterator iter, Expr expr) {
int scopes = 0;
// add variables to scope and check the binding sequence
while (iter.hasNext()) {
VarExprPair pair = (VarExprPair) iter.next();
QName var = pair.varname();
if (!expandVarQName(var))
reportBadPrefix(var.prefix());
Expr e = pair.expr();
e.accept(this);
pushScope(var, BuiltinTypeLibrary.XS_ANYTYPE);
scopes++;
}
expr.accept(this);
// kill the scopes
for (int i = 0; i < scopes; i++) popScope();
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.Expr in project webtools.sourceediting by eclipse.
the class DefaultVisitor method visit.
/**
* Returns the normalized tree
*
* @param xp
* is the xpath expression.
* @return the xpath expressions.
*/
public Object visit(XPath xp) {
for (Iterator<Expr> i = xp.iterator(); i.hasNext(); ) {
Expr e = (Expr) i.next();
e.accept(this);
}
return null;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.Expr in project webtools.sourceediting by eclipse.
the class DefaultEvaluator method do_exists.
private XSBoolean do_exists(ListIterator iter, Expr finalexpr) {
// we have more vars to bind...
if (iter.hasNext()) {
VarExprPair ve = (VarExprPair) iter.next();
// evaluate binding sequence
ResultSequence rs = (ResultSequence) ve.expr().accept(this);
QName varname = ve.varname();
try {
for (Iterator i = rs.iterator(); i.hasNext(); ) {
AnyType item = (AnyType) i.next();
pushScope(varname, item);
XSBoolean effbool = do_exists(iter, finalexpr);
popScope();
// out what to do with it
if (effbool.value())
return XSBoolean.TRUE;
}
} finally {
iter.previous();
}
// since none in this sequence evaluated to true, return false
return XSBoolean.FALSE;
} else // we finally got to do the "last expression"
{
return effective_boolean_value((ResultSequence) finalexpr.accept(this));
}
}
Aggregations