Search in sources :

Example 1 with DoLoop

use of org.mozilla.javascript.ast.DoLoop in project st-js by st-js.

the class RhinoJavaScriptBuilder method doLoop.

/**
 * {@inheritDoc}
 */
@Override
public AstNode doLoop(AstNode condition, AstNode body) {
    DoLoop loop = new DoLoop();
    loop.setCondition(condition);
    loop.setBody(body);
    return loop;
}
Also used : DoLoop(org.mozilla.javascript.ast.DoLoop)

Example 2 with DoLoop

use of org.mozilla.javascript.ast.DoLoop in project HL4A by HL4A.

the class Parser method doLoop.

private DoLoop doLoop() throws IOException {
    if (currentToken != Token.DO)
        codeBug();
    consumeToken();
    int pos = ts.tokenBeg, end;
    DoLoop pn = new DoLoop(pos);
    pn.setLineno(ts.lineno);
    enterLoop(pn);
    try {
        AstNode body = statement();
        mustMatchToken(Token.WHILE, "msg.no.while.do");
        pn.setWhilePosition(ts.tokenBeg - pos);
        ConditionData data = condition();
        pn.setCondition(data.condition);
        pn.setParens(data.lp - pos, data.rp - pos);
        end = getNodeEnd(body);
        pn.setBody(body);
    } finally {
        exitLoop();
    }
    // world, see bug 238945
    if (matchToken(Token.SEMI)) {
        end = ts.tokenEnd;
    }
    pn.setLength(end - pos);
    return pn;
}
Also used : DoLoop(org.mozilla.javascript.ast.DoLoop) AstNode(org.mozilla.javascript.ast.AstNode)

Aggregations

DoLoop (org.mozilla.javascript.ast.DoLoop)2 AstNode (org.mozilla.javascript.ast.AstNode)1