File Information
Library: CppParser
Package: CppParser
Header: Poco/CppParser/Parser.h
Description
A minimal parser for C++ (header files).
The parser reads a (preprocessed) source or header file and builds a symbol table containing as much information as the parser is able to extract from the file.
A special comment syntax is used for inline API documentation.
A comment starting with three consecutive slashes (///) contains API documentation for a symbol (class, function, typedef, enum, etc.). API documentation comments always come after the declaration, with the exception of structs and classes, where the comments are expected immediately before the opening brace.
Member Summary
Member Functions: addSymbol, append, currentNameSpace, expectOperator, isEOF, isIdentifier, isKeyword, isOperator, next, nextPreprocessed, nextToken, parse, parseAccess, parseAttributes, parseBaseClassList, parseBlock, parseClass, parseClassMembers, parseEnum, parseEnumValue, parseExtern, parseFile, parseFriend, parseFunc, parseIdentifier, parseNameSpace, parseParameters, parseTemplate, parseTemplateArgs, parseTypeDef, parseUsing, parseVarFunc, popNameSpace, pushNameSpace, syntaxError
Constructors
Parser
Parser(
NameSpace::SymbolTable & gst,
const std::string & file,
std::istream & istr
);
Creates the Parser.
Destructor
~Parser
~Parser();
Destroys the Parser.
Member Functions
parse
void parse();
Parses the file.
addSymbol
void addSymbol(
Symbol * pSymbol,
int lineNumber,
bool addGST = true
);
append
static void append(
std::string & decl,
const std::string & token
);
append
static void append(
std::string & decl,
const Poco::Token * pToken
);
currentNameSpace
NameSpace * currentNameSpace() const;
expectOperator
static void expectOperator(
const Poco::Token * pToken,
int kind,
const std::string & msg
);
isEOF
static bool isEOF(
const Poco::Token * pToken
);
isIdentifier
static bool isIdentifier(
const Poco::Token * pToken
);
isKeyword
static bool isKeyword(
const Poco::Token * pToken,
int kind
);
isOperator
static bool isOperator(
const Poco::Token * pToken,
int kind
);
next
const Poco::Token * next();
nextPreprocessed
const Poco::Token * nextPreprocessed();
nextToken
const Poco::Token * nextToken();
parseAccess
const Poco::Token * parseAccess(
const Poco::Token * pNext
);
parseAttributes
const Poco::Token * parseAttributes(
const Poco::Token * pNext,
std::string & attrs
);
parseBaseClassList
const Poco::Token * parseBaseClassList(
const Poco::Token * pNext,
Struct * pClass
);
parseBlock
const Poco::Token * parseBlock(
const Poco::Token * pNext
);
parseClass
const Poco::Token * parseClass(
const Poco::Token * pNext
);
parseClass
const Poco::Token * parseClass(
const Poco::Token * pNext,
std::string & decl
);
parseClassMembers
const Poco::Token * parseClassMembers(
const Poco::Token * pNext,
Struct * pClass
);
parseEnum
const Poco::Token * parseEnum(
const Poco::Token * pNext
);
parseEnumValue
const Poco::Token * parseEnumValue(
const Poco::Token * pNext,
Enum * pEnum
);
parseExtern
const Poco::Token * parseExtern(
const Poco::Token * pNext
);
parseFile
const Poco::Token * parseFile(
const Poco::Token * pNext
);
parseFriend
const Poco::Token * parseFriend(
const Poco::Token * pNext
);
parseFunc
const Poco::Token * parseFunc(
const Poco::Token * pNext,
const std::string & attrs,
std::string & decl
);
parseIdentifier
const Poco::Token * parseIdentifier(
const Poco::Token * pNext,
std::string & id
);
parseNameSpace
const Poco::Token * parseNameSpace(
const Poco::Token * pNext
);
parseParameters
const Poco::Token * parseParameters(
const Poco::Token * pNext,
Function * pFunc
);
parseTemplate
const Poco::Token * parseTemplate(
const Poco::Token * pNext
);
parseTemplateArgs
const Poco::Token * parseTemplateArgs(
const Poco::Token * pNext,
std::string & decl
);
parseTypeDef
const Poco::Token * parseTypeDef(
const Poco::Token * pNext
);
parseUsing
const Poco::Token * parseUsing(
const Poco::Token * pNext
);
parseVarFunc
const Poco::Token * parseVarFunc(
const Poco::Token * pNext
);
parseVarFunc
const Poco::Token * parseVarFunc(
const Poco::Token * pNext,
std::string & decl
);
popNameSpace
void popNameSpace();
pushNameSpace
void pushNameSpace(
NameSpace * pNameSpace,
int lineNumber,
bool addGST = true
);
syntaxError
static void syntaxError(
const std::string & msg
);