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

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


            case JJTBEGIN_DECORATOR:
                ret = new decoratorsType(null, null, null, null, null, false);
                break;

            case JJTIF_STMT:
                ret = new If(null, null, null);
                break;

            case JJTAUG_PLUS:
                ret = new AugAssign(null, AugAssign.Add, null);
                break;
View Full Code Here


                forStmt.body = body;
                forStmt.orelse = orelseSuite;
                return forStmt;

            case JJTBEGIN_ELIF_STMT:
                return new If(null, null, null);

            case JJTIF_STMT:
                return handleIfConstruct(n, arity);

            case JJTEXEC_STMT:
View Full Code Here

        body = suite.body;
        test = (exprType) stack.popNode();
        arity--;

        //make the if
        If last;
        if (arity == 0) {
            //last If found
            last = (If) n;
        } else {
            last = (If) stack.popNode();
View Full Code Here

            afterNode(orelse);
        }

        if (node.orelse != null && node.orelse.body != null && node.orelse.body.length > 0) {
            if (node.orelse.body.length == 1 && node.orelse.body[0] instanceof If) {
                If if1 = (If) node.orelse.body[0];
                if (if1.test == null) {
                    visitOrElsePart(node.orelse, "else", 0);
                } else {
                    boolean foundIf = false;
                    if (if1.specialsBefore != null) {
View Full Code Here

        if (node instanceof For) {
            For module = (For) node;
            return module.body;
        }
        if (node instanceof If) {
            If module = (If) node;
            return module.body;
        }
        if (node instanceof Suite) {
            Suite module = (Suite) node;
            return module.body;
View Full Code Here

    @Override
    protected void doAddNode(ASTEntry entry) {
        ASTEntry parent = entry.parent;
        if (entry.node instanceof If) {
            If entryIf = (If) entry.node;

            //treat elifs
            if (parent != null && parent.node instanceof If) {
                If parentIf = (If) parent.node;
                if (parentIf.orelse != null && parentIf.orelse.body != null && parentIf.orelse.body.length > 0
                        && parentIf.orelse.body[0] == entryIf) {
                    parent.endLine = entry.node.beginLine - 1;
                    if (entry.parent != null) {
                        entry.parent = entry.parent.parent;
View Full Code Here

    protected void after(ASTEntry entry) {
        super.after(entry);

        //if we just added a node, we have to check if it's an If that has an ending else...
        if (entry.node instanceof If) {
            If entryIf = (If) entry.node;
            checkElse(entryIf, entry);
        }
    }
View Full Code Here

        //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]));

                generatedIf.beginLine = firstOrElseStmt.beginLine - 1;
                generatedIf.beginColumn = 1;
View Full Code Here

        }

        if (node.orelse != null && ((Suite) node.orelse).body != null && ((Suite) node.orelse).body.length > 0) {
            stmtType[] body = ((Suite) node.orelse).body;
            if (body.length == 1 && body[0] instanceof If) {
                If if1 = (If) body[0];
                if (if1.test == null) {
                    visitOrElsePart(node.orelse, "else");
                } else {
                    boolean foundIf = false;
                    if (if1.specialsBefore != null) {
View Full Code Here

        assertEquals(1, body.length);
        ClassDef classFound = (ClassDef) body[0];
        body = classFound.body;
        assertEquals(1, body.length);
        FunctionDef func = (FunctionDef) body[0];
        If ifFound = (If) func.body[0];
        assertEquals(6, ifFound.orelse.beginLine);

    }
View Full Code Here

TOP

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

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.