HWRF  trunk@4391
Public Member Functions | Public Attributes | List of all members
confdoc.parsefile Class Reference

Config file parser. More...

Detailed Description

Config file parser.

Parses comment blocks as described in the confdoc.

Definition at line 565 of file confdoc.py.

Inheritance diagram for confdoc.parsefile:

Public Member Functions

def __init__
 Opens the specified file, prepares to parse. More...
 
def eot (self)
 Have we run out of lines to parse?
 
def match (self, pattern)
 Calls re.match(pattern,...) on the current line, returning the result. More...
 
def parse (self)
 Loops over all lines, parsing text and sending the result to global variables. More...
 
def readoption (self, name)
 Reads later lines of a multi-line option=value assignment. More...
 
def readblock (self)
 Reads the second and later lines of a multi-line comment block. More...
 

Public Attributes

 doc
 
 lines
 
 iline
 Current line number counting from 0.
 
 basename
 Basename of the current file.
 
 doxified
 The basename with "." replaced with "_".
 
 brief
 Brief portion of description that has not yet been assigned to an option or section. More...
 
 detail
 Detailed portion of description that has not yet been assigned to an option or section. More...
 
 section
 Section being parsed.
 
 value
 

Constructor & Destructor Documentation

def confdoc.parsefile.__init__ (   self,
  filename,
  doc,
  maxread = 500000 
)

Opens the specified file, prepares to parse.

Only the first maxread bytes are read.

Parameters
filenamethe *.conf file to read
docthe docbase object to receive documentation
maxreadmaximum number of lines to read

Definition at line 568 of file confdoc.py.

Member Function Documentation

def confdoc.parsefile.match (   self,
  pattern 
)

Calls re.match(pattern,...) on the current line, returning the result.

Parameters
patternargument to re.match: the pattern to match

Definition at line 607 of file confdoc.py.

Referenced by confdoc.parsefile.parse(), confdoc.parsefile.readblock(), and confdoc.parsefile.readoption().

def confdoc.parsefile.parse (   self)

Loops over all lines, parsing text and sending the result to global variables.

Definition at line 615 of file confdoc.py.

Referenced by hwrf.input.DataCatalog.locate().

def confdoc.parsefile.readblock (   self)

Reads the second and later lines of a multi-line comment block.

Assumes data is already in the self.brief variable.

Definition at line 735 of file confdoc.py.

Referenced by confdoc.parsefile.parse().

def confdoc.parsefile.readoption (   self,
  name 
)

Reads later lines of a multi-line option=value assignment.

Parameters
namethe option name

Definition at line 719 of file confdoc.py.

Referenced by confdoc.parsefile.parse().

Member Data Documentation

confdoc.parsefile.brief

Brief portion of description that has not yet been assigned to an option or section.

Definition at line 580 of file confdoc.py.

Referenced by confdoc.parsefile.parse(), confdoc.parsefile.readblock(), and confdoc.parsefile.readoption().

confdoc.parsefile.detail

Detailed portion of description that has not yet been assigned to an option or section.

Definition at line 581 of file confdoc.py.

Referenced by confdoc.parsefile.parse(), confdoc.parsefile.readblock(), and confdoc.parsefile.readoption().


The documentation for this class was generated from the following file: