Package org.python.antlr.ast

Examples of org.python.antlr.ast.comprehension


        stmt n = new Expr(node, new Call(node, new Name(node, tmp_append, expr_contextType.Load),
                args,
                new ArrayList<keyword>(), null, null));

        for (int i = node.getInternalGenerators().size() - 1; i >= 0; i--) {
            comprehension lc = node.getInternalGenerators().get(i);
            for (int j = lc.getInternalIfs().size() - 1; j >= 0; j--) {
                java.util.List<stmt> body = new ArrayList<stmt>();
                body.add(n);
                n = new If(lc.getInternalIfs().get(j), lc.getInternalIfs().get(j), body,
                        new ArrayList<stmt>());
            }
            java.util.List<stmt> body = new ArrayList<stmt>();
            body.add(n);
            n = new For(lc, lc.getInternalTarget(), lc.getInternalIter(), body,
                    new ArrayList<stmt>());
        }
        visit(n);
        java.util.List<expr> targets = new ArrayList<expr>();
        targets.add(new Name(n, tmp_append, expr_contextType.Del));
View Full Code Here


        stmt n = new Expr(node, new Yield(node, node.getInternalElt()));

        expr iter = null;
        for (int i = node.getInternalGenerators().size() - 1; i >= 0; i--) {
            comprehension comp = node.getInternalGenerators().get(i);
            for (int j = comp.getInternalIfs().size() - 1; j >= 0; j--) {
                java.util.List<stmt> bod = new ArrayList<stmt>();
                bod.add(n);
                n = new If(comp.getInternalIfs().get(j), comp.getInternalIfs().get(j), bod,
                        new ArrayList<stmt>());
            }
            java.util.List<stmt> bod = new ArrayList<stmt>();
            bod.add(n);
            if (i != 0) {
                n = new For(comp, comp.getInternalTarget(), comp.getInternalIter(), bod,
                        new ArrayList<stmt>());
            } else {
                n = new For(comp, comp.getInternalTarget(), new Name(node, bound_exp,
                        expr_contextType.Load), bod, new ArrayList<stmt>());
                iter = comp.getInternalIter();
            }
        }

        java.util.List<stmt> bod = new ArrayList<stmt>();
        bod.add(n);
View Full Code Here

TOP

Related Classes of org.python.antlr.ast.comprehension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.