Poco::CppParser

class Parser

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 protected

void addSymbol(
    Symbol * pSymbol,
    int lineNumber,
    bool addGST = true
);

append protected static

static void append(
    std::string & decl,
    const std::string & token
);

append protected static

static void append(
    std::string & decl,
    const Poco::Token * pToken
);

currentNameSpace protected

NameSpace * currentNameSpace() const;

expectOperator protected static

static void expectOperator(
    const Poco::Token * pToken,
    int kind,
    const std::string & msg
);

isEOF protected static

static bool isEOF(
    const Poco::Token * pToken
);

isIdentifier protected static

static bool isIdentifier(
    const Poco::Token * pToken
);

isKeyword protected static

static bool isKeyword(
    const Poco::Token * pToken,
    int kind
);

isOperator protected static

static bool isOperator(
    const Poco::Token * pToken,
    int kind
);

next protected

const Poco::Token * next();

nextPreprocessed protected

const Poco::Token * nextPreprocessed();

nextToken protected

const Poco::Token * nextToken();

parseAccess protected

const Poco::Token * parseAccess(
    const Poco::Token * pNext
);

parseAttributes protected

const Poco::Token * parseAttributes(
    const Poco::Token * pNext,
    std::string & attrs
);

parseBaseClassList protected

const Poco::Token * parseBaseClassList(
    const Poco::Token * pNext,
    Struct * pClass
);

parseBlock protected

const Poco::Token * parseBlock(
    const Poco::Token * pNext
);

parseClass protected

const Poco::Token * parseClass(
    const Poco::Token * pNext
);

parseClass protected

const Poco::Token * parseClass(
    const Poco::Token * pNext,
    std::string & decl
);

parseClassMembers protected

const Poco::Token * parseClassMembers(
    const Poco::Token * pNext,
    Struct * pClass
);

parseEnum protected

const Poco::Token * parseEnum(
    const Poco::Token * pNext
);

parseEnumValue protected

const Poco::Token * parseEnumValue(
    const Poco::Token * pNext,
    Enum * pEnum
);

parseExtern protected

const Poco::Token * parseExtern(
    const Poco::Token * pNext
);

parseFile protected

const Poco::Token * parseFile(
    const Poco::Token * pNext
);

parseFriend protected

const Poco::Token * parseFriend(
    const Poco::Token * pNext
);

parseFunc protected

const Poco::Token * parseFunc(
    const Poco::Token * pNext,
    const std::string & attrs,
    std::string & decl
);

parseIdentifier protected

const Poco::Token * parseIdentifier(
    const Poco::Token * pNext,
    std::string & id
);

parseNameSpace protected

const Poco::Token * parseNameSpace(
    const Poco::Token * pNext
);

parseParameters protected

const Poco::Token * parseParameters(
    const Poco::Token * pNext,
    Function * pFunc
);

parseTemplate protected

const Poco::Token * parseTemplate(
    const Poco::Token * pNext
);

parseTemplateArgs protected

const Poco::Token * parseTemplateArgs(
    const Poco::Token * pNext,
    std::string & decl
);

parseTypeDef protected

const Poco::Token * parseTypeDef(
    const Poco::Token * pNext
);

parseUsing protected

const Poco::Token * parseUsing(
    const Poco::Token * pNext
);

parseVarFunc protected

const Poco::Token * parseVarFunc(
    const Poco::Token * pNext
);

parseVarFunc protected

const Poco::Token * parseVarFunc(
    const Poco::Token * pNext,
    std::string & decl
);

popNameSpace protected

void popNameSpace();

pushNameSpace protected

void pushNameSpace(
    NameSpace * pNameSpace,
    int lineNumber,
    bool addGST = true
);

syntaxError protected static

static void syntaxError(
    const std::string & msg
);

Securely control IoT edge devices from anywhere   Connect a Device