Skip to content

Commit 636ed0f

Browse files
committed
issue doxygen#12035 using ignored when attribute or comment between identifier and =
Handling of comment etc. "inside" an `using` statement. Special handling is required in case the "name and "=" sign are not handled with the same rule (the other cases need a new variable, that is now added slightly delayed)
1 parent 3a9ec57 commit 636ed0f

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

src/scanner.l

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ struct scannerYY_state
211211

212212
ClangTUParser *clangParser = nullptr;
213213

214+
bool usingNewVarNeeded = false;
215+
214216
int fakeNS = 0; //<! number of file scoped namespaces in CSharp file
215217
TextStream dummyTextStream;
216218

@@ -2059,9 +2061,7 @@ NONLopt [^\n]*
20592061
yyextra->current->fileName = yyextra->fileName;
20602062
yyextra->current->section = EntryType::makeUsingDecl();
20612063
yyextra->current->startLine = yyextra->yyLineNr;
2062-
yyextra->previous = yyextra->current;
2063-
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2064-
initEntry(yyscanner);
2064+
yyextra->usingNewVarNeeded = true;
20652065
if (yyextra->insideCS) /* Hack: in C# a using declaration and
20662066
directive have the same syntax, so we
20672067
also add it as a using directive here
@@ -2090,6 +2090,42 @@ NONLopt [^\n]*
20902090
storeClangId(yyscanner,yyextra->current->name.data());
20912091
BEGIN(ReadInitializer);
20922092
}
2093+
<Using>";" {
2094+
if (yyextra->usingNewVarNeeded)
2095+
{
2096+
yyextra->previous = yyextra->current;
2097+
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2098+
initEntry(yyscanner);
2099+
yyextra->usingNewVarNeeded = false;
2100+
}
2101+
BEGIN(FindMembers);
2102+
}
2103+
<Using>{BN}*"=" {
2104+
yyextra->lastInitializerContext = UsingAlias;
2105+
yyextra->sharpCount=0;
2106+
yyextra->initBracketCount=0;
2107+
storeClangId(yyscanner,yyextra->current->name.data());
2108+
yyextra->usingNewVarNeeded = false;
2109+
BEGIN(ReadInitializer);
2110+
}
2111+
<Using>{B}*{CCS} {
2112+
yyextra->lastCContext = YY_START ;
2113+
BEGIN( SkipComment ) ;
2114+
}
2115+
<Using>{B}*{CPPC} {
2116+
yyextra->lastCContext = YY_START ;
2117+
BEGIN( SkipCxxComment ) ;
2118+
}
2119+
<Using>{B}*
2120+
<Using>. {
2121+
if (yyextra->usingNewVarNeeded)
2122+
{
2123+
yyextra->previous = yyextra->current;
2124+
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2125+
initEntry(yyscanner);
2126+
yyextra->usingNewVarNeeded = false;
2127+
}
2128+
}
20932129
<UsingAlias>";" {
20942130
yyextra->current->section = EntryType::makeVariable();
20952131
QCString init = yyextra->current->initializer.str();
@@ -2115,9 +2151,9 @@ NONLopt [^\n]*
21152151
yyextra->current->section = EntryType::makeUsingDir();
21162152
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
21172153
initEntry(yyscanner);
2154+
yyextra->usingNewVarNeeded = false;
21182155
BEGIN(Using);
21192156
}
2120-
<Using>";" { BEGIN(FindMembers); }
21212157
<FindMembers>{SCOPENAME}{BN}*"<>" { // guided template decl
21222158
QCString n=yytext;
21232159
addType(yyscanner);

0 commit comments

Comments
 (0)