| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.expr.instruct; |
| 9 |
|
| 10 |
import net.sf.saxon.expr.*; |
| 11 |
import net.sf.saxon.expr.parser.ExpressionTool; |
| 12 |
import net.sf.saxon.expr.parser.RebindingMap; |
| 13 |
import net.sf.saxon.om.StandardNames; |
| 14 |
import net.sf.saxon.trace.ExpressionPresenter; |
| 15 |
import net.sf.saxon.trans.XPathException; |
| 16 |
|
| 17 |
import java.util.Collections; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
public class BreakInstr extends Instruction implements TailCallLoop.TailCallInfo { |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
public BreakInstr() { |
| 30 |
} |
| 31 |
|
| 32 |
@Override |
| 33 |
public Iterable<Operand> operands() { |
| 34 |
return Collections.emptyList(); |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
public Expression copy(RebindingMap rebindings) { |
| 39 |
BreakInstr b2 = new BreakInstr(); |
| 40 |
ExpressionTool.copyLocationInfo(this, b2); |
| 41 |
return b2; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
public boolean mayCreateNewNodes() { |
| 46 |
|
| 47 |
|
| 48 |
return true; |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public boolean isLiftable(boolean forStreaming) { |
| 58 |
return false; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
@Override |
| 68 |
public int getInstructionNameCode() { |
| 69 |
return StandardNames.XSL_BREAK; |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
public TailCall processLeavingTail(XPathContext context) throws XPathException { |
| 74 |
markContext(context); |
| 75 |
return null; |
| 76 |
} |
| 77 |
|
| 78 |
public void markContext(XPathContext context) { |
| 79 |
XPathContext c = context; |
| 80 |
while (!(c instanceof XPathContextMajor)) { |
| 81 |
c = c.getCaller(); |
| 82 |
} |
| 83 |
((XPathContextMajor) c).requestTailCall(this, null); |
| 84 |
} |
| 85 |
|
| 86 |
@Override |
| 87 |
public String getExpressionName() { |
| 88 |
return "xsl:break"; |
| 89 |
} |
| 90 |
|
| 91 |
public void export(ExpressionPresenter out) throws XPathException { |
| 92 |
out.startElement("break", this); |
| 93 |
out.endElement(); |
| 94 |
} |
| 95 |
} |
| 96 |
|