mirror of
https://github.com/pocoproject/poco.git
synced 2025-05-02 23:42:29 +02:00
fix(CppParser): parsing of function template parameters and namespace imports
This commit is contained in:
parent
ba2c6cf839
commit
3bb76f51ad
@ -216,6 +216,18 @@ const Token* Parser::parseNameSpace(const Token* pNext)
|
|||||||
_access = Symbol::ACC_PUBLIC;
|
_access = Symbol::ACC_PUBLIC;
|
||||||
std::string name = pNext->tokenString();
|
std::string name = pNext->tokenString();
|
||||||
pNext = next();
|
pNext = next();
|
||||||
|
|
||||||
|
if (isOperator(pNext, OperatorToken::OP_ASSIGN))
|
||||||
|
{
|
||||||
|
pNext = next();
|
||||||
|
while (!isOperator(pNext, OperatorToken::OP_SEMICOLON) && !isEOF(pNext))
|
||||||
|
{
|
||||||
|
pNext = next();
|
||||||
|
}
|
||||||
|
if (!isEOF(pNext)) pNext = next();
|
||||||
|
return pNext;
|
||||||
|
}
|
||||||
|
|
||||||
expectOperator(pNext, OperatorToken::OP_OPENBRACE, "{");
|
expectOperator(pNext, OperatorToken::OP_OPENBRACE, "{");
|
||||||
|
|
||||||
std::string fullName = currentNameSpace()->fullName();
|
std::string fullName = currentNameSpace()->fullName();
|
||||||
@ -591,11 +603,18 @@ const Token* Parser::parseVarFunc(const Token* pNext, std::string& decl)
|
|||||||
{
|
{
|
||||||
append(decl, pNext);
|
append(decl, pNext);
|
||||||
pNext = next();
|
pNext = next();
|
||||||
bool isOp = false;
|
bool isOperatorKeyword = false;
|
||||||
while (!isOperator(pNext, OperatorToken::OP_SEMICOLON) && !isOperator(pNext, OperatorToken::OP_OPENPARENT) && !isEOF(pNext))
|
int tmplDepth = 0;
|
||||||
|
while (!isOperator(pNext, OperatorToken::OP_SEMICOLON) && !(tmplDepth == 0 && isOperator(pNext, OperatorToken::OP_OPENPARENT)) && !isEOF(pNext))
|
||||||
{
|
{
|
||||||
|
if (!isOperatorKeyword && isOperator(pNext, OperatorToken::OP_LT))
|
||||||
|
tmplDepth++;
|
||||||
|
else if (!isOperatorKeyword && isOperator(pNext, OperatorToken::OP_GT) && tmplDepth > 0)
|
||||||
|
tmplDepth--;
|
||||||
|
else if (!isOperatorKeyword && isOperator(pNext, OperatorToken::OP_SHR) && tmplDepth > 1)
|
||||||
|
tmplDepth -= 2;
|
||||||
append(decl, pNext);
|
append(decl, pNext);
|
||||||
isOp = isKeyword(pNext, IdentifierToken::KW_OPERATOR);
|
isOperatorKeyword = isKeyword(pNext, IdentifierToken::KW_OPERATOR);
|
||||||
pNext = next();
|
pNext = next();
|
||||||
}
|
}
|
||||||
if (isOperator(pNext, OperatorToken::OP_SEMICOLON))
|
if (isOperator(pNext, OperatorToken::OP_SEMICOLON))
|
||||||
@ -611,7 +630,7 @@ const Token* Parser::parseVarFunc(const Token* pNext, std::string& decl)
|
|||||||
}
|
}
|
||||||
else if (isOperator(pNext, OperatorToken::OP_OPENPARENT))
|
else if (isOperator(pNext, OperatorToken::OP_OPENPARENT))
|
||||||
{
|
{
|
||||||
if (isOp)
|
if (isOperatorKeyword)
|
||||||
{
|
{
|
||||||
decl += " (";
|
decl += " (";
|
||||||
pNext = next();
|
pNext = next();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user