Examples of NModuleType


Examples of org.python.indexer.types.NModuleType

     * @param path the file for which to build the outline
     * @return a list of entries constituting the file outline.
     * Returns an empty list if the indexer hasn't indexed that path.
     */
    public List<Entry> generate(Indexer idx, String abspath) throws Exception {
        NModuleType mt = idx.getModuleForFile(abspath);
        if (mt == null) {
            return new ArrayList<Entry>();
        }
        return generate(mt.getTable(), abspath);
    }
View Full Code Here

Examples of org.python.indexer.types.NModuleType

    public NType resolve(Scope s) throws Exception {
        setType(name.setType(new NUnknownType()));

        // Check for top-level native or standard module.
        if (isUnqualified()) {
            NModuleType mt = Indexer.idx.loadModule(name.id);
            if (mt != null) {
                return setType(name.setType(mt));
            }
        } else {
            // Check for second-level builtin such as "os.path".
            NModuleType mt = Indexer.idx.getBuiltinModule(thisQname());
            if (mt != null) {
                setType(name.setType(mt));
                resolveExpr(next, s);
                return mt;
            }
View Full Code Here

Examples of org.python.indexer.types.NModuleType

        return resolveInFilesystem(s);
    }

    private NType resolveInFilesystem(Scope s) throws Exception {
        NModuleType start = getStartModule(s);
        if (start == null) {
            reportUnresolvedModule();
            return getType();
        }

        String qname = start.getTable().getPath();
        String relQname;
        if (isDot()) {
            relQname = Util.getQnameParent(qname);
        } else if (!isTop()) {
            relQname = qname + "." + name.id;
        } else {
            // top name:  first look in current dir, then sys.path
            String dirQname = isInitPy() ? qname : Util.getQnameParent(qname);
            relQname = dirQname + "." + name.id;
            if (Indexer.idx.loadModule(relQname) == null) {
                relQname = name.id;
            }
        }

        NModuleType mod = Indexer.idx.loadModule(relQname);
        if (mod == null) {
            reportUnresolvedModule();
            return getType();
        }
        setType(name.setType(mod));

        if (!isTop() && mod.getFile() != null) {
            Scope parentPkg = getPrevious().getTable();
            NBinding mb = Indexer.idx.moduleTable.lookup(mod.getFile());
            parentPkg.put(name.id, mb);
        }

        resolveExpr(next, s);
        return getType();
View Full Code Here

Examples of org.python.indexer.types.NModuleType

            return getPrevious().getType().asModuleType();
        }

        // Start with module for current file (i.e. containing directory).

        NModuleType start = null;
        Scope mtable = s.getSymtabOfType(Scope.Type.MODULE);
        if (mtable != null) {
            start = Indexer.idx.loadModule(mtable.getPath());
            if (start != null) {
                return start;
View Full Code Here

Examples of org.python.indexer.types.NModuleType

        NType bottomType = qname.getBottom().getType();
        if (!bottomType.isModuleType()) {
            return setType(new NUnknownType());
        }
        NModuleType mt = (NModuleType)bottomType;
        setType(mt);

        NImport.addReferences(s, qname, false /* don't put top name in scope */);

        if (isImportStar()) {
View Full Code Here

Examples of org.python.indexer.types.NModuleType

        NBinding entry = mt.getTable().lookup(a.name);

        if (entry == null) {
            // Possibility 3:  try looking for x/y/foo.py
            String mqname = qname.toQname() + "." + a.qname.toQname();
            NModuleType mt2 = Indexer.idx.loadModule(mqname);
            if (mt2 != null) {
                entry = Indexer.idx.lookupQname(mt2.getTable().getPath());
            }
        }
        if (entry == null) {
            addError(a, "name " + a.qname.getName().id
                     + " not found in module " + this.module);
View Full Code Here

Examples of org.python.indexer.types.NModuleType

            addFunction("confstr", liburl(a), BaseStr);
        }

        private void initOsPathModule() {
            NModuleType m = newModule("path");
            Scope ospath = m.getTable();
            ospath.setPath("os.path")// make sure global qnames are correct

            update("path", newLibUrl("os.path.html#module-os.path"), m, MODULE);

            String[] str_funcs = {
View Full Code Here

Examples of org.python.indexer.types.NModuleType

        nativeTypes.add(t);
        return t;
    }

    NModuleType newModule(String name) {
        NModuleType mt = new NModuleType(name, null, globaltable);
        nativeTypes.add(mt);
        return mt;
    }
View Full Code Here

Examples of org.python.indexer.types.NModuleType

        public ExceptionsModule() {
            super("exceptions");
        }
        @Override
        public void initBindings() {
            NModuleType builtins = get("__builtin__");
            for (String s : builtin_exception_types) {
                NBinding b = builtins.getTable().lookup(s);
                table.update(b.getName(), b.getSignatureNode(), b.getType(), b.getKind());
            }
        }
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.