Package org.python.indexer

Examples of org.python.indexer.Def


        }
        return null;
    }

    public void assertDefinition(String qname, int offset, int length) throws Exception {
        Def def = getDefinition(qname, offset, length);
        if (def == null) {
            fail("No definition for " + qname + " at " + offset + " of len " + length);
        }
    }
View Full Code Here


            fail("No definition for " + qname + " at " + offset + " of len " + length);
        }
    }

    public void assertNoDefinition(String msg, String qname, int pos, int len) throws Exception {
        Def def = getDefinition(qname, pos, len);
        assertNull(msg, def);
    }
View Full Code Here

     * the AST.
     * @param def the binding's main definition node
     * @param b the binding
     */
    private void addSemanticStyles(NBinding nb) {
        Def def = nb.getSignatureNode();
        if (def == null || !def.isName()) {
            return;
        }

        boolean isConst = CONSTANT.matcher(def.getName()).matches();
        switch (nb.getKind()) {
            case SCOPE:
                if (isConst) {
                    addSemanticStyle(def, StyleRun.Type.CONSTANT);
                }
View Full Code Here

    /**
     * Create name anchors for definition sites.
     */
    private void processDefs(NBinding nb) {
        Def def = nb.getSignatureNode();
        if (def == null || def.isURL()) {
            return;
        }
        StyleRun style = new StyleRun(StyleRun.Type.ANCHOR, def.start(), def.length());
        style.message = nb.getQname();
        style.url = nb.getQname();
        addFileStyle(def.getFile(), style);
    }
View Full Code Here

     * Generate a URL for a reference to a binding.
     * @param nb the referenced binding
     * @param path the path containing the reference, or null if there was an error
     */
    private String toURL(NBinding nb, String path) {
        Def def = nb.getSignatureNode();
        if (def == null) {
            return null;
        }
        if (nb.isBuiltin()) {
            return def.getURL();
        }

        if (def.isModule()) {
            return toModuleUrl(nb);
        }

        String anchor = "#" + nb.getQname();
        if (nb.getFirstFile().equals(path)) {
            return anchor;
        }

        String destPath = def.getFile();
        try {
            String relpath = destPath.substring(rootPath.length());
            return Util.joinPath(outDir.getAbsolutePath(), relpath) + ".html" + anchor;
        } catch (Exception x) {
            System.err.println("path problem:  dest=" + destPath + ", root=" + rootPath + ": " + x);
View Full Code Here

        }
        NBinding all = getTable().lookupLocal("__all__");
        if (all== null) {
            return exports;
        }
        Def def = all.getSignatureNode();
        if (def == null) {
            return exports;
        }
        NNode __all__ = getDeepestNodeAtOffset(def.start());
        if (!(__all__ instanceof NName)) {
            return exports;
        }
        NNode assign = __all__.getParent();
        if (!(assign instanceof NAssign)) {
View Full Code Here

TOP

Related Classes of org.python.indexer.Def

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.