716 {CMD}{CMD}[a-z_A-Z]+{B}* {
718 }
719<Comment>{CMD}{CMD}"~"[a-z_A-Z]* { // escaped command
721 }
722<Comment>{MAILADDR} { // mail address
724 }
725<Comment>"\""[^"\n]*"\"" { // quoted text
727 }
728<Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!)
730 }
731<Comment>"<"{DETAILEDHTML}{ATTR}">" { // HTML command that ends a brief description
733 int spacePos = htmlOpenTag.find(' ');
734 if (spacePos==-1) spacePos=yyleng-1;
735 QCString htmlTagName = htmlOpenTag.
mid(1,spacePos-1);
736
737 yyextra->htmlContextStack.emplace_back(htmlTagName,yyextra->inContext);
739 {
741 }
742
743 REJECT;
744 }
745<Comment>"</"{DETAILEDHTML}">" { // HTML command that ends a brief description
747 QCString htmlTagName = htmlCloseTag.
mid(2,htmlCloseTag.length()-3);
748
749 if (!yyextra->htmlContextStack.empty() &&
750 yyextra->htmlContextStack.back().tagName==htmlTagName)
751 {
753 {
754
756 }
757 yyextra->htmlContextStack.pop_back();
758 }
759 REJECT;
760 }
761<Comment>"<"{DETAILEDHTMLOPT}">" { // HTML <code> command that ends a brief description
762
763 if (yyextra->current->lang==SrcLangExt::CSharp)
764 {
765 yyextra->CScode=true;
768 }
769 else
770 {
771
772 REJECT;
773 }
774 }
775<Comment>"<"{DETAILEDHTMLOPTEND}">" { // HTML command that ends a brief description
776 if (yyextra->CScode)
777 {
779 yyextra->CScode=false;
780 }
781 else
782 {
783 yyextra->CScode=false;
784
785 REJECT;
786 }
787 }
788<Comment>"<"{DETAILEDHTMLOPT}{ATTR}">" { // HTML <code> command that ends a brief description
789
790 if (yyextra->current->lang==SrcLangExt::CSharp)
791 {
793 }
794
795 REJECT;
796 }
797<Comment>"<"{DETAILS}{ATTR}">" { // start of a HTML style details description
798 yyextra->htmlDetailsStack.push_back(0);
799 yyextra->htmlContextStack.emplace_back("details",yyextra->inContext);
801 {
803 }
805 }
806<Comment>"</"{DETAILS}">" { // end of a HTML style details description
807 if (!yyextra->htmlDetailsStack.empty())
808 {
809 yyextra->htmlDetailsStack.pop_back();
810 }
811 if (!yyextra->htmlContextStack.empty() &&
812 yyextra->htmlContextStack.back().tagName=="details")
813 {
815 {
816
818 }
819 yyextra->htmlContextStack.pop_back();
820 }
822 }
823<Comment>"<"{AHTML} { // potential start of HTML anchor, see issue 9200
824 yyextra->htmlAnchorStr = yytext;
825 yyextra->htmlAnchor = false;
826 BEGIN(HtmlA);
827 }
828<HtmlA>{ANCHTML} { // only labels that can be converted to doxygen anchor
829 yyextra->htmlAnchorStr += yytext;
831 int s=tag.find("=");
832 char c=tag[s+1];
834 if (c=='\'' || c=='"')
835 {
836 int e=tag.find(c,s+2);
837 if (e!=-1)
838 {
839 id=tag.mid(s+2,e-s-2);
841 }
842 }
843 else
844 {
845 id=tag.mid(s+1);
847 }
848 if (!id.isEmpty() && !yyextra->htmlAnchor)
849 {
850
854 yyextra->htmlAnchor = true;
855 }
856 }
857<HtmlA>("\""[^\n\"]*"\""|"'"[^\n']*"'") {
858 yyextra->htmlAnchorStr += yytext;
859 }
860<HtmlA>">"|"/>" {
861 if (!yyextra->htmlAnchor)
862 {
863 addOutput(yyscanner,yyextra->htmlAnchorStr);
865 }
866 else
867 {
868 if (yyleng == 1)
869 {
871 }
872 }
873 BEGIN(Comment);
874 }
875<HtmlA>{DOCNL} { // newline
876 yyextra->htmlAnchorStr += yytext;
877 if (*yytext == '\n') yyextra->lineNr++;
878 }
879<HtmlA>. { // catch-all for anything else
880 yyextra->htmlAnchorStr += yytext;
881 }
882<Comment>"<"{SUMMARY}">" { // start of a .NET XML style brief description
883 if (yyextra->htmlDetailsStack.empty())
884 {
886 }
887 else
888 {
890 }
891 }
892<Comment>"<"{REMARKS}">" { // start of a .NET XML style detailed description
895 }
896<Comment>"</"{SUMMARY}">" { // start of a .NET XML style detailed description
897 if (!yyextra->htmlDetailsStack.empty())
898 {
900 }
901 else
902 {
904 }
905 }
906<Comment>"</"{REMARKS}">" { // end of a brief or detailed description
909 }
910<Comment>"<"{CAPTION}{ATTR}">" {
912 int s=tag.find("id=");
913 if (s!=-1)
914 {
915 char c=tag[s+3];
916 if (c=='\'' || c=='"')
917 {
918 int e=tag.find(c,s+4);
919 if (e!=-1)
920 {
923 }
924 }
925 }
927 }
928<Comment>"<"{PRE}{ATTR}">" {
929 yyextra->insidePre=
TRUE;
931 }
932<Comment>"</"{PRE}">" {
933 yyextra->insidePre=
FALSE;
935 }
936<Comment>{RCSTAG} { // RCS tag which end a brief description
938 REJECT;
939 }
940<Comment>"<!--" {
941 BEGIN(HtmlComment);
942 }
943<Comment>"<!\[CDATA\[" {
944 BEGIN(CdataSection);
945 }
946<Comment>{B}*{CMD}"endinternal"{B}* {
948 if (!yyextra->inInternalDocs)
949 warn(yyextra->fileName,yyextra->lineNr,
950 "found \\endinternal without matching \\internal"
951 );
952 yyextra->inInternalDocs =
FALSE;
953 }
954<Comment>{B}*"\\ilinebr "{B}* { // preserve spacing around \\ilinebr
956 }
957<Comment>(\n|"\\ilinebr ")/({B}*(\n|{IFILELINE}?"\\ilinebr "))+ { // at least one blank line (or blank line command)
959 {
961 }
962 else
963 {
964 REJECT;
965 }
966 }
967<Comment>{B}*{CMD}[a-z_A-Z]+"{"[^}]*"}"{B}* |
968<Comment>{B}*{CMD}[a-z_A-Z]+{B}* { // potentially interesting command
969
971 int idx = fullMatch.
find(
'{');
972
973 if ((idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT;
974 int idxEnd = fullMatch.
find(
"}",idx+1);
977 if (idx == -1)
978 {
980 }
981 else
982 {
986 }
988
990 {
991 int i=0;
992 while (yytext[i]==' ' || yytext[i]=='\t') i++;
996 !(yyextra->inContext==
OutputXRef && cmdName==
"parblock"))
997 {
998 yyextra->briefEndsAtDot=
FALSE;
1000
1002 }
1003
1004 if (it->second.handler && it->second.handler(yyscanner, cmdName, optList))
1005 {
1006
1007
1008
1009 yyextra->parseMore=
TRUE;
std::vector< std::string > StringVector
StringVector split(const std::string &s, const std::string &delimiter)
split input string s by string delimiter delimiter.
1010
1011 yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);
1013 }
1014 else if (it->second.handler==nullptr)
1015 {
1016
1017
1019 }
1020 }
1021 else
1022 {
1024 }
1025 }
1026<Comment>{B}*({CMD}{CMD})"f"[$\[{] { // escaped formula command
1028 }
1029<Comment>{B}*{CMD}"~"[a-z_A-Z-]* { // language switch command
1033 {
1035 {
1036 warn(yyextra->fileName,yyextra->lineNr,
1038 }
1039 BEGIN(SkipLang);
1040 }
1041 }
#define Config_getEnumAsString(name)
#define Config_isAvailableEnum(name, value)
int qstricmp(const char *s1, const char *s2)
1042<Comment>{B}*{CMD}"f{"[^}\n]+"}"("{"?) { // start of a formula with custom environment
1044 yyextra->formulaText="";
1045 yyextra->formulaPreText="\\begin";
1046 yyextra->formulaPostText="";
1048 if (yyextra->formulaEnv.at(yyextra->formulaEnv.length()-1)=='{')
1049 {
1050
1051 yyextra->formulaEnv=yyextra->formulaEnv.left(yyextra->formulaEnv.length()-1);
1052 }
1053 yyextra->formulaPreText+=yyextra->formulaEnv;
1054 yyextra->formulaNewLines=0;
1055 BEGIN(ReadFormulaLong);
1056 }
1057<Comment>{B}*{CMD}"f$" { // start of a inline formula
1058 yyextra->formulaText="";
1059 yyextra->formulaPreText="$";
1060 yyextra->formulaPostText="";
1061 yyextra->formulaNewLines=0;
1062 BEGIN(ReadFormulaShort);
1063 }
1064<Comment>{B}*{CMD}"f(" { // start of a inline formula
1065 yyextra->formulaText="";
1066 yyextra->formulaPreText="";
1067 yyextra->formulaPostText="";
1068 yyextra->formulaNewLines=0;
1069 BEGIN(ReadFormulaRound);
1070 }
1071<Comment>{B}*{CMD}"f[" { // start of a block formula
1073 yyextra->formulaText="";
1074 yyextra->formulaPreText="\\[";
1075 yyextra->formulaPostText="";
1076 yyextra->formulaNewLines=0;
1077 BEGIN(ReadFormulaLong);
1078 }
1079<Comment>{B}*{CMD}"{" { // begin of a group
1080
1081 yyextra->docGroup.open(yyextra->current,yyextra->fileName,yyextra->lineNr);
1082 }
1083<Comment>{B}*{CMD}"}" { // end of a group
1084
1085 yyextra->docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,
TRUE);
1086 yyextra->docGroup.clearHeader();
1087 yyextra->parseMore=
TRUE;
1088 yyextra->needNewEntry =
TRUE;
1089 yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) + (int)strlen(yytext);
1091 }
1092<Comment>{B}*{CMD}[$@\\&~<>#%] { // escaped character
1094 }
1095<Comment>[a-z_A-Z]+ { // normal word
1097 }
1098<Comment>^{B}*"."{Bopt}/\n { // explicit end autolist: e.g " ."
1100 }
1101<Comment>^{B}*[1-9][0-9]*"."{B}+ |
1102<Comment>^{B}*[*+]{B}+ { // start of autolist
1103 if (!yyextra->markdownSupport)
1104 {
1105 REJECT;
1106 }
1107 else
1108 {
1110 {
1111 yyextra->briefEndsAtDot=
FALSE;
1113 }
1115 }
1116 }
1117<Comment>^{B}*"-"{B}+ { // start of autolist
1119 {
1120 yyextra->briefEndsAtDot=
FALSE;
1122 }
1124 }
1125<Comment>^{B}*([\-:|]{B}*)*("--"|"---")({B}*[\-:|])*{Bopt}/\n { // horizontal line (dashed)
1127 }
1128<Comment>{CMD}"---" { // escaped mdash
1130 }
1131<Comment>{CMD}"--" { // escaped mdash
1133 }
1134<Comment>"---" { // mdash
1135 addOutput(yyscanner,yyextra->insidePre || yyextra->markdownSupport ? yytext :
"—");
1136 }
1137<Comment>"--" { // ndash
1138 addOutput(yyscanner,yyextra->insidePre || yyextra->markdownSupport ? yytext :
"–");
1139 }
1140<Comment>"-#"{B}+ { // numbered item
1142 {
1143 yyextra->briefEndsAtDot=
FALSE;
1145 }
1147 }
1148<Comment>[?!][a-z_A-Z0-9\(\)=<] |
1149<Comment>("."+)[a-z_A-Z0-9\)] { // . at start or in the middle of a word, or ellipsis
1150
1152 }
1153<Comment>{CMD}[\.?!] { // we have to be a bit careful with the special commands
1154
1156 }
1157<Comment>".\\"[ \t] { // . with escaped space.
1160 }
1161<Comment>"."[,:;] { // . with some puntuations such as "e.g.," or "e.g.:"
1163 }
1164<Comment>"...\\"[ \t] { // ellipsis with escaped space.
1166 }
1167<Comment>"..."/[^\.] { // ellipsis
1169 }
1170<Comment>".."[\.]?/[^ \t\n] { // internal ellipsis
1172 }
1173<Comment>(\n|"\\ilinebr ")({B}*(\n|"\\ilinebr "))+ { // at least one blank line (or blank line command)
1175 {
1176
1178 yy_size_t i;
1179 for (i=0;i<(yy_size_t)yyleng;)
1180 {
1181 if (yytext[i]==
'\n')
addOutput(yyscanner,
'\n'),i++;
1182 else if (strncmp(yytext+i,
"\\ilinebr ",9)==0)
addOutput(yyscanner,
"\\ilinebr "),i+=9;
1183 else i++;
1184 }
1185 }
1187 {
1188 yy_size_t i;
1189 for (i=0;i<(yy_size_t)yyleng;)
1190 {
1191 if (yytext[i]==
'\n')
addOutput(yyscanner,
'\n'),i++;
1192 else if (strncmp(yytext+i,
"\\ilinebr ",9)==0)
addOutput(yyscanner,
"\\ilinebr "),i+=9;
1193 else i++;
1194 }
1196 }
1197 else
1198 {
1199
1201 }
1203 }
1204<Comment>"."[?!] |
1205<Comment>[\.?!] { // potential end of a JavaDoc style comment
1207 if (yyextra->briefEndsAtDot)
1208 {
1210 yyextra->briefEndsAtDot=
FALSE;
1211 }
1212 }
1213<Comment>{DOCNL} { // newline
1215 if (*yytext == '\n') yyextra->lineNr++;
1216 }
1217<Comment>"<"[/]?{TABLEDEL}">" { // In case in xrefitem type some special handling is required
1219 {
1222 }
1223 else
1224 {
1225 REJECT;
1226 }
1227 }
1228<Comment>. { // catch-all for anything else
1230 }
1231
1232
1233
1234
1235<HtmlComment>"---"[!]?">"{B}* {
1236 warn(yyextra->fileName,yyextra->lineNr,
1237 "incorrect HTML end comment --->"
1238 );
1239 }
1240<HtmlComment>"--"[!]?">"{B}* { BEGIN( Comment ); }
1241<HtmlComment>{DOCNL} {
1242 if (*yytext=='\n')
1243 {
1244 yyextra->lineNr++;
1246 }
1247 }
1248<HtmlComment>[^\\\n\-]+ { // ignore unimportant characters
1249 }
1250<HtmlComment>. { // ignore every else
1251 }
1252
1253<CdataSection>"\]\]>" {
1254 BEGIN( Comment );
1255 }
1256<CdataSection>{DOCNL} {
1258 if (*yytext=='\n') yyextra->lineNr++;
1259 }
1260<CdataSection>[<>&] { // the special XML characters for iwhich the CDATA section is especially used
1263 }
1264<CdataSection>[^\\\n\]<>&]+ {
1266 }
1267<CdataSection>. {
1269 }
1270
1271
1272
1273<ReadFormulaShort,ReadFormulaShortSection>{CMD}"f$" { // end of inline formula
1274 yyextra->formulaPostText+="$";
1277 if (YY_START == ReadFormulaShort)
1278 {
1279 BEGIN(Comment);
1280 }
1281 else
1282 {
1283 yyextra->sectionTitle+= " "+form;
1284 BEGIN(SectionTitle);
1285 }
1286 }
1287<ReadFormulaRound,ReadFormulaRoundSection>{CMD}"f)" { // end of inline formula
1290 if (YY_START == ReadFormulaRound)
1291 {
1292 BEGIN(Comment);
1293 }
1294 else
1295 {
1296 yyextra->sectionTitle+= " "+form;
1297 BEGIN(SectionTitle);
1298 }
1299 }
1300<ReadFormulaLong>{CMD}"f]" { // end of block formula
1301 yyextra->formulaPostText+="\\]";
1303 BEGIN(Comment);
1304 }
1305<ReadFormulaLong>{CMD}"f}" { // end of custom env formula
1306 yyextra->formulaPostText+="\\end";
1307 yyextra->formulaPostText+=yyextra->formulaEnv;
1309 BEGIN(Comment);
1310 }
1311<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>[^\\@\n]+ { // any non-special character
1312 yyextra->formulaText+=yytext;
1313 }
1314<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>\n { // new line
1315 yyextra->formulaNewLines++;
1316 yyextra->formulaText+=*yytext;
1317 yyextra->lineNr++;
1318 addIline(yyscanner,yyextra->lineNr);
1319 }
1320<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>. { // any other character
1321 yyextra->formulaText+=*yytext;
1322 }
1323
1324
1325
1326<EnumDocArg1>{SCOPEID} { // handle argument
1328 yyextra->current->name = yytext;
1329 BEGIN( Comment );
1330 }
1331<EnumDocArg1>{LC} { // line continuation
1332 yyextra->lineNr++;
1334 }
1335<EnumDocArg1>{DOCNL} { // missing argument
1336 warn(yyextra->fileName,yyextra->lineNr,
1337 "missing argument after '\\enum'."
1338 );
1340 BEGIN( Comment );
1341 }
1342<EnumDocArg1>. { // ignore other stuff
1343 }
1344
1345
1346
1347<NameSpaceDocArg1>{SCOPENAME} { // handle argument
1351 BEGIN( Comment );
1352 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
QCString removeRedundantWhiteSpace(const QCString &s)
1353<NameSpaceDocArg1>{LC} { // line continuation
1354 yyextra->lineNr++;
1356 }
1357<NameSpaceDocArg1>{DOCNL} { // missing argument
1358 warn(yyextra->fileName,yyextra->lineNr,
1359 "missing argument after '\\namespace'."
1360 );
1362 BEGIN( Comment );
1363 }
1364<NameSpaceDocArg1>. { // ignore other stuff
1365 }
1366
1367
1368
1369<PackageDocArg1>{ID}("."{ID})* { // handle argument
1370 yyextra->current->name = yytext;
1371 BEGIN( Comment );
1372 }
1373<PackageDocArg1>{LC} { // line continuation
1374 yyextra->lineNr++;
1376 }
1377<PackageDocArg1>{DOCNL} { // missing argument
1378 warn(yyextra->fileName,yyextra->lineNr,
1379 "missing argument after \\package."
1380 );
1382
1383
1384 BEGIN( Comment );
1385 }
1386<PackageDocArg1>. { // ignore other stuff
1387 }
1388
1389
1390
1391<ConceptDocArg1>{SCOPEID} { // handle argument
1393 yyextra->current->name = yytext;
1394 BEGIN( Comment );
1395 }
1396<ConceptDocArg1>{LC} { // line continuation
1397 yyextra->lineNr++;
1399 }
1400<ConceptDocArg1>{DOCNL} { // missing argument
1401 warn(yyextra->fileName,yyextra->lineNr,
1402 "missing argument after '\\concept'."
1403 );
1405 BEGIN( Comment );
1406 }
1407<ConceptDocArg1>. { // ignore other stuff
1408 }
1409
1410
1411<ModuleDocArg1>{MODULE_ID} { // handle argument
1413 yyextra->current->name = yytext;
1414 BEGIN( Comment );
1415 }
1416<ModuleDocArg1>{LC} { // line continuation
1417 yyextra->lineNr++;
1419 }
1420<ModuleDocArg1>{DOCNL} { // missing argument
1421 warn(yyextra->fileName,yyextra->lineNr,
1422 "missing argument after '\\module'."
1423 );
1425 BEGIN( Comment );
1426 }
1427<ModuleDocArg1>. { // ignore other stuff
1428 }
1429
1430
1431
1432<ClassDocArg1>{SCOPENAME}{TMPLSPEC} {
1436 BEGIN( ClassDocArg2 );
1437 }
1438<ClassDocArg1>{SCOPENAME} { // first argument
1442 if (yyextra->current->section.isProtocolDoc())
1443 {
1444 yyextra->current->name+="-p";
1445 }
1446
1447 BEGIN( ClassDocArg2 );
1448 }
1449<CategoryDocArg1>{SCOPENAME}{B}*"("[^\)]+")" {
1453 BEGIN( ClassDocArg2 );
1454 }
1455<ClassDocArg1,CategoryDocArg1>{LC} { // line continuation
1456 yyextra->lineNr++;
1458 }
1459<ClassDocArg1,CategoryDocArg1>{DOCNL} {
1460 warn(yyextra->fileName,yyextra->lineNr,
1461 "missing argument after '\\{}'.",yyextra->currentCmd
1462 );
1464 BEGIN( Comment );
1465 }
1466<ClassDocArg1,CategoryDocArg1>. { // ignore other stuff
1467 }
1468
1469<ClassDocArg2>{DOCNL} {
1471 BEGIN( Comment );
1472 }
1473<ClassDocArg2>{FILE}|"<>" { // second argument; include file
1474 yyextra->current->includeFile = yytext;
1475 BEGIN( ClassDocArg3 );
1476 }
1477<ClassDocArg2>{LC} { // line continuation
1478 yyextra->lineNr++;
1480 }
1481<ClassDocArg2>. { // ignore other stuff
1482 }
1483
1484<ClassDocArg3>[<"]?{FILE}?[">]? { // third argument; include file name
1485 yyextra->current->includeName = yytext;
1486 BEGIN( Comment );
1487 }
1488<ClassDocArg3>{LC} { // line continuation
1489 yyextra->lineNr++;
1491 }
1492<ClassDocArg3>{DOCNL} {
1493
1495 BEGIN( Comment );
1496 }
1497<ClassDocArg3>. { // ignore other stuff
1498 }
1499
1500
1501
1502<GroupDocArg1>{LABELID}(".html"|".xhtml")? { // group name
1503 yyextra->current->name = yytext;
1504
1505
1506
1507 if (yyextra->current->name.endsWith(".html"))
1508 {
1509 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-5);
1510 }
1511 else if (yyextra->current->name.endsWith(".xhtml"))
1512 {
1513 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-6);
1514 }
1515 yyextra->current->type.clear();
1516 BEGIN(GroupDocArg2);
1517 }
1518<GroupDocArg1>"\\"{B}*"\n" { // line continuation
1519 yyextra->lineNr++;
1521 }
1522<GroupDocArg1>{DOCNL} { // missing argument!
1523 warn(yyextra->fileName,yyextra->lineNr,
1524 "missing group name after {}",
1525 yyextra->current->groupDocCmd()
1526 );
1527
1528
1530 BEGIN( Comment );
1531 }
1532<GroupDocArg1>. { // ignore other stuff
1533 }
1534<GroupDocArg2>"\\"{B}*"\n" { // line continuation
1535 yyextra->lineNr++;
1537 }
1538<GroupDocArg2>[^\n\\]+ { // title (stored in type)
1539 yyextra->current->type += yytext;
1540 }
1541<GroupDocArg2>{DOCNL}+ {
1542 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
1544 yyextra->current->type.isEmpty()
1545 )
1546 {
1547 warn(yyextra->fileName,yyextra->lineNr,
1548 "missing title after "
1549 "\\defgroup {}", yyextra->current->name
1550 );
1551 }
1553 int extraLineNr = 0;
1555 {
1556 for (int i = 0; i < yyleng; i++)
1557 {
1558 if (yytext[i]=='\n') extraLineNr++;
1559 }
1560 }
1561
1562
1564 {
1565 addOutput(yyscanner,
" \\ifile \""+ yyextra->fileName);
1566 addOutput(yyscanner,
"\" \\iline " +
QCString().setNum(yyextra->lineNr + extraLineNr) +
" \\ilinebr ");
1567 }
1568 BEGIN( Comment );
1569 }
1570<GroupDocArg2>. { // title (stored in type)
1571 yyextra->current->type += yytext;
1572 }
1573
1574
1575
1576<PageDocArg1>[^\n]*"\\ilinebr @ianchor"\{[^\]\n]*\}{B}{FILE} { // special case where the Markdown processor has rewritten
1577
1578
1580 int start = text.
find(
'{');
1581 int end = text.
find(
'}',start+1);
1582 yyextra->current->name = text.
mid(
end+2);
1583 int istart = yyextra->current->name.
find(
"\\ilinebr");
1584 if (istart != -1)
1585 {
1586 QCString rest = yyextra->current->name.
mid(istart);
1588 yyextra->current->name = yyextra->current->name.mid(0,istart);
1589 }
1590 yyextra->current->args = text.
mid(start+1,
end-start-1);
1591
1592 BEGIN( PageDocArg2 );
1593 }
DirIterator end(const DirIterator &) noexcept
1594<PageDocArg1>{FILE} { // first argument; page name
1596 yyextra->current->args = "";
1597 BEGIN( PageDocArg2 );
1598 }
1599<PageDocArg1>{LC} { yyextra->lineNr++;
1601 }
1602<PageDocArg1>{DOCNL} {
1603 warn(yyextra->fileName,yyextra->lineNr,
1604 "missing argument after \\page."
1605 );
1607
1608
1609 BEGIN( Comment );
1610 }
1611<PageDocArg1>. { // ignore other stuff
1612 }
1613<PageDocArg2>{DOCNL} { // second argument; page title
1615
1616
1617 addOutput(yyscanner,
" \\ifile \""+ yyextra->fileName);
1618 addOutput(yyscanner,
"\" \\iline " +
QCString().setNum(yyextra->lineNr) +
" \\ilinebr ");
1619 BEGIN( Comment );
1620 }
1621<PageDocArg2>{CMD}[<>] {
1622
1626 yyextra->current->args += tmp;
1627 }
1628<PageDocArg2>. {
1629 yyextra->current->args += yytext;
1630 }
1631
1632<ParamArg1>{ID}/{B}*"," {
1634 }
1635<ParamArg1>"," {
1637 }
1638<ParamArg1>{DOCNL} {
1639 if (*yytext=='\n') yyextra->lineNr++;
1641 }
1642<ParamArg1>{ID} {
1644 BEGIN( Comment );
1645 }
1646<ParamArg1>. {
1647 unput(yytext[0]);
1648 BEGIN( Comment );
1649 }
1650
1651
1652
1653<FileDocArg1>{DOCNL} { // no file name specified
1655
1656
1657 BEGIN( Comment );
1658 }
1659<FileDocArg1>{FILE} { // first argument; name
1661 BEGIN( Comment );
1662 }
1663<FileDocArg1>{LC} { yyextra->lineNr++;
1665 }
1666<FileDocArg1>. { // ignore other stuff
1667 }
1668
1669
1670
1671<XRefItemParam1>{LABELID} { // first argument
1672 yyextra->newXRefItemKey=yytext;
1674 BEGIN(XRefItemParam2);
1675 }
1676<XRefItemParam1>{LC} { // line continuation
1677 yyextra->lineNr++;
1679 }
1680<XRefItemParam1>{DOCNL} { // missing arguments
1681 warn(yyextra->fileName,yyextra->lineNr,
1682 "Missing first argument of \\xrefitem"
1683 );
1684 if (*yytext=='\n') yyextra->lineNr++;
1687 BEGIN( Comment );
1688 }
1689<XRefItemParam1>. { // ignore other stuff
1690 }
1691
1692<XRefItemParam2>"\""[^\n\"]*"\"" { // second argument
1694 BEGIN(XRefItemParam3);
1695 }
1696<XRefItemParam2>{LC} { // line continuation
1697 yyextra->lineNr++;
1699 }
1700<XRefItemParam2>{DOCNL} { // missing argument
1701 warn(yyextra->fileName,yyextra->lineNr,
1702 "Missing second argument of \\xrefitem"
1703 );
1704 if (*yytext=='\n') yyextra->lineNr++;
1707 BEGIN( Comment );
1708 }
1709<XRefItemParam2>. { // ignore other stuff
1710 }
1711
1712<XRefItemParam3>"\""[^\n\"]*"\"" { // third argument
1715 BEGIN( Comment );
1716 }
1717<XRefItemParam2,XRefItemParam3>{LC} { // line continuation
1718 yyextra->lineNr++;
1720 }
1721<XRefItemParam3>{DOCNL} { // missing argument
1722 warn(yyextra->fileName,yyextra->lineNr,
1723 "Missing third argument of \\xrefitem"
1724 );
1725 if (*yytext=='\n') yyextra->lineNr++;
1728 BEGIN( Comment );
1729 }
1730<XRefItemParam3>. { // ignore other stuff
1731 }
1732
1733
1734
1735
1736<RelatesParam1>({ID}("::"|"."))*{ID} { // argument
1737 yyextra->current->relates = yytext;
1738
1739
1740
1741
1742 BEGIN( Comment );
1743 }
1744<RelatesParam1>{LC} { // line continuation
1745 yyextra->lineNr++;
1747 }
1748<RelatesParam1>{DOCNL} { // missing argument
1749 warn(yyextra->fileName,yyextra->lineNr,
1750 "Missing argument of '\\{}' command",yyextra->currentCmd
1751 );
1753
1754
1755 BEGIN( Comment );
1756 }
1757<RelatesParam1>. { // ignore other stuff
1758 }
1759
1760
1761
1762<Qualifier>{LABELID} { // unquoted version, simple label
1763 yyextra->current->qualifiers.emplace_back(yytext);
1764 BEGIN( Comment );
1765 }
1766<Qualifier>"\""[^\"]*"\"" { // quotes version, add without quotes
1767 std::string inp(yytext);
1768 yyextra->current->qualifiers.push_back(inp.substr(1,yyleng-2));
1769 BEGIN( Comment );
1770 }
1771<Qualifier>{DOCNL} { // missing argument
1772 warn(yyextra->fileName,yyextra->lineNr,
1773 "Missing argument of '\\{}' command",yyextra->currentCmd
1774 );
1776 BEGIN( Comment );
1777 }
1778<Qualifier>. {
1779 warn(yyextra->fileName,yyextra->lineNr,
1780 "Argument of '\\{}' command should be quoted",yyextra->currentCmd
1781 );
1783 BEGIN( Comment );
1784 }
1785
1786<ILine>{LINENR}/[\\@\n\.] |
1787<ILine>{LINENR}{B} {
1788 bool ok = false;
1790 if (!ok)
1791 {
1792 warn(yyextra->fileName,yyextra->lineNr,
"Invalid line number '{}' for iline command",yytext);
1793 }
1794 else
1795 {
1796 yyextra->lineNr = nr;
1797 }
1799 if (YY_START == ILine)
1800 {
1801 BEGIN(Comment);
1802 }
1803 else
1804 {
1805 yyextra->sectionTitle+=yytext;
1806 BEGIN(SectionTitle);
1807 }
1808 }
int toInt(bool *ok=nullptr, int base=10) const
1809<ILine,ILineSection>. {
1811 if (YY_START == ILine)
1812 {
1813 BEGIN(Comment);
1814 }
1815 else
1816 {
1817 yyextra->sectionTitle+=yytext;
1818 BEGIN(SectionTitle);
1819 }
1820 }
1821
1822
1823<IRaise>{B}*[0-9]+/[\\@\n\.] |
1824<IRaise>{B}*[0-9]+{B} {
1825 bool ok = false;
1827 if (!ok)
1828 {
1829 warn(yyextra->fileName,yyextra->lineNr,
"Invalid level '{}' for iraise command",yytext);
1830 }
1831 else
1832 {
1833 yyextra->raiseLevel = nr;
1834 }
1835 BEGIN(Comment);
1836 }
1837<IRaise>. {
1838 unput(yytext[0]);
1839 BEGIN(Comment);
1840 }
1841
1842
1843<IRaisePrefix>{B}*"\""({LABELID})?"\"" {
1845 yyextra->raisePrefix = text.stripWhiteSpace().mid(1,text.length()-2);
1847 BEGIN(Comment);
1848 }
1849<IRaisePrefix>. {
1850 unput(yytext[0]);
1851 BEGIN(Comment);
1852 }
1853
1854
1855
1856
1857<IFile,IFileSection>{FILE} {
1860 if (yytext[0] == '\"') yyextra->fileName = text.mid(1,text.length()-2);
1861 else yyextra->fileName = yytext;
1862 if (YY_START == IFile)
1863 {
1864 BEGIN(Comment);
1865 }
1866 else
1867 {
1868 yyextra->sectionTitle+=yytext;
1869 BEGIN(SectionTitle);
1870 }
1871 }
1872
1873<LinkSection>[^\\@\n]* {
1874 yyextra->sectionTitle+=yytext;
1875 }
1876<LinkSection>{CMD}{CMD} {
1877 yyextra->sectionTitle+=yytext;
1878 }
1879<LinkSection>{DOCNL} {
1881 if (*yytext == '\n') yyextra->lineNr++;
1882 yyextra->sectionTitle+=yytext;
1883 }
1884<LinkSection>{CMD}"endlink" {
1885 yyextra->sectionTitle+=yytext;
1886 BEGIN(SectionTitle);
1887 }
1888<LinkSection>. {
1889 yyextra->sectionTitle+=yytext;
1890 }
1891<LinkSection><<EOF>> {
1892 warn(yyextra->fileName,yyextra->lineNr,
1893 "reached end of comment while inside a '\\link' command, missing '\\endlink' command"
1894 );
1896 }
1897
1898
1899<LineParam>{CMD}{CMD} { // escaped command
1901 }
1902<LineParam>{DOCNL} { // end of argument
1903
1904
1906 BEGIN( Comment );
1907 }
1908<LineParam>{LC} { // line continuation
1909 yyextra->lineNr++;
1911 }
1912<LineParam>({CMD}{CMD}){ID} { // escaped command
1914 }
1915<LineParam>. { // ignore other stuff
1917 }
1918
1919
1920
1921<SectionLabel>{LABELID} { // first argument
1922 yyextra->sectionLabel=yyextra->raisePrefix+yytext;
1923 addOutput(yyscanner,yyextra->sectionLabel.data());
1924 yyextra->sectionTitle.clear();
1925 BEGIN(SectionTitle);
1926 }
1927<SectionLabel>{DOCNL} { // missing argument
1928 warn(yyextra->fileName,yyextra->lineNr,
1929 "\\section command has no label"
1930 );
1931 if (*yytext=='\n') yyextra->lineNr++;
1933 BEGIN( Comment );
1934 }
1935<SectionLabel>. { // invalid character for section label
1936 warn(yyextra->fileName,yyextra->lineNr,
1937 "Invalid or missing section label"
1938 );
1939 BEGIN(Comment);
1940 }
1941<SectionTitle>{STAopt}/"\n" { // end of section title
1944 BEGIN( Comment );
1945 }
1946<SectionTitle>{STopt}"\\\\ilinebr" { // escaped end of section title
1947 yyextra->sectionTitle+=yytext;
1948 }
1949<SectionTitle>{STopt}/"\\ilinebr" { // end of section title
1952 BEGIN( Comment );
1953 }
1954<SectionTitle>{B}*{CMD}"f$" {
1955 yyextra->formulaText="";
1956 yyextra->formulaPreText="$";
1957 yyextra->formulaPostText="";
1958 yyextra->formulaNewLines=0;
1959 BEGIN(ReadFormulaShortSection);
1960 }
1961<SectionTitle>{B}*{CMD}"f(" { // start of a inline formula
1962 yyextra->formulaText="";
1963 yyextra->formulaPreText="";
1964 yyextra->formulaPostText="";
1965 yyextra->formulaNewLines=0;
1966 BEGIN(ReadFormulaRoundSection);
1967 }
1968<SectionTitle>{B}*{CMD}"~"[a-z_A-Z-]* | // language switch command
1969<SectionTitle>{B}*{CMD}"f"[\[{] { // block formula
1973 warn(yyextra->fileName,yyextra->lineNr,
1974 "'\\{}' command is not allowed in section title, ending section title.",
1976 );
1978 BEGIN(Comment);
1979 }
1980<SectionTitle>{LC} { // line continuation
1981 yyextra->lineNr++;
1983 }
1984<SectionTitle>[^\n@\\]* { // any character without special meaning
1985 yyextra->sectionTitle+=yytext;
1987 }
1988<SectionTitle>{B}*{CMD}{CMD} {
1989 yyextra->sectionTitle+=yytext;
1991 }
1992<SectionTitle>{B}*{CMD}[a-z_A-Z]+"{"[^}]*"}"{B}* |
1993<SectionTitle>{B}*{CMD}[a-z_A-Z]+{B}* { // handling command in section title
1995 int idx = fullMatch.
find(
'{');
1996
1997 if ((idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT;
1998 int idxEnd = fullMatch.
find(
"}",idx+1);
2001 if (idx == -1)
2002 {
2004 }
2005 else
2006 {
2010 }
2013 {
2014 switch (it->second.sectionHandling)
2015 {
2017 {
2018 int i=0;
2019 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2020 yyextra->sectionTitle+=fullMatch.
left(i);
2021 yyextra->sectionTitle+='@';
2022 yyextra->sectionTitle+=fullMatch.
mid(i);
2026 warn(yyextra->fileName,yyextra->lineNr,
2027 "'\\{}' command is not allowed in section title, escaping command.",cmdName
2028 );
2029 }
2030 break;
2032 {
2035 warn(yyextra->fileName,yyextra->lineNr,
2036 "'\\{}' command is not allowed in section title, ending section title.",cmdName
2037 );
2039 BEGIN(Comment);
2040 }
2041 break;
2043 {
2044 if (cmdName == "fileinfo")
2045 {
2046 int i=0;
2047 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2048 yyextra->sectionTitle+=fullMatch.
left(i);
2051 if (idxEnd == -1)
2052 {
2053 yyextra->sectionTitle+=fullMatch.
mid(i+9);
2055 }
2056 else
2057 {
2058 yyextra->sectionTitle+=fullMatch.
mid(idxEnd+1);
2060 }
2061 }
2062 else if (cmdName == "lineinfo")
2063 {
2064 int i=0;
2065 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2066 yyextra->sectionTitle+=fullMatch.
left(i);
2068 yyextra->sectionTitle+=' ';
2069 yyextra->sectionTitle+=fullMatch.
mid(i+9);
2074 }
2075 else if (cmdName == "raisewarning")
2076 {
2077 yyextra->raiseWarning = "";
2078 BEGIN(RaiseWarningSection);
2079 }
2080 else if (cmdName == "noop")
2081 {
2083 BEGIN(Noop);
2084 }
2085 else if (cmdName == "cite")
2086 {
2087 yyextra->sectionTitle+=yytext;
2089 BEGIN(CiteLabelSection);
2090 }
2091 else if (cmdName == "iline")
2092 {
2093 yyextra->sectionTitle+=yytext;
2095 BEGIN(ILineSection);
2096 }
2097 else if (cmdName == "ifile")
2098 {
2099 yyextra->sectionTitle+=yytext;
2101 BEGIN(IFileSection);
2102 }
2103 else if ((cmdName == "anchor") || (cmdName == "ianchor"))
2104 {
2106 if (optList.empty())
2107 {
2108 yyextra -> anchorTitle = "";
2109 }
2110 else
2111 {
2113 yyextra -> anchorTitle =
join(optList,
" ");
2114 }
2116 BEGIN(AnchorLabelSection);
2117 }
2118 else if (cmdName == "link")
2119 {
2120 yyextra->sectionTitle+=yytext;
2121 BEGIN(LinkSection);
2122 }
2123 else
2124 {
2125 yyextra->sectionTitle+=yytext;
2126 warn(yyextra->fileName,yyextra->lineNr,
2127 "internal error '\\{}' command is to be replaced in section title.",cmdName
2128 );
2129 }
2130 }
2131 break;
2133 {
2134 yyextra->sectionTitle+=yytext;
2136 }
2137 break;
2138 }
2139 }
2140 else
2141 {
2142 yyextra->sectionTitle+=yytext;
2144 }
2145 }
2146<SectionTitle>. { // anything else
2147 yyextra->sectionTitle+=yytext;
2149 }
2150
2151
2152
2153<SubpageLabel>{FILE} { // first argument
2155
2156
2157 yyextra->current->extends.emplace_back(
QCString(yytext),Protection::Public,Specifier::Normal);
2158 BEGIN(SubpageTitle);
2159 }
2160<SubpageLabel>{DOCNL} { // missing argument
2161 warn(yyextra->fileName,yyextra->lineNr,
2162 "\\subpage command has no label"
2163 );
2164 if (*yytext=='\n') yyextra->lineNr++;
2166 BEGIN( Comment );
2167 }
2168<SubpageLabel>. {
2169 unput(yytext[0]);
2170 BEGIN( Comment );
2171 }
2172<SubpageTitle>{DOCNL} { // no title, end command
2174 BEGIN( Comment );
2175 }
2176<SubpageTitle>[ \t]*"\""[^\"\n]*"\"" { // add title, end of command
2178 BEGIN( Comment );
2179 }
2180<SubpageTitle>. { // no title, end of command
2181 unput(*yytext);
2182 BEGIN( Comment );
2183 }
2184
2185
2186
2187<AnchorLabel,AnchorLabelSection>{LABELID} { // found argument
2188 QCString lbl = yyextra->raisePrefix+yytext;
2189 addAnchor(yyscanner,lbl, yyextra->anchorTitle);
2191 if (YY_START == AnchorLabel)
2192 {
2193 BEGIN(Comment);
2194 }
2195 else
2196 {
2197 BEGIN(SectionTitle);
2198 }
2199 }
2200<AnchorLabel,AnchorLabelSection>{DOCNL} { // missing argument
2201 warn(yyextra->fileName,yyextra->lineNr,
2202 "\\anchor command has no label"
2203 );
2204 if (*yytext=='\n') yyextra->lineNr++;
2206 if (YY_START == AnchorLabel)
2207 {
2208 BEGIN(Comment);
2209 }
2210 else
2211 {
2212 BEGIN(SectionTitle);
2213 }
2214 }
2215<AnchorLabel,AnchorLabelSection>. { // invalid character for anchor label
2216 warn(yyextra->fileName,yyextra->lineNr,
2217 "Invalid or missing anchor label"
2218 );
2220 if (YY_START == AnchorLabel)
2221 {
2222 BEGIN(Comment);
2223 }
2224 else
2225 {
2226 BEGIN(SectionTitle);
2227 }
2228 }
2229
2230
2231
2232
2233<FormatBlock>{CMD}("endverbatim"|"endiverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"endicode"|"endmsc")/{NW} { // possible ends
2235 if (&yytext[4]==yyextra->blockName)
2236 {
2237 BEGIN(Comment);
2238 }
2239 }
2240<FormatBlock>{CMD}"enduml" {
2242 if (yyextra->blockName=="startuml")
2243 {
2244 BEGIN(Comment);
2245 }
2246 }
2247<FormatBlock>[^ \@\*\/\\\n]* { // some word
2249 }
2250<FormatBlock>{DOCNL} { // new line
2251 if (*yytext=='\n') yyextra->lineNr++;
2253 }
2254<FormatBlock>{CCS} { // start of a C-comment
2255 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2256 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2257 yyextra->blockName=="iliteral"
2258 )
2259 ) yyextra->commentCount++;
2261 }
2262<FormatBlock>{CCE} { // end of a C-comment
2264 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2265 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2266 yyextra->blockName=="iliteral"
2267 )
2268 )
2269 {
2270 yyextra->commentCount--;
2271 if (yyextra->commentCount<0)
2272 {
2273 QCString endTag =
"end"+yyextra->blockName;
2274 if (yyextra->blockName=="startuml") endTag="enduml";
2275 warn(yyextra->fileName,yyextra->lineNr,
2276 "found */ without matching /* while inside a \\{} block! Perhaps a missing \\{}?",
2277 yyextra->blockName,endTag);
2278 }
2279 }
2280 }
2281<FormatBlock>. {
2283 }
2284<FormatBlock><<EOF>> {
2285 QCString endTag =
"end"+yyextra->blockName;
2286 if (yyextra->blockName=="startuml") endTag="enduml";
2287 warn(yyextra->fileName,yyextra->lineNr,
2288 "reached end of comment while inside a \\{} block; check for missing \\{} tag!",
2289 yyextra->blockName,endTag
2290 );
2292 }
2293
2294
2295
2296<GuardParam>{B}*"(" {
2297 yyextra->guardExpr=yytext;
2298 yyextra->roundCount=1;
2299 BEGIN(GuardExpr);
2300 }
2301<GuardExpr>[^()]* {
2302 yyextra->guardExpr+=yytext;
2304 }
2305<GuardExpr>"(" {
2306 yyextra->guardExpr+=yytext;
2307 yyextra->roundCount++;
2308 }
2309<GuardExpr>")" {
2310 yyextra->guardExpr+=yytext;
2311 yyextra->roundCount--;
2312 if (yyextra->roundCount==0)
2313 {
2315 }
2316 }
2317<GuardExpr>\n {
2318 warn(yyextra->fileName,yyextra->lineNr,
2319 "invalid expression '{}' for yyextra->guards",yyextra->guardExpr);
2320 unput(*yytext);
2321 BEGIN(GuardParam);
2322 }
2323<GuardParam>{B}*[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot yyextra->guards
2325 }
2326<GuardParam>{DOCNL} { // end of argument
2327
2328
2332 }
2333<GuardParam>{LC} { // line continuation
2334 yyextra->lineNr++;
2336 }
2337<GuardParam>. { // empty condition
2338 unput(*yytext);
2340 }
2341<GuardParamEnd>{B}*{DOCNL} {
2343 yyextra->spaceBeforeIf.clear();
2345 BEGIN(Comment);
2346 }
2347<GuardParamEnd>{B}* {
2348 if (!yyextra->spaceBeforeIf.isEmpty())
2349 {
2350 addOutput(yyscanner,yyextra->spaceBeforeIf);
2351 }
2352 yyextra->spaceBeforeIf.clear();
2354 BEGIN(Comment);
2355 }
2356<GuardParamEnd>. {
2357 unput(*yytext);
2359 BEGIN(Comment);
2360 }
2361
2362
2363
2364<SkipGuardedSection>{CMD}"ifnot"/{NW} {
2366 yyextra->guards->emplace(false);
2367 BEGIN( GuardParam );
2368 }
2369<SkipGuardedSection>{CMD}"if"/{NW} {
2371 yyextra->guards->emplace(false);
2372 BEGIN( GuardParam );
2373 }
2374<SkipGuardedSection>{CMD}"endif"/{NW} {
2375 if (yyextra->guards->empty())
2376 {
2377 warn(yyextra->fileName,yyextra->lineNr,
2378 "found \\endif without matching start command");
2379 BEGIN( Comment );
2380 }
2381 else
2382 {
2383 yyextra->guards->pop();
2384 if (yyextra->guards->empty())
2385 {
2386 BEGIN( GuardParamEnd );
2387 }
2388 else
2389 {
2390 if (yyextra->guards->top().isEnabled())
2391 {
2392 BEGIN( GuardParamEnd );
2393 }
2394 else
2395 {
2396 BEGIN( SkipGuardedSection );
2397 }
2398 }
2399 }
2400 }
2401<SkipGuardedSection>{CMD}"else"/{NW} {
2402 if (yyextra->guards->empty())
2403 {
2404 warn(yyextra->fileName,yyextra->lineNr,
2405 "found \\else without matching start command");
2406 }
2407 else if (yyextra->guards->top().hasElse())
2408 {
2409 warn(yyextra->fileName,yyextra->lineNr,
2410 "found multiple \\else commands in same \\if construct");
2411 yyextra->guards->top().setEnabled(false);
2412 BEGIN( SkipGuardedSection );
2413 }
2414 else if (!yyextra->guards->top().parentVisible())
2415 {
2416 yyextra->guards->top().setEnabled(false);
2417 BEGIN( SkipGuardedSection );
2418 }
2419 else
2420 {
2421 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2422 yyextra->guards->top().setElse();
2423 if (!yyextra->guards->top().parentVisible())
2424 {
2425 yyextra->guards->top().setEnabled(false);
2426 BEGIN( SkipGuardedSection );
2427 }
2428 else if (yyextra->guards->top().isEnabledFound())
2429 {
2430 yyextra->guards->top().setEnabled(false);
2431 BEGIN( SkipGuardedSection );
2432 }
2433 else
2434 {
2435 yyextra->guards->top().setEnabled(true);
2436 BEGIN( GuardParamEnd );
2437 }
2438 }
2439 }
2440<SkipGuardedSection>{CMD}"elseif"/{NW} {
2441 if (yyextra->guards->empty())
2442 {
2443 warn(yyextra->fileName,yyextra->lineNr,
2444 "found \\elseif without matching start command");
2445 }
2446 else if (yyextra->guards->top().hasElse())
2447 {
2448 warn(yyextra->fileName,yyextra->lineNr,
2449 "found \\elseif command after \\else command was given in \\if construct");
2451 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2452 yyextra->guards->top().setEnabled(false);
2453 BEGIN( GuardParam );
2454 }
2455 else
2456 {
2458 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2459 yyextra->guards->top().setEnabled(false);
2460 BEGIN( GuardParam );
2461 }
2462 }
2463<SkipGuardedSection>{DOCNL} { // skip line
2464 if (*yytext=='\n') yyextra->lineNr++;
2465
2466 }
2467<SkipGuardedSection>[^ \\@\n]+ { // skip non-special characters
2468 }
2469<SkipGuardedSection>{CMD}{CMD} |
2470<SkipGuardedSection>. { // any other character
2471 }
2472
2473
2474
2475
2476<SkipInternal>{DOCNL} { // skip line
2477 if (*yytext=='\n') yyextra->lineNr++;
2479 }
2480<SkipInternal>{CMD}"if"/[ \t] {
2481 yyextra->condCount++;
2482 }
2483<SkipInternal>{CMD}"ifnot"/[ \t] {
2484 yyextra->condCount++;
2485 }
2486<SkipInternal>{CMD}/"endif" {
2487 yyextra->condCount--;
2488 if (yyextra->condCount<0)
2489 {
2490 unput('\\');
2491 BEGIN(Comment);
2492 }
2493 }
2494<SkipInternal>{CMD}/"section"[ \t] {
2495 if (yyextra->sectionLevel>0)
2496 {
2497 unput('\\');
2498 BEGIN(Comment);
2499 }
2500 }
2501<SkipInternal>{CMD}/"subsection"[ \t] {
2502 if (yyextra->sectionLevel>1)
2503 {
2504 unput('\\');
2505 BEGIN(Comment);
2506 }
2507 }
2508<SkipInternal>{CMD}/"subsubsection"[ \t] {
2509 if (yyextra->sectionLevel>2)
2510 {
2511 unput('\\');
2512 BEGIN(Comment);
2513 }
2514 }
2515<SkipInternal>{CMD}/"paragraph"[ \t] {
2516 if (yyextra->sectionLevel>3)
2517 {
2518 unput('\\');
2519 BEGIN(Comment);
2520 }
2521 }
2522<SkipInternal>{CMD}/"subparagraph"[ \t] {
2523 if (yyextra->sectionLevel>4)
2524 {
2525 unput('\\');
2526 BEGIN(Comment);
2527 }
2528 }
2529<SkipInternal>{CMD}/"subsubparagraph"[ \t] {
2530 if (yyextra->sectionLevel>5)
2531 {
2532 unput('\\');
2533 BEGIN(Comment);
2534 }
2535 }
2536<SkipInternal>{CMD}"endinternal"[ \t]* {
2537 BEGIN(Comment);
2538 }
2539<SkipInternal>[^ \\@\n]+ { // skip non-special characters
2540 }
2541<SkipInternal>. { // any other character
2542 }
2543
2544
2545
2546
2547<NameParam>{DOCNL} { // end of argument
2548
2549
2551 BEGIN( Comment );
2552 }
2553<NameParam>{LC} { // line continuation
2554 yyextra->lineNr++;
2556 yyextra->docGroup.appendHeader(' ');
2557 }
2558<NameParam>. { // ignore other stuff
2559 yyextra->docGroup.appendHeader(*yytext);
2560 yyextra->current->name+=*yytext;
2561 }
2562
2563
2564<Noop>{DOCNL} { // end of argument
2565 if (*yytext=='\n')
2566 {
2567 yyextra->lineNr++;
2569 }
2570 BEGIN( Comment );
2571 }
2572<Noop>. { // ignore other stuff
2573 }
2574
2575<RaiseWarning,RaiseWarningSection>{DOCNL} { // end of argument
2577 "{}",yyextra->raiseWarning);
2578 yyextra->raiseWarning = "";
2579 if (*yytext=='\n') yyextra->lineNr++;
2581 if (YY_START == RaiseWarning)
2582 {
2583 BEGIN(Comment);
2584 }
2585 else
2586 {
2587 yyextra->sectionTitle+=yytext;
2588 BEGIN(SectionTitle);
2589 }
2590 }
#define warn_doc_error(file, line, fmt,...)
2591<RaiseWarning,RaiseWarningSection>. { // ignore other stuff
2592 yyextra->raiseWarning += yytext;
2593 }
2594
2595
2596<InGroupParam>{LABELID} { // group id
2597 yyextra->current->groups.emplace_back(
2599 );
2600 yyextra->inGroupParamFound=
TRUE;
2601 }
@ GROUPING_INGROUP
membership in group was defined by @ingroup
2602<InGroupParam>{DOCNL} { // missing argument
2603 if (!yyextra->inGroupParamFound)
2604 {
2605 warn(yyextra->fileName,yyextra->lineNr,
2606 "Missing group name for \\ingroup command"
2607 );
2608 }
2609
2610
2612 BEGIN( Comment );
2613 }
2614<InGroupParam>{LC} { // line continuation
2615 yyextra->lineNr++;
2617 }
2618<InGroupParam>. { // ignore other stuff
2620 }
2621
2622
2623
2624<FnParam>{DOCNL} { // end of argument
2625 if (yyextra->braceCount==0)
2626 {
2627 if (yyextra->functionProto.stripWhiteSpace().isEmpty())
2628 {
2629 warn(yyextra->fileName,yyextra->lineNr,
2630 "missing argument after '\\{}'.",yyextra->currentCmd
2631 );
2632 }
2633 else
2634 {
2636 yyextra->langParser->parsePrototype(yyextra->functionProto);
2637 }
2639 BEGIN( Comment );
2640 }
2641 }
2642<FnParam>{LC} { // line continuation
2643 yyextra->lineNr++;
2644 yyextra->functionProto+=' ';
2645 }
2646<FnParam>[^@\\\n()]+ { // non-special characters
2647 yyextra->functionProto+=yytext;
2648 }
2649<FnParam>"(" {
2650 yyextra->functionProto+=yytext;
2651 yyextra->braceCount++;
2652 }
2653<FnParam>")" {
2654 yyextra->functionProto+=yytext;
2655 yyextra->braceCount--;
2656 }
2657<FnParam>. { // add other stuff
2658 yyextra->functionProto+=*yytext;
2659 }
2660
2661
2662
2663
2664
2665<OverloadParam>{DOCNL} { // end of argument
2666 if (*yytext=='\n') yyextra->lineNr++;
2667 if (yyextra->functionProto.stripWhiteSpace().isEmpty())
2668 {
2671 }
2672 else
2673 {
2675 yyextra->langParser->parsePrototype(yyextra->functionProto);
2676 }
2677 BEGIN( Comment );
2678 }
QCString getOverloadDocs()
2679<OverloadParam>{LC} { // line continuation
2680 yyextra->lineNr++;
2681 yyextra->functionProto+=' ';
2682 }
2683<OverloadParam>. { // add other stuff
2684 yyextra->functionProto+=*yytext;
2685 }
2686
2687
2688
2689<InheritParam>({ID}("::"|"."))*{ID} { // found argument
2690 yyextra->current->extends.emplace_back(
2692 );
2693 BEGIN( Comment );
2694 }
2695<InheritParam>{DOCNL} { // missing argument
2696 warn(yyextra->fileName,yyextra->lineNr,
2697 "\\inherit command has no argument"
2698 );
2699 if (*yytext=='\n') yyextra->lineNr++;
2701 BEGIN( Comment );
2702 }
2703<InheritParam>. { // invalid character for anchor label
2704 warn(yyextra->fileName,yyextra->lineNr,
2705 "Invalid or missing name for \\inherit command"
2706 );
2707 BEGIN(Comment);
2708 }
2709
2710
2711
2712<ExtendsParam>({ID}("::"|"."))*{ID} { // found argument
2713 yyextra->current->extends.emplace_back(
2715 );
2716 BEGIN( Comment );
2717 }
2718<ExtendsParam>{DOCNL} { // missing argument
2719 warn(yyextra->fileName,yyextra->lineNr,
2720 "'\\{}' command has no argument",yyextra->currentCmd
2721 );
2722
2723
2725 BEGIN( Comment );
2726 }
2727<ExtendsParam>. { // ignore other stuff
2728 }
2729
2730
2731
2732<SkipLang>{CMD}"~"[a-zA-Z-]* { /* language switch */
2735 {
2736 warn(yyextra->fileName,yyextra->lineNr,
2738 }
2739 else if (langId.isEmpty() ||
2741 {
2742 BEGIN(Comment);
2743 }
2744 }
2745<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
2746 }
2747<SkipLang>{DOCNL} { /* new line in verbatim block */
2748 if (*yytext=='\n') yyextra->lineNr++;
2749 }
2750<SkipLang>. { /* any other character */
2751 }
2752
2753
2754
2755<CiteLabel,CiteLabelSection>{CITEID} { // found argument
2758 if (YY_START == CiteLabel)
2759 {
2760 BEGIN(Comment);
2761 }
2762 else
2763 {
2764 yyextra->sectionTitle+=yytext;
2765 BEGIN(SectionTitle);
2766 }
2767 }
2768<CiteLabel,CiteLabelSection>{DOCNL} { // missing argument
2769 warn(yyextra->fileName,yyextra->lineNr,
2770 "\\cite command has no label"
2771 );
2772
2773
2774 if (YY_START == CiteLabel)
2775 {
2777 BEGIN(Comment);
2778 }
2779 else
2780 {
2781 yyextra->sectionTitle+=yytext;
2783 BEGIN(SectionTitle);
2784 }
2785 }
2786<CiteLabel,CiteLabelSection>. { // invalid character for cite label
2787 warn(yyextra->fileName,yyextra->lineNr,
2788 "Invalid or missing cite label"
2789 );
2790 if (YY_START == CiteLabel)
2791 {
2792 BEGIN(Comment);
2793 }
2794 else
2795 {
2796 yyextra->sectionTitle+=yytext;
2797 BEGIN(SectionTitle);
2798 }
2799 }
2800
2801
2802
2803<CopyDoc><<EOF>> {
2805 addOutput(yyscanner,
" \\ilinebr\\ilinebr\\copydetails ");
2806 addOutput(yyscanner,yyextra->copyDocArg);
2808 BEGIN(Comment);
2809 }
2810<CopyDoc>{DOCNL} {
2811 if (*yytext=='\n') yyextra->lineNr++;
2812 if (yyextra->braceCount==0)
2813 {
2815 addOutput(yyscanner,
" \\ilinebr\\ilinebr\\copydetails ");
2816 addOutput(yyscanner,yyextra->copyDocArg);
2818 BEGIN(Comment);
2819 }
2820 }
2821<CopyDoc>{LC} { // line continuation
2822 yyextra->lineNr++;
2823 }
2824<CopyDoc>[^@\\\n()]+ { // non-special characters
2825 yyextra->copyDocArg+=yytext;
2827 }
2828<CopyDoc>"(" {
2829 yyextra->copyDocArg+=yytext;
2831 yyextra->braceCount++;
2832 }
2833<CopyDoc>")" {
2834 yyextra->copyDocArg+=yytext;
2836 yyextra->braceCount--;
2837 }
2838<CopyDoc>. {
2839 yyextra->copyDocArg+=yytext;
2841 }
2842
2843
2844<*>. { fprintf(stderr,"Lex scanner %s %sdefault rule for state %s: #%s#\n", __FILE__,!yyextra->fileName.isEmpty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START),yytext);}
2845<*>\n { fprintf(stderr,"Lex scanner %s %sdefault rule newline for state %s.\n", __FILE__, !yyextra->fileName.isEmpty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START));}
2846 */
2847
2848%%