@@ -112,6 +112,7 @@ struct commentcnvYY_state
112
112
QCString incPrefix;
113
113
114
114
QCString aliasString;
115
+ int aliasLines = 0 ;
115
116
int blockCount = 0 ;
116
117
bool lastEscaped = FALSE ;
117
118
int lastBlockContext= 0 ;
@@ -778,7 +779,7 @@ SLASHopt [/]*
778
779
BEGIN (Scan);
779
780
}
780
781
}
781
- <CComment,CNComment>\n { /* new line in comment */
782
+ <CComment,CNComment>\n { /* new line in comment */
782
783
copyToOutput (yyscanner,yytext,yyleng);
783
784
/* in case of Fortran always end of comment */
784
785
if (yyextra->lang ==SrcLangExt::Fortran)
@@ -1075,7 +1076,7 @@ SLASHopt [/]*
1075
1076
<CondLine>\n |
1076
1077
<CondLine>. { // forgot section id?
1077
1078
handleCondSectionId (yyscanner," " ); // fake section id causing the section to be hidden unconditionally
1078
- if (*yytext==' \n ' ) { yyextra-> lineNr ++; copyToOutput (yyscanner," \n " ,1 );}
1079
+ if (*yytext==' \n ' ) { copyToOutput (yyscanner," \n " ,1 );}
1079
1080
}
1080
1081
<CComment,ReadLine,IncludeFile>[\\@][a-z_A-Z][a-z_A-Z0-9 -]* { // expand alias without arguments
1081
1082
replaceAliases (yyscanner,yytext);
@@ -1084,9 +1085,12 @@ SLASHopt [/]*
1084
1085
yyextra->lastBlockContext =YY_START;
1085
1086
yyextra->blockCount =1 ;
1086
1087
yyextra->aliasString =yytext;
1088
+ yyextra->aliasLines =0 ;
1087
1089
yyextra->lastEscaped =0 ;
1088
1090
BEGIN ( ReadAliasArgs );
1089
1091
}
1092
+ <ReadAliasArgs>^[ \t]*" *" { // skip leading *
1093
+ }
1090
1094
<ReadAliasArgs>^[ \t]*{CPPC}[/!]/[^\n]+ { // skip leading special comments (see bug 618079)
1091
1095
}
1092
1096
<ReadAliasArgs>{CCE} { // oops, end of comment in the middle of an alias?
@@ -1111,8 +1115,8 @@ SLASHopt [/]*
1111
1115
yyextra->aliasString +=yytext;
1112
1116
}
1113
1117
<ReadAliasArgs>\n {
1114
- yyextra->aliasString +=' ' ;
1115
- yyextra->lineNr ++;
1118
+ yyextra->aliasString +=" " ;
1119
+ yyextra->aliasLines ++;
1116
1120
yyextra->lastEscaped =FALSE ;
1117
1121
}
1118
1122
<ReadAliasArgs>" {" {
@@ -1507,13 +1511,19 @@ static void replaceAliases(yyscan_t yyscanner,std::string_view s)
1507
1511
return;
1508
1512
}
1509
1513
std::string result = resolveAliasCmd(s);
1510
- //printf("replaceAliases(%s)->' %s' \n ",qPrint(s),qPrint(result));
1514
+ //printf("replaceAliases(%s)->' %s' lines=%d \n ",qPrint(s),qPrint(result),yyextra->aliasLines );
1511
1515
if (result!=s)
1512
1516
{
1513
1517
yyextra->expandedAliases.insert(cmd);
1514
1518
result += " \\ ialias{";
1515
1519
result += cmd;
1516
1520
result += "}";
1521
+ if (yyextra->aliasLines>0)
1522
+ {
1523
+ yyextra->lineNr+=yyextra->aliasLines;
1524
+ //printf("yyextra->lineNr=%d\n ",yyextra->lineNr);
1525
+ result += std::string{"\\ ifile \" "}+yyextra->fileName.str()+"\" \\ iline "+std::to_string(yyextra->lineNr)+" ";
1526
+ }
1517
1527
for (int i=(int)result.length()-1;i>=0;i--) unput(result[i]);
1518
1528
}
1519
1529
else
@@ -1582,6 +1592,7 @@ void convertCppComments(const BufStr &inBuf,BufStr &outBuf,const QCString &fileN
1582
1592
yyextra->lang = getLanguageFromFileName(fileName);
1583
1593
yyextra->pythonDocString = FALSE;
1584
1594
yyextra->lineNr = 1;
1595
+ yyextra->aliasLines = 0;
1585
1596
yyextra->expandedAliases.clear();
1586
1597
while (!yyextra->condStack.empty()) yyextra->condStack.pop();
1587
1598
clearCommentStack(yyscanner);
0 commit comments