Package org.python.pydev.parser.jython.ast

Examples of org.python.pydev.parser.jython.ast.Expr


            body = def.body;

        }
        if (body != null && body.length > 0) {
            if (body[0] instanceof Expr) {
                Expr e = (Expr) body[0];
                if (e.value instanceof Str) {
                    s = (Str) e.value;
                }
            }
        }
View Full Code Here


        return col;
    }

    public static int getLineEnd(SimpleNode v) {
        if (v instanceof Expr) {
            Expr expr = (Expr) v;
            v = expr.value;
        }
        if (v instanceof ImportFrom) {
            ImportFrom f = (ImportFrom) v;
            FindLastLineVisitor findLastLineVisitor = new FindLastLineVisitor();
View Full Code Here

                if (arity > 1) {
                    exprs = makeExprs(arity - 1);
                    ctx.setStore(exprs);
                    return new Assign(exprs, value);
                } else {
                    return new Expr(value);
                }
            case JJTINDEX_OP:
                sliceType slice = (sliceType) stack.popNode();
                value = (exprType) stack.popNode();
                return new Subscript(value, slice, Subscript.Load);
View Full Code Here

                if (arity > 1) {
                    exprs = makeExprs(arity - 1);
                    ctx.setStore(exprs);
                    return new Assign(exprs, value);
                } else {
                    return new Expr(value);
                }
            case JJTINDEX_OP:
                sliceType slice = (sliceType) stack.popNode();
                value = (exprType) stack.popNode();
                return new Subscript(value, slice, Subscript.Load);
View Full Code Here

                if (arity > 1) {
                    exprs = makeExprs(arity - 1);
                    ctx.setStore(exprs);
                    return new Assign(exprs, value);
                } else {
                    return new Expr(value);
                }
            case JJTINDEX_OP:
                sliceType slice = (sliceType) stack.popNode();
                value = (exprType) stack.popNode();
                return new Subscript(value, slice, Subscript.Load);
View Full Code Here

                "    yield from a" +
                "";

        Module ast = (Module) parseLegalDocStr(s);
        FunctionDef f = (FunctionDef) ast.body[0];
        Expr e = (Expr) f.body[0];
        Yield y = (Yield) e.value;
        assertTrue("Expected yield to be a yield from.", y.yield_from);

        parseLegalDocStrWithoutTree(s);
    }
View Full Code Here

                "from methoddef import Method1\n" +
                "Method1(10, param2=20)\n" +
                "Method1(param1=10, param2=20)\n" +
                "";
        Module root = (Module) parseLegalDocStr(s);
        Expr expr = (Expr) root.body[1];
        Call call = (Call) expr.value;
        Name name = (Name) call.func;
        FindCallVisitor visitor = new FindCallVisitor(name);
        visitor.traverse(root);
        assertSame(call, visitor.getCall());
View Full Code Here

                "        Method1(param1=10, param2=20)\n" +
                "";
        Module root = (Module) parseLegalDocStr(s);
        ClassDef classDef = (ClassDef) root.body[0];
        FunctionDef funcDef = (FunctionDef) classDef.body[0];
        Expr expr = (Expr) funcDef.body[1];
        Call call = (Call) expr.value;
        Name name = (Name) call.func;
        FindCallVisitor visitor = new FindCallVisitor(name);
        visitor.traverse(root);
        assertSame(call, visitor.getCall());
View Full Code Here

    private stmtType[] createStmtArray(Object... body) {
        ArrayList<stmtType> newBody = new ArrayList<stmtType>();

        for (Object o : body) {
            if (o instanceof exprType) {
                newBody.add(new Expr((exprType) o));
            } else if (o instanceof stmtType) {
                newBody.add((stmtType) o);
            } else {
                throw new RuntimeException("Unhandled: " + o);
            }
View Full Code Here

                    keywords.toArray(new keywordType[keywords.size()]), starargs, kwargs);
        }
        if (addReturn[0]) {
            return new Return(call);
        } else {
            return new Expr(call);
        }
    }
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.jython.ast.Expr

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.