CppParser
|
Parses C++ source and generates an AST. More...
#include <cppparser.h>
Public Types | |
using | ErrorHandler = std::function< void(const char *errLineText, size_t lineNum, size_t errorStartPos, int lexerContext)> |
Public Member Functions | |
CppParser (CppObjFactoryPtr objFactory=nullptr) | |
CppParser (CppParser &&rhs) | |
void | addKnownMacro (std::string knownMacro) |
void | addKnownMacros (const std::vector< std::string > &knownMacros) |
void | addDefinedName (std::string definedName, int value=0) |
void | addUndefinedName (std::string undefinedName) |
void | addUndefinedNames (const std::vector< std::string > &undefinedNames) |
void | addIgnorableMacro (std::string ignorableMacro) |
void | addIgnorableMacros (const std::vector< std::string > &ignorableMacros) |
void | addKnownApiDecor (std::string knownApiDecor) |
void | addKnownApiDecors (const std::vector< std::string > &knownApiDecor) |
bool | addRenamedKeyword (const std::string &keyword, std::string renamedKeyword) |
void | parseEnumBodyAsBlob () |
void | parseFunctionBodyAsBlob (bool asBlob) |
CppCompoundPtr | parseFile (const std::string &filename) |
CppCompoundPtr | parseString (const std::string &filePathToSave, const std::string &content) |
CppCompoundPtr | parseString (const std::string &content) |
CppCompoundPtr | parseStream (char *stm, size_t stmSize) |
void | setErrorHandler (ErrorHandler errorHandler) |
void | resetErrorHandler () |
Private Attributes | |
CppObjFactoryPtr | objFactory_ |
Parses C++ source and generates an AST.
Definition at line 39 of file cppparser.h.
using CppParser::ErrorHandler = std::function<void(const char* errLineText, size_t lineNum, size_t errorStartPos, int lexerContext)> |
Definition at line 42 of file cppparser.h.
CppParser::CppParser | ( | CppObjFactoryPtr | objFactory = nullptr | ) |
Definition at line 54 of file cppparser.cpp.
|
inline |
Definition at line 47 of file cppparser.h.
void CppParser::addDefinedName | ( | std::string | definedName, |
int | value = 0 |
||
) |
Definition at line 72 of file cppparser.cpp.
void CppParser::addIgnorableMacro | ( | std::string | ignorableMacro | ) |
Definition at line 88 of file cppparser.cpp.
void CppParser::addIgnorableMacros | ( | const std::vector< std::string > & | ignorableMacros | ) |
Definition at line 93 of file cppparser.cpp.
void CppParser::addKnownApiDecor | ( | std::string | knownApiDecor | ) |
Definition at line 99 of file cppparser.cpp.
void CppParser::addKnownApiDecors | ( | const std::vector< std::string > & | knownApiDecor | ) |
Definition at line 104 of file cppparser.cpp.
void CppParser::addKnownMacro | ( | std::string | knownMacro | ) |
Definition at line 61 of file cppparser.cpp.
void CppParser::addKnownMacros | ( | const std::vector< std::string > & | knownMacros | ) |
Definition at line 66 of file cppparser.cpp.
bool CppParser::addRenamedKeyword | ( | const std::string & | keyword, |
std::string | renamedKeyword | ||
) |
Definition at line 110 of file cppparser.cpp.
void CppParser::addUndefinedName | ( | std::string | undefinedName | ) |
Definition at line 77 of file cppparser.cpp.
void CppParser::addUndefinedNames | ( | const std::vector< std::string > & | undefinedNames | ) |
Definition at line 82 of file cppparser.cpp.
void CppParser::parseEnumBodyAsBlob | ( | ) |
Definition at line 121 of file cppparser.cpp.
CppCompoundPtr CppParser::parseFile | ( | const std::string & | filename | ) |
Definition at line 131 of file cppparser.cpp.
void CppParser::parseFunctionBodyAsBlob | ( | bool | asBlob | ) |
Definition at line 126 of file cppparser.cpp.
CppCompoundPtr CppParser::parseStream | ( | char * | stm, |
size_t | stmSize | ||
) |
CppCompoundPtr CppParser::parseString | ( | const std::string & | content | ) |
CppCompoundPtr CppParser::parseString | ( | const std::string & | filePathToSave, |
const std::string & | content | ||
) |
Definition at line 141 of file cppparser.cpp.
void CppParser::resetErrorHandler | ( | ) |
Definition at line 167 of file cppparser.cpp.
void CppParser::setErrorHandler | ( | ErrorHandler | errorHandler | ) |
Definition at line 162 of file cppparser.cpp.
|
private |
Definition at line 82 of file cppparser.h.