This class allows reading a text file token by token (where tokens are separated by whitespace), while still allowing to skip complete lines where needed. More...
Public Member Functions | |
| def | __init__ (self, file) |
| The constructor accepts an open file object. More... | |
| def | next (self) |
| This function returns the next token in the file, skipping white space (including line endings) as needed. More... | |
| def | skipHeaderLines (self) |
| This function skips any lines that start with a '#' character. More... | |
| def | skipLine (self) |
| This function skips tokens as follows. More... | |
| def | skipToEndOfLine (self) |
| This function skips any remaining tokens on the current line (without advancing to the next line). More... | |
Public Attributes | |
| file | |
| line | |
This class allows reading a text file token by token (where tokens are separated by whitespace), while still allowing to skip complete lines where needed.
| def pts.storedtable.tokenizedfile.TokenizedFile.__init__ | ( | self, | |
| file | |||
| ) |
The constructor accepts an open file object.
The file must be opened in text mode.
| def pts.storedtable.tokenizedfile.TokenizedFile.next | ( | self | ) |
This function returns the next token in the file, skipping white space (including line endings) as needed.
| def pts.storedtable.tokenizedfile.TokenizedFile.skipHeaderLines | ( | self | ) |
This function skips any lines that start with a '#' character.
If the current line has remaining tokens, it is skipped only if the first remaining token starts with a '#'.
| def pts.storedtable.tokenizedfile.TokenizedFile.skipLine | ( | self | ) |
This function skips tokens as follows.
If the current line has one or more remaining tokens, these tokens are skipped. Otherwise, all tokens on the next line are skipped.
| def pts.storedtable.tokenizedfile.TokenizedFile.skipToEndOfLine | ( | self | ) |
This function skips any remaining tokens on the current line (without advancing to the next line).