Search in sources :

Example 1 with WithStatement

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

the class Parser method withStatement.

private WithStatement withStatement() throws IOException {
    if (currentToken != Token.WITH)
        codeBug();
    consumeToken();
    Comment withComment = getAndResetJsDoc();
    int lineno = ts.lineno, pos = ts.tokenBeg, lp = -1, rp = -1;
    if (mustMatchToken(Token.LP, "msg.no.paren.with"))
        lp = ts.tokenBeg;
    AstNode obj = expr();
    if (mustMatchToken(Token.RP, "msg.no.paren.after.with"))
        rp = ts.tokenBeg;
    AstNode body = statement();
    WithStatement pn = new WithStatement(pos, getNodeEnd(body) - pos);
    pn.setJsDocNode(withComment);
    pn.setExpression(obj);
    pn.setStatement(body);
    pn.setParens(lp, rp);
    pn.setLineno(lineno);
    return pn;
}
Also used : Comment(org.mozilla.javascript.ast.Comment) WithStatement(org.mozilla.javascript.ast.WithStatement) AstNode(org.mozilla.javascript.ast.AstNode)

Aggregations

AstNode (org.mozilla.javascript.ast.AstNode)1 Comment (org.mozilla.javascript.ast.Comment)1 WithStatement (org.mozilla.javascript.ast.WithStatement)1