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

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


            return null;
        }
        stmtType[] body = astNode.body;

        if (body.length > 0 && body[0] instanceof Expr) {
            Expr expr = (Expr) body[0];
            return expr.value;
        }
        return null;
    }
View Full Code Here


                        for (stmtType b : def.body) {
                            if (b instanceof Pass) {
                                continue;
                            }
                            if (b instanceof Expr) {
                                Expr expr = (Expr) b;
                                if (expr.value instanceof Str) {
                                    continue;
                                }
                            }
                            addMessage = true;
View Full Code Here

            returnValue = new Tuple(returnList.toArray(new exprType[0]), Tuple.Load, false);

        } else if (body.size() == 1) {
            // return expression as-is (note: body must be cleared)
            if (body.get(0) instanceof Expr) {
                Expr expression = (Expr) body.get(0);
                returnValue = expression.value;
                body.clear();
            }
        }
View Full Code Here

            case JJTSUITE:
                stmtType[] stmts = new stmtType[arity];
                for (int i = arity - 1; i >= 0; i--) {
                    SimpleNode yield_or_stmt = stack.popNode();
                    if (yield_or_stmt instanceof Yield) {
                        stmts[i] = new Expr((Yield) yield_or_stmt);

                    } else {
                        try {
                            stmts[i] = (stmtType) yield_or_stmt;
                        } catch (ClassCastException e) {
View Full Code Here

        argumentsType args = new argumentsType(argsExpr, varArg, kwArg, null, null, null, null, null, null, null);

        //constructorCalls
        List<stmtType> body = new ArrayList<stmtType>();
        for (IClassDefAdapter base : bases) {
            Expr init = extractConstructorInit(base);
            if (init != null) {
                body.add(init);
            }
        }
View Full Code Here

                if (init.getArguments().hasKwArg()) {
                    kwArg = new Name(KWARGS, Name.Load, false);
                }

                Call initCall = new Call(classInit, argExp, null, varArg, kwArg);
                return new Expr(initCall);
            }
        }
        return null;
    }
View Full Code Here

            SimpleNode node = stack.popNode();
            try {
                stmts[i] = (stmtType) node;
            } catch (ClassCastException e) {
                if (node instanceof Yield) {
                    stmts[i] = new Expr((Yield) node); //recover from it with a valid node!
                    String msg = "Error. Found yield out of scope.";
                    final ParseException e2 = new ParseException(msg, node);
                    this.stack.getGrammar().addAndReport(e2, msg);
                } else {
                    recoverFromClassCastException(node, e);
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 (ast instanceof Module) {
                            Module module = (Module) ast;
                            if (module.body != null && module.body.length > 0) {
                                ast = module.body[module.body.length - 1];
                                if (ast instanceof Expr) {
                                    Expr expr = (Expr) ast;
                                    ast = expr.value;
                                    if (ast instanceof Call) {
                                        Call call = (Call) ast;
                                        String callRep = NodeUtils.getRepresentationString(call);
                                        if (callRep != null && callRep.equals("__bootstrap__")) {
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.