Package org.python.antlr.ast

Examples of org.python.antlr.ast.Name


    Name cantBeNoneName(Token t) {
        if (t == null || t.getText().equals("None")) {
            errorHandler.error("can't be None", new PythonTree(t));
        }
        return new Name(t, t.getText(), expr_contextType.Load);
    }
View Full Code Here


        if (sliceop != null) {
            isSlice = true;
            if (sliceop != null) {
                o = castExpr(sliceop);
            } else {
                o = new Name(sliceop, "None", expr_contextType.Load);
            }
        }

        PythonTree tok = lower;
        if (lower == null) {
View Full Code Here

                    PyObject[].class, PyCode.class, PyObject.class, PyObject[].class));
        }

        applyDecorators(node.getInternalDecorator_list());

        set(new Name(node, node.getInternalName(), expr_contextType.Store));
        return null;
    }
View Full Code Here

                loadFrame();
                defaultImportLevel();
                code.invokestatic(p(imp.class), "importOne", sig(PyObject.class, String.class,
                        PyFrame.class, Integer.TYPE));
            }
            set(new Name(a, asname, expr_contextType.Store));
        }
        return null;
    }
View Full Code Here

            int tmp = storeTop();
            for (int i = 0; i < aliases.size(); i++) {
                code.aload(tmp);
                code.iconst(i);
                code.aaload();
                set(new Name(aliases.get(i), asnames.get(i), expr_contextType.Store));
            }
            code.freeLocal(tmp);
        }
        return null;
    }
View Full Code Here

        code.ldc("append");

        code.invokevirtual(p(PyObject.class), "__getattr__", sig(PyObject.class, String.class));
        String tmp_append = "_[" + node.getLine() + "_" + node.getCharPositionInLine() + "]";

        set(new Name(node, tmp_append, expr_contextType.Store));

        java.util.List<expr> args = new ArrayList<expr>();
        args.add(node.getInternalElt());
        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));
        visit(new Delete(n, targets));

        return null;
    }
View Full Code Here

        }

        applyDecorators(node.getInternalDecorator_list());

        //Assign this new class to the given name
        set(new Name(node, node.getInternalName(), expr_contextType.Store));
        freeArray(baseArray);
        return null;
    }
View Full Code Here

            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();
            }
        }
View Full Code Here

            if (args.getInternalArgs().get(i) instanceof Tuple) {
                List<expr> targets = new ArrayList<expr>();
                targets.add(args.getInternalArgs().get(i));
                Assign ass = new Assign(args.getInternalArgs().get(i),
                    targets,
                    new Name(args.getInternalArgs().get(i), name, expr_contextType.Load));
                init_code.add(ass);
            }
        }
        if (args.getInternalVararg() != null) {
            arglist = true;
View Full Code Here

        }
        // This would be less ugly if we generated Qname nodes in the antlr ast.
        NQname out = null;
        int end = -1;
        for (int i = in.size() - 1; i >= 0; i--) {
            Name n = in.get(i);
            if (end == -1) {
                end = n.getCharStopIndex();
            }
            @SuppressWarnings("unchecked")
            NName nn = (NName)n.accept(this);
            out = new NQname(out, nn, n.getCharStartIndex(), end);
        }
        return out;
    }
View Full Code Here

TOP

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

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.