File Information
Library: CppParser
Package: Attributes
Header: Poco/CppParser/AttributesParser.h
Description
A parser for POCO-style C++ attributes.
Using a special comment syntax, C++ declarations for structs/classes, functions, types, etc. can be annotated with attributes.
Attributes always come immediately before the symbol that is being annotated, and are written inside special comments with the syntax:
//@ <attrDecl>[,<attrDec>...]
where <attrDecl> is
<name>[=<value>]
<name> is a valid C++ identifier, or two identifiers separated by a period (struct accessor notation). <value> is a string, integer, identifier, bool literal, or a complex value in the form
{<name>=<value>[,<name>=<value>...]}
Member Summary
Member Functions: isEOF, isIdentifier, isLiteral, isOperator, next, parse, parseAttribute, parseAttributes, parseComplexAttribute, parseIdentifier, setAttribute
Constructors
AttributesParser
AttributesParser(
Attributes & attrs,
std::istream & istr
);
Creates the AttributesParser.
Destructor
~AttributesParser
~AttributesParser();
Destroys the AttributesParser.
Member Functions
parse
void parse();
Parses attributes.
isEOF
static bool isEOF(
const Poco::Token * pToken
);
isIdentifier
static bool isIdentifier(
const Poco::Token * pToken
);
isLiteral
static bool isLiteral(
const Poco::Token * pToken
);
isOperator
static bool isOperator(
const Poco::Token * pToken,
int kind
);
next
const Poco::Token * next();
parseAttribute
const Poco::Token * parseAttribute(
const Poco::Token * pNext
);
parseAttributes
const Poco::Token * parseAttributes(
const Poco::Token * pNext
);
parseComplexAttribute
const Poco::Token * parseComplexAttribute(
const Token * pNext,
const std::string & id
);
parseIdentifier
const Poco::Token * parseIdentifier(
const Poco::Token * pNext,
std::string & id
);
setAttribute
void setAttribute(
const std::string & name,
const std::string & value
);