@@ -59,6 +59,7 @@ typedef yyguts_t *yyscan_t;
59
59
#include " parserintf.h"
60
60
#include " reflist.h"
61
61
#include " section.h"
62
+ #include " regex.h"
62
63
#include " util.h"
63
64
#include " reflist.h"
64
65
#include " trace.h"
@@ -469,6 +470,7 @@ struct commentscanYY_state
469
470
QCString anchorTitle;
470
471
QCString htmlAnchorStr;
471
472
bool htmlAnchor = false ;
473
+ bool CScode = false ;
472
474
};
473
475
474
476
@@ -529,12 +531,14 @@ IMG [iI][mM][gG]
529
531
HR [hH][rR]
530
532
PARA [pP][aA][rR][aA]
531
533
CODE [cC][oO][dD][eE]
534
+ ENDCODE " /" {CODE}
532
535
CAPTION [cC][aA][pP][tT][iI][oO][nN]
533
536
CENTER [cC][eE][nN][tT][eE][rR]
534
537
DIV [dD][iI][vV]
535
538
DETAILS [dD][eE][tT][aA][iI][lL][sS ]
536
539
DETAILEDHTML {CENTER}|{DIV}|{PRE}|{UL}|{TABLE}|{OL}|{DL}|{P}|[Hh][1 -6 ]|{IMG}|{HR}|{PARA}
537
540
DETAILEDHTMLOPT {CODE}
541
+ DETAILEDHTMLOPTEND {ENDCODE}
538
542
SUMMARY [sS ][uU][mM ][mM ][aA][rR][yY]
539
543
REMARKS [rR][eE][mM ][aA][rR][kK ][sS ]
540
544
AHTML [aA]{BN}*
@@ -668,7 +672,35 @@ STopt [^\n@\\]*
668
672
// continue with the same input
669
673
REJECT;
670
674
}
671
- <Comment >" <" {DETAILEDHTMLOPT }{ATTR }" >" { // HTML command that ends a brief description
675
+ <Comment >" <" {DETAILEDHTMLOPT }" >" { // HTML <code> command that ends a brief description
676
+ // without attributes
677
+ if (yyextra->current ->lang ==SrcLangExt_CSharp)
678
+ {
679
+ yyextra->CScode =true ;
680
+ setOutput (yyscanner,OutputDoc);
681
+ addOutput (yyscanner," @code{cs}" );
682
+ }
683
+ else
684
+ {
685
+ // continue with the same input
686
+ REJECT;
687
+ }
688
+ }
689
+ <Comment >" <" {DETAILEDHTMLOPTEND }" >" { // HTML command that ends a brief description
690
+ if (yyextra->CScode )
691
+ {
692
+ addOutput (yyscanner," @endcode" );
693
+ yyextra->CScode =false ;
694
+ }
695
+ else
696
+ {
697
+ yyextra->CScode =false ;
698
+ // continue with the same input
699
+ REJECT;
700
+ }
701
+ }
702
+ <Comment >" <" {DETAILEDHTMLOPT }{ATTR }" >" { // HTML <code> command that ends a brief description
703
+ // with attributes, so cannot be CS.
672
704
if (yyextra->current ->lang ==SrcLangExt_CSharp)
673
705
{
674
706
setOutput (yyscanner,OutputDoc);
@@ -1065,7 +1097,7 @@ STopt [^\n@\\]*
1065
1097
yyextra->briefEndsAtDot =FALSE ;
1066
1098
}
1067
1099
}
1068
- <Comment >{DOCNL } { // newline
1100
+ <Comment >{DOCNL } { // newline
1069
1101
addOutput (yyscanner,yytext);
1070
1102
if (*yytext == ' \n ' ) yyextra->lineNr ++;
1071
1103
}
@@ -3847,29 +3879,52 @@ static inline void setOutput(yyscan_t yyscanner,OutputContext ctx)
3847
3879
yyextra->pOutputString = &yyextra->current ->doc ;
3848
3880
break ;
3849
3881
case OutputBrief:
3850
- if (oldContext!=yyextra->inContext )
3851
3882
{
3852
- if (yyextra->current ->brief .isEmpty ()) yyextra->current ->briefLine = yyextra->lineNr ;
3853
- if (yyextra->current ->briefFile .isEmpty ())
3883
+ if (oldContext!=yyextra->inContext )
3854
3884
{
3855
- yyextra->current ->briefFile = yyextra->fileName ;
3856
- yyextra->current ->briefLine = yyextra->lineNr ;
3885
+ if (yyextra->current ->brief .isEmpty ()) yyextra->current ->briefLine = yyextra->lineNr ;
3886
+ if (yyextra->current ->briefFile .isEmpty ())
3887
+ {
3888
+ yyextra->current ->briefFile = yyextra->fileName ;
3889
+ yyextra->current ->briefLine = yyextra->lineNr ;
3890
+ }
3857
3891
}
3858
- }
3859
- if (yyextra->current ->brief .stripWhiteSpace ().isEmpty ()) // we only want one brief
3860
- // description even if multiple
3861
- // are given...
3862
- {
3863
- yyextra->pOutputString = &yyextra->current ->brief ;
3864
- }
3865
- else
3866
- {
3867
- if (!yyextra->current ->doc .isEmpty ()) // when appending parts add a new line
3892
+ bool foundMatch = false ;
3893
+ if (yyextra->current ->brief .stripWhiteSpace ().isEmpty ()) // we only want one brief
3894
+ // description even if multiple
3895
+ // are given...
3896
+ {
3897
+ foundMatch = true ;
3898
+ }
3899
+ else
3900
+ {
3901
+ static const reg::Ex nonBrief (R"( *[\\@]ifile *\"[^\"]*\" *[\\@]ilinebr *[\\@]iline *(\d+) *[\\@]ilinebr *([\n]?))" );
3902
+ std::string str = yyextra->current ->brief .str ();
3903
+ reg::Match match;
3904
+ if (reg::match (str,match,nonBrief)) // match found
3905
+ {
3906
+ if (QCString (match[2 ].str ()) == " \n " )
3907
+ {
3908
+ yyextra->current ->brief = yyextra->current ->brief .left (yyextra->current ->brief .length ()-1 );
3909
+ // set warning line correct
3910
+ yyextra->current ->brief += " \\ iline " + QCString ().setNum (1 + static_cast <int >(std::stoul (match[1 ].str ()))) + " \\ ilinebr " ;
3911
+ }
3912
+ foundMatch = true ;
3913
+ }
3914
+ }
3915
+ if (foundMatch)
3916
+ {
3917
+ yyextra->pOutputString = &yyextra->current ->brief ;
3918
+ }
3919
+ else
3868
3920
{
3869
- yyextra->current ->doc += " \n " ;
3921
+ if (!yyextra->current ->doc .isEmpty ()) // when appending parts add a new line
3922
+ {
3923
+ yyextra->current ->doc += " \n " ;
3924
+ }
3925
+ yyextra->pOutputString = &yyextra->current ->doc ;
3926
+ yyextra->inContext = OutputDoc; // need to switch to detailed docs, see bug 631380
3870
3927
}
3871
- yyextra->pOutputString = &yyextra->current ->doc ;
3872
- yyextra->inContext = OutputDoc; // need to switch to detailed docs, see bug 631380
3873
3928
}
3874
3929
break ;
3875
3930
case OutputXRef:
0 commit comments