• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DoLoop类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中org.mozilla.javascript.ast.DoLoop的典型用法代码示例。如果您正苦于以下问题:Java DoLoop类的具体用法?Java DoLoop怎么用?Java DoLoop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DoLoop类属于org.mozilla.javascript.ast包,在下文中一共展示了DoLoop类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: transformDoLoop

点赞 3

import org.mozilla.javascript.ast.DoLoop; //导入依赖的package包/类
private Node transformDoLoop(DoLoop loop) {
    loop.setType(Token.LOOP);
    pushScope(loop);
    try {
        decompiler.addToken(Token.DO);
        decompiler.addEOL(Token.LC);
        Node body = transform(loop.getBody());
        decompiler.addToken(Token.RC);
        decompiler.addToken(Token.WHILE);
        decompiler.addToken(Token.LP);
        Node cond = transform(loop.getCondition());
        decompiler.addToken(Token.RP);
        decompiler.addEOL(Token.SEMI);
        return createLoop(loop, LOOP_DO_WHILE,
                          body, cond, null, null);
    } finally {
        popScope();
    }
}
 

开发者ID:MikaGuraN,
项目名称:HL4A,
代码行数:20,
代码来源:IRFactory.java

示例2: doLoop

点赞 2

import org.mozilla.javascript.ast.DoLoop; //导入依赖的package包/类
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();
    }
    // Always auto-insert semicolon to follow SpiderMonkey:
    // It is required by ECMAScript but is ignored by the rest of
    // world, see bug 238945
    if (matchToken(Token.SEMI)) {
        end = ts.tokenEnd;
    }
    pn.setLength(end - pos);
    return pn;
}
 

开发者ID:MikaGuraN,
项目名称:HL4A,
代码行数:31,
代码来源:Parser.java

示例3: print

点赞 2

import org.mozilla.javascript.ast.DoLoop; //导入依赖的package包/类
private void print(DoLoop node) throws IOException {
    writer.append("do ").ws();
    print(node.getBody());
    writer.append("while").ws().append('(');
    print(node.getCondition());
    writer.append(");");
}
 

开发者ID:konsoletyper,
项目名称:teavm,
代码行数:8,
代码来源:AstWriter.java

示例4: processDoNode

点赞 2

import org.mozilla.javascript.ast.DoLoop; //导入依赖的package包/类
/**
 * Extract while loop from node and add new code block
 */
private void processDoNode(Node child, CodeBlock block,
		Set<Completion> set, String entered, int offset) {
	DoLoop loop = (DoLoop) child;
	if (canProcessNode(loop)) {
		offset = loop.getAbsolutePosition() + loop.getLength();
		addCodeBlock(loop.getBody(), set, entered, block, offset);
	}
}
 

开发者ID:bobbylight,
项目名称:RSTALanguageSupport,
代码行数:12,
代码来源:JavaScriptAstParser.java

示例5: visit

点赞 2

import org.mozilla.javascript.ast.DoLoop; //导入依赖的package包/类
/**
 * This method generates constraints for all relevant AstNodes. It delegates its work to various
 * processXXX() methods that handle AstNodes of type XXX.
 */
@Override
public boolean visit(AstNode node) {
	if (node instanceof VariableInitializer){
		processVariableInitializer(node);
	} else if (node instanceof ReturnStatement){
		processReturnStatement((ReturnStatement)node);
	} else if (node instanceof ExpressionStatement){
		processExpressionStatement((ExpressionStatement)node);
	} else if (node instanceof ForLoop){
		processForLoop((ForLoop)node);
	} else if (node instanceof ForInLoop){
		processForInLoop((ForInLoop)node);
	}else if (node instanceof WhileLoop){
		processWhileLoop((WhileLoop)node);
	} else if (node instanceof DoLoop){
		processDoLoop((DoLoop)node);
	} else if (node instanceof NewExpression){
		processNewExpression((NewExpression)node);
	} else if (node instanceof FunctionCall){
		processFunctionCall((FunctionCall)node);
	} else if (node instanceof ElementGet){
		processElementGet((ElementGet)node);
	} else if (node instanceof FunctionNode){
		processFunctionNode((FunctionNode)node);
	} else if (node instanceof IfStatement){
		processIfStatement((IfStatement)node);
	} else if (node instanceof KeywordLiteral){
		processKeywordLiteral((KeywordLiteral)node);
	} else if (node instanceof SwitchStatement){
		processSwitchStatement((SwitchStatement)node);
	} else if (node instanceof SwitchCase){
		processSwitchCase((SwitchCase)node);
	} else if ((node instanceof AstRoot) || //AstRoot: no constraints need to be generated
		(node instanceof BreakStatement) || //BreakStatement: no constraints need to be generated
		(node instanceof VariableDeclaration) || //VariableDeclaration: we generate constraints for its constituent VariableInitializer nodes
		(node instanceof Name) || //Name: generate constraints for complex expressions that refer to names
		(node instanceof NumberLiteral) || //NumberLiteral: generate constraints for complex expressions that refer to names
		(node instanceof StringLiteral) || //StringLiteral: generate constraints for complex expressions that refer to names
		(node instanceof Assignment) || // Assignment is a special case of InfixExpression
		(node instanceof ArrayLiteral) ||
		(node instanceof UnaryExpression) ||
		(node instanceof InfixExpression) ||
		(node instanceof ConditionalExpression) ||
		(node instanceof ParenthesizedExpression) ||
		(node instanceof EmptyExpression) ||
		(node instanceof ObjectLiteral) ||
		(node instanceof EmptyStatement) ||
		(node instanceof ContinueStatement) ||
		(node instanceof Scope) ||
		(node instanceof Block)){ // // occurs in programs with for loops -- nothing to be done here?
		/* nothing */
	} else {
		error("unsupported node " + node.toSource().trim() + " of type: " + node.getClass().getName(), node);
	}
	return true;
}
 

开发者ID:Samsung,
项目名称:SJS,
代码行数:61,
代码来源:ConstraintVisitor.java

示例6: processDoLoop

点赞 2

import org.mozilla.javascript.ast.DoLoop; //导入依赖的package包/类
/**
 * generate constraints for a do-while-statement
 */
private void processDoLoop(DoLoop w) {
	AstNode condition = w.getCondition();
	processExpression(condition);
}
 

开发者ID:Samsung,
项目名称:SJS,
代码行数:8,
代码来源:ConstraintVisitor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)