Preprocessor Class Reference
[System]
Utility for preprocessing C-like code.
More...
#include <Preprocessor.hpp>
List of all members.
Public Member Functions |
| Preprocessor () |
| Preprocessor (const string &filename) |
int | getRealLineNumber (int line) const |
string | getFileForLine (int line) const |
vector< string > | getLines () |
void | printBoundaries () |
void | printDefines () |
void | printLines () |
void | setFilename (const string &filename) |
void | start () |
Protected Member Functions |
void | addBoundary (const string &line) |
void | addLine (string &line, int lineNumber, bool &inComment) |
void | addNewLines () |
string | getPragmaKey (const string &line) |
string | getPragmaValue (const string &line) |
string | getToken (const string &line, int i) |
bool | isDefine (const string &line) |
bool | isEndIf (const string &line) |
bool | isIfNotDefined (const string &line) |
bool | isInclude (const string &line) |
bool | isPragma (const string &line) |
bool | isVersion (const string &line) |
void | load (const string &filename) |
void | onDefine (const string &line) |
void | onEndIf (const string &line) |
void | onIfNotDefined (const string &line) |
void | onInclude (const string &line) |
void | onVersion (const string &line) |
string | replaceDefines (string &line) |
bool | skipLines () |
string | stripComments (const string &line, bool &inComment) |
string | stripFirstToken (const string &line) |
string | stripQuoted (const string &line) |
string | stripTrailingSpaces (const string &line) |
Private Attributes |
map< int, string > | boundaries |
map< string, string > | defines |
stack< bool > | conditionals |
stack< string > | paths |
string | filename |
vector< string > | lines |
vector< int > | lineNumbers |
Detailed Description
Utility for preprocessing C-like code.
Basically, Preprocessor simply looks through C-like code and performs a few simple operations. First, if it finds an include directive, it replaces that line with the lines from the appropriate file. Define directives can be used to make sure this only happens once. Lastly, it strips both multiline and single line comments, as well as trailing spaces.
Constructor & Destructor Documentation
- Note:
- Use setFilename() after.
Member Function Documentation
vector< string > getLines |
( |
|
) |
[inline] |
- Returns:
- the lines of the file that are actual code.
void load |
( |
const string & |
filename |
) |
[protected] |
Loads a file into the parser's lines vector.
- Exceptions:
-
void onDefine |
( |
const string & |
line |
) |
[protected] |
- Exceptions:
-
| Exception | if the token has already been defined |
The documentation for this class was generated from the following files:
- Preprocessor.hpp
- Preprocessor.cpp