use of org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep in project webtools.sourceediting by eclipse.
the class DefaultEvaluator method visit.
/**
* visit a reverse step expression
*
* @param e
* is the reverse step.
* @return a new function
*/
// XXX unify with top
public Object visit(ReverseStep e) {
// get context node
AnyType ci = focus().context_item();
if (!(ci instanceof NodeType))
report_error(TypeError.ci_not_node(ci.string_type()));
NodeType cn = (NodeType) ci;
// get the nodes on the axis
ReverseAxis axis = e.iterator();
ResultBuffer result = new ResultBuffer();
// short for "gimme da parent"
if (e.axis() == ReverseStep.DOTDOT) {
new ParentAxis().iterate(cn, result, _dc.getLimitNode());
return result.getSequence();
}
assert axis != null;
axis.iterate(cn, result, null);
// get all nodes in the axis, and principal node
Pair arg = new Pair(axis.principal_node_kind().string_type(), result.getSequence());
// do the name test
_param = arg;
ResultSequence rs = (ResultSequence) e.node_test().accept(this);
return rs;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep in project webtools.sourceediting by eclipse.
the class StaticNameResolver method visit.
/**
* Validate a reverse step.
*
* @param e
* is the expression.
* @return null.
*/
public Object visit(ReverseStep e) {
NodeTest nt = e.node_test();
if (nt != null)
nt.accept(this);
ReverseAxis iterator = e.iterator();
if (iterator != null)
_axes.add(iterator.name());
return null;
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.ReverseStep in project webtools.sourceediting by eclipse.
the class Normalizer method visit.
/**
* @param e
* is the reverse step.
* @return e
*/
public Object visit(ReverseStep e) {
if (e.axis() == ReverseStep.DOTDOT) {
NodeTest nt = new AnyKindTest();
Step s = new ReverseStep(ReverseStep.PARENT, nt);
return s;
}
NodeTest nt = e.node_test();
if (nt != null)
nt.accept(this);
return e;
}
Aggregations