summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/doxygen.cpp6
-rw-r--r--src/pyscanner.l32
2 files changed, 25 insertions, 13 deletions
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index d589555..e4ec017 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -1671,7 +1671,6 @@ static void buildNamespaceList(const Entry *root)
nd->setName(fullName); // change name to match docs
nd->addSectionsToDefinition(root->anchors);
nd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
- nd->setArtificial(FALSE); // found namespace explicitly, so cannot be artificial
if (nd->getLanguage()==SrcLangExt_Unknown)
{
nd->setLanguage(root->lang);
@@ -1687,6 +1686,11 @@ static void buildNamespaceList(const Entry *root)
// file definition containing the namespace nd
FileDef *fd=root->fileDef();
+ if (nd->isArtificial())
+ {
+ nd->setArtificial(FALSE); // found namespace explicitly, so cannot be artificial
+ nd->setDefFile(root->fileName,root->startLine,root->startColumn);
+ }
// insert the namespace in the file definition
if (fd) fd->insertNamespace(nd);
addNamespaceToGroups(root,nd);
diff --git a/src/pyscanner.l b/src/pyscanner.l
index 4f331c9..bf2a914 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -1838,18 +1838,26 @@ static void parseMain(yyscan_t yyscanner, const QCString &fileName,const char *f
yyextra->moduleScope+=baseName;
}
- yyextra->current = std::make_shared<Entry>();
- initEntry(yyscanner);
- yyextra->current->name = yyextra->moduleScope;
- yyextra->current->section = Entry::NAMESPACE_SEC;
- yyextra->current->type = "namespace";
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
-
- yyextra->current_root = yyextra->current;
-
- rt->moveToSubEntryAndRefresh(yyextra->current);
+ // add namespaces for each scope
+ QCString scope = yyextra->moduleScope;
+ int startPos = 0;
+ int pos;
+ do
+ {
+ pos = scope.find("::",startPos);
+ startPos=pos+2;
+ if (pos==-1) pos=(int)scope.length();
+ yyextra->current = std::make_shared<Entry>();
+ initEntry(yyscanner);
+ yyextra->current->name = scope.left(pos);
+ yyextra->current->section = Entry::NAMESPACE_SEC;
+ yyextra->current->type = "namespace";
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current_root = yyextra->current;
+ rt->moveToSubEntryAndRefresh(yyextra->current);
+ } while (pos<(int)scope.length());
initParser(yyscanner);