Package PyFoam :: Package RunDictionary :: Module OldParsedParameterFile :: Class FoamFileParser
[show private | hide private]
[frames | no frames]

Class FoamFileParser


Class that parses a string that contains the contents of an OpenFOAM-file and bilds a nested structure of directories and lists from it
Method Summary
  __init__(self, content, debug)
  checkForList(self, c, ind)
Look-ahead to find out whether the next thing is a list
  getChar(self, c, ind)
Get the next character from a string (if there is any)
  getData(self)
Get the data structure
  getName(self, c, ind)
Gets a name for a dictionary entry
  getString(self, c, ind)
Get a quoted string and return it (including the quotes)
  getValue(self, c, ind)
Get characters up to the next white-space
  isOK(self, c, ind)
Check whether there are still characters in the string
  parseDict(self, c, ind)
Parse assuming a dictionary
  parseList(self, c, ind)
Parse a list
  parserError(self, text, c, ind)
Prints the error message of the parser and exit
  parseValue(self, c, ind)
Parse a value that ends withe semi-colon
  peekChar(self, c, ind)
  printContext(self, c, ind)
Prints the context of the current index
  rmComments(self, c)
Removes the comments from a string
  skipSpace(self, c, ind)
Skip spaces and set index to the next non-whitespace character

Method Details

__init__(self, content, debug=False)
(Constructor)

Parameters:
content - the string to be parsed
debug - output debug information during parsing

checkForList(self, c, ind)

Look-ahead to find out whether the next thing is a list

getChar(self, c, ind)

Get the next character from a string (if there is any)
Parameters:
c - the string
ind - the current index
Returns:
the character (empty string if past the end) and the new index

getData(self)

Get the data structure

getName(self, c, ind)

Gets a name for a dictionary entry
Returns:
name and index of the next char after it

getString(self, c, ind)

Get a quoted string and return it (including the quotes)

getValue(self, c, ind)

Get characters up to the next white-space

isOK(self, c, ind)

Check whether there are still characters in the string

parseDict(self, c, ind)

Parse assuming a dictionary
Parameters:
c - the string that is to be parsed
ind - index of the next chatacter to analyze

parseList(self, c, ind)

Parse a list

parserError(self, text, c, ind)

Prints the error message of the parser and exit

parseValue(self, c, ind)

Parse a value that ends withe semi-colon

printContext(self, c, ind)

Prints the context of the current index

rmComments(self, c)

Removes the comments from a string

skipSpace(self, c, ind)

Skip spaces and set index to the next non-whitespace character
Returns:
The index of the next non-whitespace character

Generated by Epydoc 2.1 on Mon Jan 22 23:52:48 2007 http://epydoc.sf.net