Skip to content

Commit 971da4b

Browse files
committed
issue #9736 Doxygen will not generate class information for a C# class that contains certain string combinations
Implemented the Interpolate string and Interpolated Verbatim String for C#
1 parent 299b433 commit 971da4b

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

src/scanner.l

+47-3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ struct scannerYY_state
8585
int lastClassTemplSpecContext = 0;
8686
int lastPreLineCtrlContext = 0;
8787
int lastSkipVerbStringContext = 0;
88+
int lastSkipInterpStringContext = 0;
89+
int lastSkipInterpVerbStringContext = 0;
8890
int lastCommentInArgContext = 0;
8991
int lastRawStringContext = 0;
9092
int lastCSConstraint = 0;
@@ -167,6 +169,8 @@ struct scannerYY_state
167169
TextStream *pCopyHereDocGString = 0;
168170
TextStream *pCopyRawGString = 0;
169171
TextStream *pSkipVerbString = 0;
172+
TextStream *pSkipInterpString = 0;
173+
TextStream *pSkipInterpVerbString = 0;
170174

171175
bool insideFormula = false;
172176
bool insideTryBlock = false;
@@ -253,6 +257,8 @@ BNopt {BN}*
253257
BL [ \t\r]*"\n"
254258
B [ \t]
255259
Bopt {B}*
260+
DIGIT [0-9]
261+
HEXDIGIT ({DIGIT}|[a-f]|[A-F])
256262
ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
257263
SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)(((~|!){BN}*)?{ID})
258264
TSCOPE {ID}("<"[a-z_A-Z0-9 \t\*\&,:]*">")?
@@ -367,6 +373,8 @@ NONLopt [^\n]*
367373
%x DefinePHPEnd
368374
%x OldStyleArgs
369375
%x SkipVerbString
376+
%x SkipInterpString
377+
%x SkipInterpVerbString
370378
%x ObjCMethod
371379
%x ObjCReturnType
372380
%x ObjCParams
@@ -2966,7 +2974,7 @@ NONLopt [^\n]*
29662974
yyextra->fullArgString+=yytext;
29672975
lineCount(yyscanner);
29682976
}
2969-
<ReadInitializer,ReadInitializerPtr>\" {
2977+
<ReadInitializer,ReadInitializerPtr>\" {
29702978
if (yyextra->insideIDL && yyextra->insideCppQuote)
29712979
{
29722980
BEGIN(EndCppQuote);
@@ -3880,13 +3888,48 @@ NONLopt [^\n]*
38803888
yyextra->lastSquareContext = YY_START;
38813889
BEGIN(SkipSquare);
38823890
}
3883-
<ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<\\]* { yyextra->current->program << yytext ; }
3891+
<ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<\\\$]* { yyextra->current->program << yytext ; }
38843892
<ReadBody,ReadNSBody,ReadBodyIntf>{CPPC}.* { yyextra->current->program << yytext ; }
38853893
<ReadBody,ReadNSBody,ReadBodyIntf>"#".* { if (!yyextra->insidePHP)
38863894
REJECT;
38873895
// append PHP comment.
38883896
yyextra->current->program << yytext ;
38893897
}
3898+
/* Interpolated string C# */
3899+
<CopyGString,SkipString,SkipCurly,ReadBody,ReadNSBody,ReadBodyIntf>$\" { if (!yyextra->insideCS) REJECT
3900+
yyextra->current->program << yytext ;
3901+
yyextra->pSkipInterpString = &yyextra->current->program;
3902+
yyextra->lastSkipInterpStringContext=YY_START;
3903+
BEGIN( SkipInterpString );
3904+
}
3905+
<SkipInterpString>([^"\\{}\x000D\x000A\x0085\x2028\x2029]|"{{"|"}}"|"\\'"|"\\\""|"\\\\"|"\\0"|"\\a"|"\\b"|"\\f"|"\\n"|"\\r"|"\\t"|"\\v"|"\\x"{HEXDIGIT}{HEXDIGIT}?{HEXDIGIT}?{HEXDIGIT}?|"\\"[uU]{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT})* {
3906+
*yyextra->pSkipInterpString << yytext;
3907+
}
3908+
<SkipInterpString>\" {
3909+
*yyextra->pSkipInterpString << *yytext;
3910+
BEGIN( yyextra->lastSkipInterpStringContext );
3911+
}
3912+
/* Verbatim Interpolated string C# */
3913+
<SkipCurly,ReadBody,ReadNSBody,ReadBodyIntf>$@\" { if (!yyextra->insideCS) REJECT
3914+
yyextra->current->program << yytext ;
3915+
yyextra->pSkipInterpVerbString = &yyextra->current->program;
3916+
yyextra->lastSkipInterpVerbStringContext=YY_START;
3917+
BEGIN( SkipInterpVerbString );
3918+
}
3919+
<SkipInterpVerbString>([^\"{}]|"{{"|"}}"|"\"\"")* {
3920+
*yyextra->pSkipInterpVerbString << yytext;
3921+
}
3922+
<SkipInterpString>"{"[^}]*"}" {
3923+
*yyextra->pSkipInterpString << yytext;
3924+
}
3925+
<SkipInterpVerbString>"{"[^}]*"}" {
3926+
*yyextra->pSkipInterpVerbString << yytext;
3927+
}
3928+
<SkipInterpVerbString>\" {
3929+
*yyextra->pSkipInterpVerbString << *yytext;
3930+
BEGIN( yyextra->lastSkipInterpVerbStringContext );
3931+
}
3932+
<ReadBody,ReadNSBody,ReadBodyIntf>"\$" { yyextra->current->program << yytext ; }
38903933
<ReadBody,ReadNSBody,ReadBodyIntf>@\" { yyextra->current->program << yytext ;
38913934
yyextra->pSkipVerbString = &yyextra->current->program;
38923935
yyextra->lastSkipVerbStringContext=YY_START;
@@ -5435,10 +5478,11 @@ NONLopt [^\n]*
54355478
*yyextra->pCopyRawString += yytext;
54365479
BEGIN(RawString);
54375480
}
5438-
<SkipCurly,SkipCurlyCpp>[^\n#"'@\\/{}<]+ {
5481+
<SkipCurly,SkipCurlyCpp>[^\n#"'@\\/{}<\$]+ {
54395482
lineCount(yyscanner); // for yyextra->column updates
54405483
//addToBody(yytext);
54415484
}
5485+
<SkipCurly,SkipCurlyCpp>"\$" {}
54425486
<SkipCurlyCpp>\n {
54435487
//addToBody(yytext);
54445488
lineCount(yyscanner);

0 commit comments

Comments
 (0)