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

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


                "print(abstracts)\n" +
                "\n" +
                "";
        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        Assign a0 = (Assign) m.body[0];
        Assign a1 = (Assign) m.body[1];
        assertTrue(a0.value instanceof Dict);
        DictComp dictComp = (DictComp) a1.value;

        assertEquals("name", ((Name) dictComp.key).id);
        assertEquals("value", ((Name) dictComp.value).id);
View Full Code Here


    public void testUnpacking() {
        String s = "a, *b, c = range(5)";

        Module ast = (Module) parseLegalDocStr(s);
        Assign assign = (Assign) ast.body[0];
        Tuple tup = (Tuple) assign.targets[0];
        Starred starred = (Starred) tup.elts[1];
        Name name = (Name) starred.value;
        assertEquals("b", name.id);
        assertEquals(Name.Store, name.ctx);
View Full Code Here

        Name self = new Name("self", Name.Load, true);
        NameTok name = new NameTok(nodeHelper.getPrivateAttr(attributeName), NameTok.Attrib);
        Attribute attribute = new Attribute(self, name, Attribute.Store);

        Name value = new Name("value", Name.Load, false);
        Assign assign = new Assign(new exprType[] { attribute }, value);

        return new stmtType[] { assign };
    }
View Full Code Here

    public Assign createAssign(exprType... targetsAndVal) {
        exprType[] targets = new exprType[targetsAndVal.length - 1];
        System.arraycopy(targetsAndVal, 0, targets, 0, targets.length);
        exprType value = targetsAndVal[targetsAndVal.length - 1];
        return new Assign(targets, value);
    }
View Full Code Here

                String s = "a = 10\n" +
                        "a.";

                Tuple<SimpleNode, Throwable> tup = parseILegalDocSuccessfully(s);
                Module m = (Module) tup.o1;
                Assign assign = (Assign) m.body[0];
                assertNotNull(assign);
                Expr expr = (Expr) m.body[1];
                Attribute attr = (Attribute) expr.value;
                assertEquals("a.!<MissingName>!", NodeUtils.getFullRepresentationString(attr));
                return true;
View Full Code Here

                        "";

                Tuple<SimpleNode, Throwable> tup = parseILegalDocSuccessfully(s);
                Module m = (Module) tup.o1;
                assertEquals(1, m.body.length);
                Assign assign = (Assign) m.body[0];
                assertEquals("a", NodeUtils.getRepresentationString(assign.targets[0]));
                assertEquals("[]", NodeUtils.getRepresentationString(assign.value));
                return true;
            }
        });
View Full Code Here

                        "";

                Tuple<SimpleNode, Throwable> tup = parseILegalDocSuccessfully(s);
                Module m = (Module) tup.o1;
                assertEquals(1, m.body.length);
                Assign assign = (Assign) m.body[0];
                assertEquals("a", NodeUtils.getRepresentationString(assign.targets[0]));
                assertEquals("{}", NodeUtils.getRepresentationString(assign.value));
                return true;
            }
        });
View Full Code Here

                        "";

                Tuple<SimpleNode, Throwable> tup = parseILegalDocSuccessfully(s);
                Module m = (Module) tup.o1;
                assertEquals(1, m.body.length);
                Assign assign = (Assign) m.body[0];
                assertEquals("a", NodeUtils.getRepresentationString(assign.targets[0]));
                assertEquals("{}", NodeUtils.getRepresentationString(assign.value));
                return true;
            }
        });
View Full Code Here

TOP

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

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.