Example #1
0
def include_markup_commands(cursor):
    """Harvest markup command definitions from included files."""
    includeargs = ly.parse.includeargs(itertools.chain.from_iterable(tokens(cursor)))
    dinfo = documentinfo.info(cursor.document())
    fname = cursor.document().url().toLocalFile()
    files = fileinfo.includefiles(fname, dinfo.includepath(), includeargs)
    return itertools.chain.from_iterable(fileinfo.FileInfo.info(f).markup_commands() for f in files)
Example #2
0
    def includefiles(self):
        """Returns a set of filenames that are included by this document.

        The document's own filename is not added to the set.
        The configured include path is used to find files.
        Included files are checked recursively, relative to our file,
        relative to the including file, and if that still yields no file, relative
        to the directories in the includepath().

        This method uses caching for both the document contents and the other files.

        """
        return fileinfo.includefiles(self.lydocinfo(), self.includepath())
Example #3
0
def include_identifiers(cursor):
    """Harvests identifier definitions from included files."""
    def tokens():
        end = cursor.block()
        block = cursor.document().firstBlock()
        while block < end:
            yield tokeniter.tokens(block)
            block = block.next()
    
    includeargs = ly.parse.includeargs(itertools.chain.from_iterable(tokens()))
    dinfo = documentinfo.info(cursor.document())
    fname = cursor.document().url().toLocalFile()
    files = fileinfo.includefiles(fname, dinfo.includepath(), includeargs)
    return itertools.chain.from_iterable(fileinfo.FileInfo.info(f).names()
                                         for f in files)
Example #4
0
 def includefiles(self):
     """Returns a set of filenames that are included by the given document.
     
     The document's own filename is not added to the set.
     The configured include path is used to find files.
     Included files are checked recursively, relative to our (master) file,
     relative to the including file, and if that still yields no file, relative
     to the directories in the includepath().
     
     This method uses caching for both the document contents and the other files.
     
     """
     filename = self.master()
     includeargs = None
     if not filename:
         filename = self.document().url().toLocalFile()
         if not filename:
             return set()
         includeargs = self.includeargs()
     files = fileinfo.includefiles(filename, self.includepath(), includeargs)
     return files
Example #5
0
def include_markup_commands(cursor):
    """Harvest markup command definitions from included files."""
    dinfo = documentinfo.info(cursor.document())
    files = fileinfo.includefiles(get_docinfo(cursor), dinfo.includepath())
    return itertools.chain.from_iterable(
        fileinfo.docinfo(f).markup_definitions() for f in files)
Example #6
0
def include_identifiers(cursor):
    """Harvests identifier definitions from included files."""
    dinfo = documentinfo.info(cursor.document())
    files = fileinfo.includefiles(get_docinfo(cursor), dinfo.includepath())
    return itertools.chain.from_iterable(
        fileinfo.docinfo(f).definitions() for f in files)
Example #7
0
def include_markup_commands(cursor):
    """Harvest markup command definitions from included files."""
    dinfo = documentinfo.info(cursor.document())
    files = fileinfo.includefiles(get_docinfo(cursor), dinfo.includepath())
    return itertools.chain.from_iterable(fileinfo.docinfo(f).markup_definitions()
                                         for f in files)
Example #8
0
def include_identifiers(cursor):
    """Harvests identifier definitions from included files."""
    dinfo = documentinfo.info(cursor.document())
    files = fileinfo.includefiles(get_docinfo(cursor), dinfo.includepath())
    return itertools.chain.from_iterable(fileinfo.docinfo(f).definitions()
                                         for f in files)