use of org.mozilla.javascript.ast.ContinueStatement in project st-js by st-js.
the class RhinoJavaScriptBuilder method continueStatement.
/**
* {@inheritDoc}
*/
@Override
public AstNode continueStatement(AstNode label) {
ContinueStatement c = new ContinueStatement();
c.setLabel(cast(label, Name.class));
return c;
}
use of org.mozilla.javascript.ast.ContinueStatement in project HL4A by HL4A.
the class Parser method continueStatement.
private ContinueStatement continueStatement() throws IOException {
if (currentToken != Token.CONTINUE)
codeBug();
consumeToken();
int lineno = ts.lineno, pos = ts.tokenBeg, end = ts.tokenEnd;
Name label = null;
if (peekTokenOrEOL() == Token.NAME) {
label = createNameNode();
end = getNodeEnd(label);
}
// matchJumpLabelName only matches if there is one
LabeledStatement labels = matchJumpLabelName();
Loop target = null;
if (labels == null && label == null) {
if (loopSet == null || loopSet.size() == 0) {
reportError("msg.continue.outside");
} else {
target = loopSet.get(loopSet.size() - 1);
}
} else {
if (labels == null || !(labels.getStatement() instanceof Loop)) {
reportError("msg.continue.nonloop", pos, end - pos);
}
target = labels == null ? null : (Loop) labels.getStatement();
}
ContinueStatement pn = new ContinueStatement(pos, end - pos);
if (// can be null in error-recovery mode
target != null)
pn.setTarget(target);
pn.setLabel(label);
pn.setLineno(lineno);
return pn;
}
Aggregations