How to use the ford.reader.FortranReader function in FORD

To help you get started, we’ve selected a few FORD examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
self.name = os.path.basename(self.path)
        self.settings = settings
        self.fixed = fixed
        self.parent = None
        self.modules = []
        self.submodules = []
        self.functions = []
        self.subroutines = []
        self.programs = []
        self.blockdata = []
        self.doc = []
        self.hierarchy = []
        self.obj = 'sourcefile'
        self.display = settings['display']

        source = ford.reader.FortranReader(self.path,settings['docmark'],
                    settings['predocmark'],settings['docmark_alt'],
                    settings['predocmark_alt'],fixed,preprocessor,
                    settings['macro'],settings['include'])

        FortranContainer.__init__(self,source,"")
        readobj = open(self.path,'r')
        self.raw_src = readobj.read()
        if self.fixed:
            self.src = highlight(self.raw_src,FortranFixedLexer(),
                                 HtmlFormatter(lineanchors='ln', cssclass='hl'))
        else:
            self.src = highlight(self.raw_src,FortranLexer(),
                                 HtmlFormatter(lineanchors='ln', cssclass='hl'))
github Fortran-FOSS-Programmers / ford / ford / reader.py View on Github external
def include(self):
        """
        If the next line is an include statement, inserts the contents
        of the included file into the pending buffer.
        """
        if len(self.pending) == 0 or not self.pending[0].startswith('include '):
            return
        name = self.pending.pop(0)[8:].strip()[1:-1]
        for b in [os.path.dirname(self.name)] + self.inc_dirs:
            pname = os.path.abspath(os.path.expanduser(os.path.join(b, name)))
            if os.path.isfile(pname):
                name = pname
                break
        else:
            raise Exception('Can not find include file "{}".'.format(name))
        self.pending = list(FortranReader(name, self.docmark, self.predocmark, 
                                          self.docmark_alt, self.predocmark_alt,
                                          self.fixed, self.length_limit,
                                          inc_dirs=self.inc_dirs)) + self.pending
github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
self.name = os.path.basename(self.path)
        self.settings = settings
        self.fixed = fixed
        self.parent = None
        self.modules = []
        self.submodules = []
        self.functions = []
        self.subroutines = []
        self.programs = []
        self.blockdata = []
        self.doc = []
        self.hierarchy = []
        self.obj = 'sourcefile'
        self.display = settings['display']

        source = ford.reader.FortranReader(self.path,settings['docmark'],
                    settings['predocmark'],settings['docmark_alt'],
                    settings['predocmark_alt'],fixed,
                    settings['fixed_length_limit'].lower()=='true',preprocessor,
                    settings['macro'],settings['include'])

        FortranContainer.__init__(self,source,"")
        readobj = open(self.path,'r')
        self.raw_src = readobj.read()
        if self.fixed:
            self.src = highlight(self.raw_src,FortranFixedLexer(),
                                 HtmlFormatter(lineanchors='ln', cssclass='hl'))
        else:
            self.src = highlight(self.raw_src,FortranLexer(),
                                 HtmlFormatter(lineanchors='ln', cssclass='hl'))
github Fortran-FOSS-Programmers / ford / ford / reader.py View on Github external
for b in [os.path.dirname(self.name)] + self.inc_dirs:
            pname = os.path.abspath(os.path.expanduser(os.path.join(b, name)))
            if os.path.isfile(pname):
                name = pname
                break
        else:
            raise Exception('Can not find include file "{}".'.format(name))
        self.pending = list(FortranReader(name, self.docmark, self.predocmark, 
                                          self.docmark_alt, self.predocmark_alt,
                                          self.fixed, self.length_limit,
                                          inc_dirs=self.inc_dirs)) + self.pending


if __name__ == '__main__':
    filename = sys.argv[1]
    for line in FortranReader(filename,docmark='!',predocmark='>',docmark_alt='#',predocmark_alt='<'):
        print(line)
        continue