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

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


                "    args" +
                "";

        Document doc = new Document(d);
        SourceModule module = (SourceModule) AbstractModule.createModuleFromDoc("", null, doc, nature, true);
        Module ast = (Module) module.getAst();
        assertEquals(1, ast.body.length);
        ICompletionState emptyCompletionState = CompletionStateFactory.getEmptyCompletionState("args", nature,
                new CompletionCache());
        Definition[] defs = (Definition[]) module.findDefinition(emptyCompletionState, 2, 7, nature);
View Full Code Here


                    "    arg2" +
                    "";

            Document doc = new Document(d);
            SourceModule module = (SourceModule) AbstractModule.createModuleFromDoc("", null, doc, nature, true);
            Module ast = (Module) module.getAst();
            assertEquals(1, ast.body.length);
            ICompletionState emptyCompletionState = CompletionStateFactory.getEmptyCompletionState("arg2", nature,
                    new CompletionCache());
            Definition[] defs = (Definition[]) module.findDefinition(emptyCompletionState, 2, 7, nature);
View Full Code Here

                "";

        String v3 = "class C:\n" +
                "    pass#end\n" +
                "";
        Module ast = (Module) parseLegalDocStr(s);
        ClassDef d = (ClassDef) ast.body[0];
        assertEquals(1, d.specialsAfter.size());
        commentType c = (commentType) d.specialsAfter.get(0);
        assertEquals("#end", c.id);
        checkPrettyPrintEqual(s, s, s, v3);
View Full Code Here

    }

    public void testOnlyComment() {
        String s = "#end\n" +
                "";
        Module ast = (Module) parseLegalDocStr(s);
        assertEquals(1, ast.specialsBefore.size());
        commentType c = (commentType) ast.specialsBefore.get(0);
        assertEquals("#end", c.id);
        checkPrettyPrintEqual(s);
View Full Code Here

                "@classdec2\n" +
                "class A:\n" +
                "    pass\n" +
                "";
        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        ClassDef d = (ClassDef) m.body[0];
        assertEquals(2, d.decs.length);
        assertEquals("classdec", NodeUtils.getRepresentationString(d.decs[0].func));
        assertEquals("classdec2", NodeUtils.getRepresentationString(d.decs[1].func));
    }
View Full Code Here

        String s = "" +
                "mutable_set = {1,2,3,4,5}\n" +
                "";

        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        Assign assign = (Assign) m.body[0];
        Set set = (Set) assign.value;
        assertEquals(
                "Set[elts=[Num[n=1, type=Int, num=1], Num[n=2, type=Int, num=2], Num[n=3, type=Int, num=3], Num[n=4, type=Int, num=4], Num[n=5, type=Int, num=5]]]",
                set.toString());
View Full Code Here

        String s = "" +
                "mutable_set = {x for x in xrange(10)}\n" +
                "";

        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        Assign assign = (Assign) m.body[0];
        assertTrue(assign.value instanceof SetComp);
    }
View Full Code Here

        String s = "" +
                "d = {}\n" +
                "";

        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        Assign assign = (Assign) m.body[0];
        assertTrue(assign.value instanceof Dict);
    }
View Full Code Here

        String s = "" +
                "d = {i: i*2 for i in range(3)}\n" +
                "";

        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        Assign assign = (Assign) m.body[0];
        assertTrue(assign.value instanceof DictComp);
    }
View Full Code Here

        assertTrue(s.endsWith(base));
        assertTrue(s.startsWith(FileUtils.BOM_UTF8));

        assertEquals("utf-8", FileUtils.getPythonFileEncoding(file));
        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        Pass p = (Pass) m.body[0];

        assertTrue(s.startsWith(FileUtils.BOM_UTF8));

        ast = parseLegalDocStr(s);
View Full Code Here

TOP

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

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.