ford.reader module#

class ford.reader.FortranReader(filename, docmark='!', predocmark='', docmark_alt='', predocmark_alt='', fixed=False, length_limit=True, preprocessor=None, macros=None, inc_dirs=None, encoding='utf-8')#

Bases: object

An iterator which will convert a free-form Fortran source file into a format more conducive for analyzing. It does the following:

  • combine line continuations into one

  • remove any normal comments and any comments following an ampersand (line continuation)

  • if there are documentation comments preceding a piece of code, buffer them and return them after the code, but before any documentation following it

  • keep any documentation comments and, if they are at the end of a line of actual code, place them on a new line

  • removes blank lines and trailing white-space

  • split lines along semicolons

COM_RE = re.compile('^([^"\'!]|(\'[^\']*\')|("[^"]*"))*(!.*)$')#
SC_RE = re.compile('^([^;]*);(.*)$')#

If the next line is an include statement, inserts the contents of the included file into the pending buffer.