Examples of stmtType


Examples of org.python.parser.ast.stmtType

        String tmp_append = "_[" + (++list_comprehension_count) + "]";

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

        stmtType n = new Expr(new Call(new Name(tmp_append, Name.Load, node), new exprType[] { node.elt },
                new keywordType[0], null, null, node), node);

        for (int i = node.generators.length - 1; i >= 0; i--) {
            listcompType lc = node.generators[i];
            for (int j = lc.ifs.length - 1; j >= 0; j--) {
View Full Code Here

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

                        //the scope where it's in and print that scope.
                        FastStack<SimpleNode> scopeStack = def.scope.getScopeStack();
                        if (scopeStack != null && scopeStack.size() > 0) {
                            SimpleNode peek = scopeStack.peek();
                            if (peek != null) {
                                stmtType stmt = NodeUtils.findStmtForNode(peek, astToPrint);
                                if (stmt != null) {
                                    astToPrint = stmt;
                                }
                            }
                        }
View Full Code Here

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

            };
        }
        String delimiter = PySelection.getDelimiter(document);

        PyAstFactory factory = new PyAstFactory(new AdapterPrefs(delimiter, versionProvider));
        stmtType overrideBody = factory.createOverrideBody(this.functionDef, parentClassName, currentClassName); //Note that the copy won't have a parent.

        FunctionDef functionDef = this.functionDef.createCopy(false);
        functionDef.body = new stmtType[] { overrideBody != null ? overrideBody : new Pass() };

        try {
View Full Code Here

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

        return null;
    }

    public static Str getNodeDocStringNode(SimpleNode node) {
        Str s = null;
        stmtType body[] = null;
        if (node instanceof FunctionDef) {
            FunctionDef def = (FunctionDef) node;
            body = def.body;
        } else if (node instanceof ClassDef) {
            ClassDef def = (ClassDef) node;
View Full Code Here

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

        SimpleNode leafTestNode = null;

        SimpleNode last = node;
        for (String s : StringUtils.dotSplit(path)) {

            stmtType found = null;
            for (stmtType n : NodeUtils.getBody(last)) {
                if (s.equals(NodeUtils.getRepresentationString(n))) {
                    found = n;
                    last = n;
                    break;
View Full Code Here

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

                node.traverse(this);
            }
        };
        stmtType[] body = getBody(source);

        stmtType last = null;
        for (stmtType stmtType : body) {
            if (stmtType.beginLine > ast.beginLine) {
                //already passed the possible statement, check the last one (which is the last statement that
                //has a beginLine <= ast.beginLine) and return even if we didn't find it, as we already passed the
                //target line.
                if (last != null) {
                    return checkNode(v, last);
                }
            }
            if (stmtType.beginLine == ast.beginLine) {
                //If we have a case in the same line, we must also check it. Don't mark it as last in this case as we've
                //already checked it.
                stmtType n = checkNode(v, stmtType);
                if (n != null) {
                    return n;
                }
            } else {
                last = stmtType;
View Full Code Here

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

     * Check if the passed if has an else... If it has, generate a 'fake' If entry for it (so that it's gotten later)
     */
    private void checkElse(If entryIf, ASTEntry parentIf) {
        //treat elses
        if (entryIf.orelse != null && entryIf.orelse.body != null && entryIf.orelse.body.length > 0) {
            stmtType firstOrElseStmt = entryIf.orelse.body[0];

            if (!(firstOrElseStmt instanceof If) && firstOrElseStmt != null) {
                If generatedIf = new If(new BoolOp(BoolOp.And, new exprType[0]), new stmtType[0], new Suite(
                        new stmtType[0]));

View Full Code Here

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

        }

        try {
            int len = body.length;
            for (int i = 0; i < len; i++) {
                stmtType b = body[i];
                if (b != null) {
                    b.accept(visitor);
                }
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

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

                List<stmtType> peek = stackBody.peek();

                if (newStmt instanceof FunctionDef) {
                    int size = peek.size();
                    if (size > 0) {
                        stmtType existing = peek.get(size - 1);
                        if (existing.beginColumn < newStmt.beginColumn) {
                            //we don't want to add a method inside a method at this point.
                            //all the items added should have the same column.
                            return;
                        }
                    }
                } else if (newStmt instanceof Assign) {
                    Assign assign = (Assign) newStmt;
                    exprType target = assign.targets[0];

                    //an assign could be in a method or in a class depending on where we're right now...
                    int size = peek.size();
                    if (size > 0) {
                        stmtType existing = peek.get(size - 1);
                        if (existing.beginColumn < assign.beginColumn) {
                            //add the assign to the correct place
                            if (existing instanceof FunctionDef) {
                                FunctionDef functionDef = (FunctionDef) existing;
View Full Code Here

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

                        //the scope where it's in and print that scope.
                        FastStack<SimpleNode> scopeStack = def.scope.getScopeStack();
                        if (scopeStack != null && scopeStack.size() > 0) {
                            SimpleNode peek = scopeStack.peek();
                            if (peek != null) {
                                stmtType stmt = NodeUtils.findStmtForNode(peek, astToPrint);
                                if (stmt != null) {
                                    astToPrint = stmt;
                                }
                            }
                        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.