Examples of NNode


Examples of org.python.indexer.ast.NNode

        assertNotNull("failed to load file", ast);
        assertEquals("module has wrong name", "hello", ast.name);
        assertNotNull("AST has no body", ast.body);
        assertNotNull("AST body has no children", ast.body.seq);
        assertEquals("wrong number of children", 1, ast.body.seq.size());
        NNode e = ast.body.seq.get(0);
        assertTrue("Incorrect AST: " + e.getClass(), e instanceof NExprStmt);
        e = ((NExprStmt)e).value;
        assertTrue("Incorrect AST: " + e.getClass(), e instanceof NStr);
        assertEquals("Wrong string content", "Hello", ((NStr)e).n.toString());
    }
View Full Code Here

Examples of org.python.indexer.ast.NNode

            "def foo(): pass");
        assertFunctionBinding("deco.foo");
        NModule m = idx.getAstForFile("deco.py");
        assertNotNull(m);

        NNode obj = m.body.seq.get(0);
        assertTrue(obj instanceof NFunctionDef);
        NFunctionDef f = (NFunctionDef)obj;
        List<NNode> decos = f.getDecoratorList();
        assertNotNull(decos);
        assertEquals(2, decos.size());
View Full Code Here

Examples of org.python.indexer.ast.NNode

        return styles;
    }

    @Override
    public boolean visit(NName n) {
        NNode parent = n.getParent();
        if (parent instanceof NFunctionDef) {
            NFunctionDef fn = (NFunctionDef)parent;
            if (n == fn.name) {
                addStyle(n, StyleRun.Type.FUNCTION);
            } else if (n == fn.kwargs || n == fn.varargs) {
View Full Code Here

Examples of org.python.indexer.ast.NNode

            name = ((NStr)node).n.toString();
        } else {
            throw new IllegalArgumentException("I don't know what " + node + " is.");
        }

        NNode parent = node.getParent();
        if ((parent instanceof NAttribute)
            && node == ((NAttribute)parent).attr) {
            markAsAttribute();
        }
    }
View Full Code Here

Examples of org.python.indexer.ast.NNode

    private List<NNode> convertListExpr(List<expr> in) throws Exception {
        List<NNode> out = new ArrayList<NNode>(in == null ? 0 : in.size());
        if (in != null) {
            for (expr e : in) {
                @SuppressWarnings("unchecked")
                NNode nx = (NNode)e.accept(this);
                if (nx != null) {
                    out.add(nx);
                }
            }
View Full Code Here

Examples of org.python.indexer.ast.NNode

    private NBlock convertListStmt(List<stmt> in) throws Exception {
        List<NNode> out = new ArrayList<NNode>(in == null ? 0 : in.size());
        if (in != null) {
            for (stmt e : in) {
                @SuppressWarnings("unchecked")
                NNode nx = (NNode)e.accept(this);
                if (nx != null) {
                    out.add(nx);
                }
            }
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.