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 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
1541 }
1542<GroupDocArg2>{DOCNL}+ {
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 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
1573 }
1574
1575
1576
1577<PageDocArg1>[^\n]*"\\ilinebr @ianchor"\{[^\]\n]*\}{B}{FILE} { // special case where the Markdown processor has rewritten
1578
1579
1581 int start = text.
find(
'{');
1582 int end = text.
find(
'}',start+1);
1583 yyextra->current->name = text.
mid(
end+2);
1584 int istart = yyextra->current->name.
find(
"\\ilinebr");
1585 if (istart != -1)
1586 {
1587 QCString rest = yyextra->current->name.
mid(istart);
1589 yyextra->current->name = yyextra->current->name.mid(0,istart);
1590 }
1591 yyextra->current->args = text.
mid(start+1,
end-start-1);
1592
1593 BEGIN( PageDocArg2 );
1594 }
DirIterator end(const DirIterator &) noexcept
1595<PageDocArg1>{FILE} { // first argument; page name
1597 yyextra->current->args = "";
1598 BEGIN( PageDocArg2 );
1599 }
1600<PageDocArg1>{LC} { yyextra->lineNr++;
1602 }
1603<PageDocArg1>{DOCNL} {
1604 warn(yyextra->fileName,yyextra->lineNr,
1605 "missing argument after \\page."
1606 );
1608
1609
1610 BEGIN( Comment );
1611 }
1612<PageDocArg1>. { // ignore other stuff
1613 }
1614<PageDocArg2>{DOCNL} { // second argument; page title
1616
1617
1618 addOutput(yyscanner,
" \\ifile \""+ yyextra->fileName);
1619 addOutput(yyscanner,
"\" \\iline " +
QCString().setNum(yyextra->lineNr) +
" \\ilinebr ");
1620 BEGIN( Comment );
1621 }
1622<PageDocArg2>{CMD}[<>] {
1623
1627 yyextra->current->args += tmp;
1628 }
1629<PageDocArg2>. {
1630 yyextra->current->args += yytext;
1631 }
1632
1633<ParamArg1>{ID}/{B}*"," {
1635 }
1636<ParamArg1>"," {
1638 }
1639<ParamArg1>{DOCNL} {
1640 if (*yytext=='\n') yyextra->lineNr++;
1642 }
1643<ParamArg1>{ID} {
1645 BEGIN( Comment );
1646 }
1647<ParamArg1>. {
1648 unput(yytext[0]);
1649 BEGIN( Comment );
1650 }
1651
1652
1653
1654<FileDocArg1>{DOCNL} { // no file name specified
1656
1657
1658 BEGIN( Comment );
1659 }
1660<FileDocArg1>{FILE} { // first argument; name
1662 BEGIN( Comment );
1663 }
1664<FileDocArg1>{LC} { yyextra->lineNr++;
1666 }
1667<FileDocArg1>. { // ignore other stuff
1668 }
1669
1670
1671
1672<XRefItemParam1>{LABELID} { // first argument
1673 yyextra->newXRefItemKey=yytext;
1675 BEGIN(XRefItemParam2);
1676 }
1677<XRefItemParam1>{LC} { // line continuation
1678 yyextra->lineNr++;
1680 }
1681<XRefItemParam1>{DOCNL} { // missing arguments
1682 warn(yyextra->fileName,yyextra->lineNr,
1683 "Missing first argument of \\xrefitem"
1684 );
1685 if (*yytext=='\n') yyextra->lineNr++;
1688 BEGIN( Comment );
1689 }
1690<XRefItemParam1>. { // ignore other stuff
1691 }
1692
1693<XRefItemParam2>"\""[^\n\"]*"\"" { // second argument
1695 BEGIN(XRefItemParam3);
1696 }
1697<XRefItemParam2>{LC} { // line continuation
1698 yyextra->lineNr++;
1700 }
1701<XRefItemParam2>{DOCNL} { // missing argument
1702 warn(yyextra->fileName,yyextra->lineNr,
1703 "Missing second argument of \\xrefitem"
1704 );
1705 if (*yytext=='\n') yyextra->lineNr++;
1708 BEGIN( Comment );
1709 }
1710<XRefItemParam2>. { // ignore other stuff
1711 }
1712
1713<XRefItemParam3>"\""[^\n\"]*"\"" { // third argument
1716 BEGIN( Comment );
1717 }
1718<XRefItemParam2,XRefItemParam3>{LC} { // line continuation
1719 yyextra->lineNr++;
1721 }
1722<XRefItemParam3>{DOCNL} { // missing argument
1723 warn(yyextra->fileName,yyextra->lineNr,
1724 "Missing third argument of \\xrefitem"
1725 );
1726 if (*yytext=='\n') yyextra->lineNr++;
1729 BEGIN( Comment );
1730 }
1731<XRefItemParam3>. { // ignore other stuff
1732 }
1733
1734
1735
1736
1737<RelatesParam1>({ID}("::"|"."))*{ID} { // argument
1738 yyextra->current->relates = yytext;
1739
1740
1741
1742
1743 BEGIN( Comment );
1744 }
1745<RelatesParam1>{LC} { // line continuation
1746 yyextra->lineNr++;
1748 }
1749<RelatesParam1>{DOCNL} { // missing argument
1750 warn(yyextra->fileName,yyextra->lineNr,
1751 "Missing argument of '\\{}' command",yyextra->currentCmd
1752 );
1754
1755
1756 BEGIN( Comment );
1757 }
1758<RelatesParam1>. { // ignore other stuff
1759 }
1760
1761
1762
1763<Qualifier>{LABELID} { // unquoted version, simple label
1764 yyextra->current->qualifiers.emplace_back(yytext);
1765 BEGIN( Comment );
1766 }
1767<Qualifier>"\""[^\"]*"\"" { // quotes version, add without quotes
1768 std::string inp(yytext);
1769 yyextra->current->qualifiers.push_back(inp.substr(1,yyleng-2));
1770 BEGIN( Comment );
1771 }
1772<Qualifier>{DOCNL} { // missing argument
1773 warn(yyextra->fileName,yyextra->lineNr,
1774 "Missing argument of '\\{}' command",yyextra->currentCmd
1775 );
1777 BEGIN( Comment );
1778 }
1779<Qualifier>. {
1780 warn(yyextra->fileName,yyextra->lineNr,
1781 "Argument of '\\{}' command should be quoted",yyextra->currentCmd
1782 );
1784 BEGIN( Comment );
1785 }
1786
1787<ILine>{LINENR}/[\\@\n\.] |
1788<ILine>{LINENR}{B} {
1789 bool ok = false;
1791 if (!ok)
1792 {
1793 warn(yyextra->fileName,yyextra->lineNr,
"Invalid line number '{}' for iline command",yytext);
1794 }
1795 else
1796 {
1797 yyextra->lineNr = nr;
1798 }
1800 if (YY_START == ILine)
1801 {
1802 BEGIN(Comment);
1803 }
1804 else
1805 {
1806 yyextra->sectionTitle+=yytext;
1807 BEGIN(SectionTitle);
1808 }
1809 }
int toInt(bool *ok=nullptr, int base=10) const
1810<ILine,ILineSection>. {
1812 if (YY_START == ILine)
1813 {
1814 BEGIN(Comment);
1815 }
1816 else
1817 {
1818 yyextra->sectionTitle+=yytext;
1819 BEGIN(SectionTitle);
1820 }
1821 }
1822
1823
1824<IRaise>{B}*[0-9]+/[\\@\n\.] |
1825<IRaise>{B}*[0-9]+{B} {
1826 bool ok = false;
1828 if (!ok)
1829 {
1830 warn(yyextra->fileName,yyextra->lineNr,
"Invalid level '{}' for iraise command",yytext);
1831 }
1832 else
1833 {
1834 yyextra->raiseLevel = nr;
1835 }
1836 BEGIN(Comment);
1837 }
1838<IRaise>. {
1839 unput(yytext[0]);
1840 BEGIN(Comment);
1841 }
1842
1843
1844<IRaisePrefix>{B}*"\""({LABELID})?"\"" {
1846 yyextra->raisePrefix = text.stripWhiteSpace().mid(1,text.length()-2);
1848 BEGIN(Comment);
1849 }
1850<IRaisePrefix>. {
1851 unput(yytext[0]);
1852 BEGIN(Comment);
1853 }
1854
1855
1856
1857
1858<IFile,IFileSection>{FILE} {
1861 if (yytext[0] == '\"') yyextra->fileName = text.mid(1,text.length()-2);
1862 else yyextra->fileName = yytext;
1863 if (YY_START == IFile)
1864 {
1865 BEGIN(Comment);
1866 }
1867 else
1868 {
1869 yyextra->sectionTitle+=yytext;
1870 BEGIN(SectionTitle);
1871 }
1872 }
1873
1874<LinkSection>[^\\@\n]* {
1875 yyextra->sectionTitle+=yytext;
1876 }
1877<LinkSection>{CMD}{CMD} {
1878 yyextra->sectionTitle+=yytext;
1879 }
1880<LinkSection>{DOCNL} {
1882 if (*yytext == '\n') yyextra->lineNr++;
1883 yyextra->sectionTitle+=yytext;
1884 }
1885<LinkSection>{CMD}"endlink" {
1886 yyextra->sectionTitle+=yytext;
1887 BEGIN(SectionTitle);
1888 }
1889<LinkSection>. {
1890 yyextra->sectionTitle+=yytext;
1891 }
1892<LinkSection><<EOF>> {
1893 warn(yyextra->fileName,yyextra->lineNr,
1894 "reached end of comment while inside a '\\link' command, missing '\\endlink' command"
1895 );
1897 }
1898
1899
1900<LineParam>{CMD}{CMD} { // escaped command
1902 }
1903<LineParam>{DOCNL} { // end of argument
1904
1905
1907 BEGIN( Comment );
1908 }
1909<LineParam>{LC} { // line continuation
1910 yyextra->lineNr++;
1912 }
1913<LineParam>({CMD}{CMD}){ID} { // escaped command
1915 }
1916<LineParam>. { // ignore other stuff
1918 }
1919
1920
1921
1922<SectionLabel>{LABELID} { // first argument
1923 yyextra->sectionLabel=yyextra->raisePrefix+yytext;
1924 addOutput(yyscanner,yyextra->sectionLabel.data());
1925 yyextra->sectionTitle.clear();
1926 BEGIN(SectionTitle);
1927 }
1928<SectionLabel>{DOCNL} { // missing argument
1929 warn(yyextra->fileName,yyextra->lineNr,
1930 "\\section command has no label"
1931 );
1932 if (*yytext=='\n') yyextra->lineNr++;
1934 BEGIN( Comment );
1935 }
1936<SectionLabel>. { // invalid character for section label
1937 warn(yyextra->fileName,yyextra->lineNr,
1938 "Invalid or missing section label"
1939 );
1940 BEGIN(Comment);
1941 }
1942<SectionTitle>{STAopt}/"\n" { // end of section title
1945 BEGIN( Comment );
1946 }
1947<SectionTitle>{STopt}"\\\\ilinebr" { // escaped end of section title
1948 yyextra->sectionTitle+=yytext;
1949 }
1950<SectionTitle>{STopt}/"\\ilinebr" { // end of section title
1953 BEGIN( Comment );
1954 }
1955<SectionTitle>{B}*{CMD}"f$" {
1956 yyextra->formulaText="";
1957 yyextra->formulaPreText="$";
1958 yyextra->formulaPostText="";
1959 yyextra->formulaNewLines=0;
1960 BEGIN(ReadFormulaShortSection);
1961 }
1962<SectionTitle>{B}*{CMD}"f(" { // start of a inline formula
1963 yyextra->formulaText="";
1964 yyextra->formulaPreText="";
1965 yyextra->formulaPostText="";
1966 yyextra->formulaNewLines=0;
1967 BEGIN(ReadFormulaRoundSection);
1968 }
1969<SectionTitle>{B}*{CMD}"~"[a-z_A-Z-]* | // language switch command
1970<SectionTitle>{B}*{CMD}"f"[\[{] { // block formula
1974 warn(yyextra->fileName,yyextra->lineNr,
1975 "'\\{}' command is not allowed in section title, ending section title.",
1977 );
1979 BEGIN(Comment);
1980 }
1981<SectionTitle>{LC} { // line continuation
1982 yyextra->lineNr++;
1984 }
1985<SectionTitle>[^\n@\\]* { // any character without special meaning
1986 yyextra->sectionTitle+=yytext;
1988 }
1989<SectionTitle>{B}*{CMD}{CMD} {
1990 yyextra->sectionTitle+=yytext;
1992 }
1993<SectionTitle>{B}*{CMD}[a-z_A-Z]+"{"[^}]*"}"{B}* |
1994<SectionTitle>{B}*{CMD}[a-z_A-Z]+{B}* { // handling command in section title
1996 int idx = fullMatch.
find(
'{');
1997
1998 if ((idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT;
1999 int idxEnd = fullMatch.
find(
"}",idx+1);
2002 if (idx == -1)
2003 {
2005 }
2006 else
2007 {
2011 }
2014 {
2015 switch (it->second.sectionHandling)
2016 {
2018 {
2019 int i=0;
2020 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2021 yyextra->sectionTitle+=fullMatch.
left(i);
2022 yyextra->sectionTitle+='@';
2023 yyextra->sectionTitle+=fullMatch.
mid(i);
2027 warn(yyextra->fileName,yyextra->lineNr,
2028 "'\\{}' command is not allowed in section title, escaping command.",cmdName
2029 );
2030 }
2031 break;
2033 {
2036 warn(yyextra->fileName,yyextra->lineNr,
2037 "'\\{}' command is not allowed in section title, ending section title.",cmdName
2038 );
2040 BEGIN(Comment);
2041 }
2042 break;
2044 {
2045 if (cmdName == "fileinfo")
2046 {
2047 int i=0;
2048 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2049 yyextra->sectionTitle+=fullMatch.
left(i);
2052 if (idxEnd == -1)
2053 {
2054 yyextra->sectionTitle+=fullMatch.
mid(i+9);
2056 }
2057 else
2058 {
2059 yyextra->sectionTitle+=fullMatch.
mid(idxEnd+1);
2061 }
2062 }
2063 else if (cmdName == "lineinfo")
2064 {
2065 int i=0;
2066 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2067 yyextra->sectionTitle+=fullMatch.
left(i);
2069 yyextra->sectionTitle+=' ';
2070 yyextra->sectionTitle+=fullMatch.
mid(i+9);
2075 }
2076 else if (cmdName == "raisewarning")
2077 {
2078 yyextra->raiseWarning = "";
2079 BEGIN(RaiseWarningSection);
2080 }
2081 else if (cmdName == "noop")
2082 {
2084 BEGIN(Noop);
2085 }
2086 else if (cmdName == "cite")
2087 {
2088 yyextra->sectionTitle+=yytext;
2090 BEGIN(CiteLabelSection);
2091 }
2092 else if (cmdName == "iline")
2093 {
2094 yyextra->sectionTitle+=yytext;
2096 BEGIN(ILineSection);
2097 }
2098 else if (cmdName == "ifile")
2099 {
2100 yyextra->sectionTitle+=yytext;
2102 BEGIN(IFileSection);
2103 }
2104 else if ((cmdName == "anchor") || (cmdName == "ianchor"))
2105 {
2107 if (optList.empty())
2108 {
2109 yyextra -> anchorTitle = "";
2110 }
2111 else
2112 {
2114 yyextra -> anchorTitle =
join(optList,
" ");
2115 }
2117 BEGIN(AnchorLabelSection);
2118 }
2119 else if (cmdName == "link")
2120 {
2121 yyextra->sectionTitle+=yytext;
2122 BEGIN(LinkSection);
2123 }
2124 else
2125 {
2126 yyextra->sectionTitle+=yytext;
2127 warn(yyextra->fileName,yyextra->lineNr,
2128 "internal error '\\{}' command is to be replaced in section title.",cmdName
2129 );
2130 }
2131 }
2132 break;
2134 {
2135 yyextra->sectionTitle+=yytext;
2137 }
2138 break;
2139 }
2140 }
2141 else
2142 {
2143 yyextra->sectionTitle+=yytext;
2145 }
2146 }
2147<SectionTitle>. { // anything else
2148 yyextra->sectionTitle+=yytext;
2150 }
2151
2152
2153
2154<SubpageLabel>{FILE} { // first argument
2156
2157
2158 yyextra->current->extends.emplace_back(
QCString(yytext),Protection::Public,Specifier::Normal);
2159 BEGIN(SubpageTitle);
2160 }
2161<SubpageLabel>{DOCNL} { // missing argument
2162 warn(yyextra->fileName,yyextra->lineNr,
2163 "\\subpage command has no label"
2164 );
2165 if (*yytext=='\n') yyextra->lineNr++;
2167 BEGIN( Comment );
2168 }
2169<SubpageLabel>. {
2170 unput(yytext[0]);
2171 BEGIN( Comment );
2172 }
2173<SubpageTitle>{DOCNL} { // no title, end command
2175 BEGIN( Comment );
2176 }
2177<SubpageTitle>[ \t]*"\""[^\"\n]*"\"" { // add title, end of command
2179 BEGIN( Comment );
2180 }
2181<SubpageTitle>. { // no title, end of command
2182 unput(*yytext);
2183 BEGIN( Comment );
2184 }
2185
2186
2187
2188<AnchorLabel,AnchorLabelSection>{LABELID} { // found argument
2189 QCString lbl = yyextra->raisePrefix+yytext;
2190 addAnchor(yyscanner,lbl, yyextra->anchorTitle);
2192 if (YY_START == AnchorLabel)
2193 {
2194 BEGIN(Comment);
2195 }
2196 else
2197 {
2198 BEGIN(SectionTitle);
2199 }
2200 }
2201<AnchorLabel,AnchorLabelSection>{DOCNL} { // missing argument
2202 warn(yyextra->fileName,yyextra->lineNr,
2203 "\\anchor command has no label"
2204 );
2205 if (*yytext=='\n') yyextra->lineNr++;
2207 if (YY_START == AnchorLabel)
2208 {
2209 BEGIN(Comment);
2210 }
2211 else
2212 {
2213 BEGIN(SectionTitle);
2214 }
2215 }
2216<AnchorLabel,AnchorLabelSection>. { // invalid character for anchor label
2217 warn(yyextra->fileName,yyextra->lineNr,
2218 "Invalid or missing anchor label"
2219 );
2221 if (YY_START == AnchorLabel)
2222 {
2223 BEGIN(Comment);
2224 }
2225 else
2226 {
2227 BEGIN(SectionTitle);
2228 }
2229 }
2230
2231
2232
2233
2234<FormatBlock>{CMD}("endverbatim"|"endiverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"endicode"|"endmsc")/{NW} { // possible ends
2236 if (&yytext[4]==yyextra->blockName)
2237 {
2238 BEGIN(Comment);
2239 }
2240 }
2241<FormatBlock>{CMD}"enduml" {
2243 if (yyextra->blockName=="startuml")
2244 {
2245 BEGIN(Comment);
2246 }
2247 }
2248<FormatBlock>[^ \@\*\/\\\n]* { // some word
2250 }
2251<FormatBlock>{DOCNL} { // new line
2252 if (*yytext=='\n') yyextra->lineNr++;
2254 }
2255<FormatBlock>{CCS} { // start of a C-comment
2256 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2257 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2258 yyextra->blockName=="iliteral"
2259 )
2260 ) yyextra->commentCount++;
2262 }
2263<FormatBlock>{CCE} { // end of a C-comment
2265 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2266 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2267 yyextra->blockName=="iliteral"
2268 )
2269 )
2270 {
2271 yyextra->commentCount--;
2272 if (yyextra->commentCount<0)
2273 {
2274 QCString endTag =
"end"+yyextra->blockName;
2275 if (yyextra->blockName=="startuml") endTag="enduml";
2276 warn(yyextra->fileName,yyextra->lineNr,
2277 "found */ without matching /* while inside a \\{} block! Perhaps a missing \\{}?",
2278 yyextra->blockName,endTag);
2279 }
2280 }
2281 }
2282<FormatBlock>. {
2284 }
2285<FormatBlock><<EOF>> {
2286 QCString endTag =
"end"+yyextra->blockName;
2287 if (yyextra->blockName=="startuml") endTag="enduml";
2288 warn(yyextra->fileName,yyextra->lineNr,
2289 "reached end of comment while inside a \\{} block; check for missing \\{} tag!",
2290 yyextra->blockName,endTag
2291 );
2293 }
2294
2295
2296
2297<GuardParam>{B}*"(" {
2298 yyextra->guardExpr=yytext;
2299 yyextra->roundCount=1;
2300 BEGIN(GuardExpr);
2301 }
2302<GuardExpr>[^()]* {
2303 yyextra->guardExpr+=yytext;
2305 }
2306<GuardExpr>"(" {
2307 yyextra->guardExpr+=yytext;
2308 yyextra->roundCount++;
2309 }
2310<GuardExpr>")" {
2311 yyextra->guardExpr+=yytext;
2312 yyextra->roundCount--;
2313 if (yyextra->roundCount==0)
2314 {
2316 }
2317 }
2318<GuardExpr>\n {
2319 warn(yyextra->fileName,yyextra->lineNr,
2320 "invalid expression '{}' for yyextra->guards",yyextra->guardExpr);
2321 unput(*yytext);
2322 BEGIN(GuardParam);
2323 }
2324<GuardParam>{B}*[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot yyextra->guards
2326 }
2327<GuardParam>{DOCNL} { // end of argument
2328
2329
2333 }
2334<GuardParam>{LC} { // line continuation
2335 yyextra->lineNr++;
2337 }
2338<GuardParam>. { // empty condition
2339 unput(*yytext);
2341 }
2342<GuardParamEnd>{B}*{DOCNL} {
2344 yyextra->spaceBeforeIf.clear();
2346 BEGIN(Comment);
2347 }
2348<GuardParamEnd>{B}* {
2349 if (!yyextra->spaceBeforeIf.isEmpty())
2350 {
2351 addOutput(yyscanner,yyextra->spaceBeforeIf);
2352 }
2353 yyextra->spaceBeforeIf.clear();
2355 BEGIN(Comment);
2356 }
2357<GuardParamEnd>. {
2358 unput(*yytext);
2360 BEGIN(Comment);
2361 }
2362
2363
2364
2365<SkipGuardedSection>{CMD}"ifnot"/{NW} {
2367 yyextra->guards->emplace(false);
2368 BEGIN( GuardParam );
2369 }
2370<SkipGuardedSection>{CMD}"if"/{NW} {
2372 yyextra->guards->emplace(false);
2373 BEGIN( GuardParam );
2374 }
2375<SkipGuardedSection>{CMD}"endif"/{NW} {
2376 if (yyextra->guards->empty())
2377 {
2378 warn(yyextra->fileName,yyextra->lineNr,
2379 "found \\endif without matching start command");
2380 BEGIN( Comment );
2381 }
2382 else
2383 {
2384 yyextra->guards->pop();
2385 if (yyextra->guards->empty())
2386 {
2387 BEGIN( GuardParamEnd );
2388 }
2389 else
2390 {
2391 if (yyextra->guards->top().isEnabled())
2392 {
2393 BEGIN( GuardParamEnd );
2394 }
2395 else
2396 {
2397 BEGIN( SkipGuardedSection );
2398 }
2399 }
2400 }
2401 }
2402<SkipGuardedSection>{CMD}"else"/{NW} {
2403 if (yyextra->guards->empty())
2404 {
2405 warn(yyextra->fileName,yyextra->lineNr,
2406 "found \\else without matching start command");
2407 }
2408 else if (yyextra->guards->top().hasElse())
2409 {
2410 warn(yyextra->fileName,yyextra->lineNr,
2411 "found multiple \\else commands in same \\if construct");
2412 yyextra->guards->top().setEnabled(false);
2413 BEGIN( SkipGuardedSection );
2414 }
2415 else if (!yyextra->guards->top().parentVisible())
2416 {
2417 yyextra->guards->top().setEnabled(false);
2418 BEGIN( SkipGuardedSection );
2419 }
2420 else
2421 {
2422 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2423 yyextra->guards->top().setElse();
2424 if (!yyextra->guards->top().parentVisible())
2425 {
2426 yyextra->guards->top().setEnabled(false);
2427 BEGIN( SkipGuardedSection );
2428 }
2429 else if (yyextra->guards->top().isEnabledFound())
2430 {
2431 yyextra->guards->top().setEnabled(false);
2432 BEGIN( SkipGuardedSection );
2433 }
2434 else
2435 {
2436 yyextra->guards->top().setEnabled(true);
2437 BEGIN( GuardParamEnd );
2438 }
2439 }
2440 }
2441<SkipGuardedSection>{CMD}"elseif"/{NW} {
2442 if (yyextra->guards->empty())
2443 {
2444 warn(yyextra->fileName,yyextra->lineNr,
2445 "found \\elseif without matching start command");
2446 }
2447 else if (yyextra->guards->top().hasElse())
2448 {
2449 warn(yyextra->fileName,yyextra->lineNr,
2450 "found \\elseif command after \\else command was given in \\if construct");
2452 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2453 yyextra->guards->top().setEnabled(false);
2454 BEGIN( GuardParam );
2455 }
2456 else
2457 {
2459 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2460 yyextra->guards->top().setEnabled(false);
2461 BEGIN( GuardParam );
2462 }
2463 }
2464<SkipGuardedSection>{DOCNL} { // skip line
2465 if (*yytext=='\n') yyextra->lineNr++;
2466
2467 }
2468<SkipGuardedSection>[^ \\@\n]+ { // skip non-special characters
2469 }
2470<SkipGuardedSection>{CMD}{CMD} |
2471<SkipGuardedSection>. { // any other character
2472 }
2473
2474
2475
2476
2477<SkipInternal>{DOCNL} { // skip line
2478 if (*yytext=='\n') yyextra->lineNr++;
2480 }
2481<SkipInternal>[@\\]"if"/[ \t] {
2482 yyextra->condCount++;
2483 }
2484<SkipInternal>[@\\]"ifnot"/[ \t] {
2485 yyextra->condCount++;
2486 }
2487<SkipInternal>[@\\]/"endif" {
2488 yyextra->condCount--;
2489 if (yyextra->condCount<0)
2490 {
2491 unput('\\');
2492 BEGIN(Comment);
2493 }
2494 }
2495<SkipInternal>[@\\]/"section"[ \t] {
2496 if (yyextra->sectionLevel>0)
2497 {
2498 unput('\\');
2499 BEGIN(Comment);
2500 }
2501 }
2502<SkipInternal>[@\\]/"subsection"[ \t] {
2503 if (yyextra->sectionLevel>1)
2504 {
2505 unput('\\');
2506 BEGIN(Comment);
2507 }
2508 }
2509<SkipInternal>[@\\]/"subsubsection"[ \t] {
2510 if (yyextra->sectionLevel>2)
2511 {
2512 unput('\\');
2513 BEGIN(Comment);
2514 }
2515 }
2516<SkipInternal>[@\\]/"paragraph"[ \t] {
2517 if (yyextra->sectionLevel>3)
2518 {
2519 unput('\\');
2520 BEGIN(Comment);
2521 }
2522 }
2523<SkipInternal>[@\\]/"subparagraph"[ \t] {
2524 if (yyextra->sectionLevel>4)
2525 {
2526 unput('\\');
2527 BEGIN(Comment);
2528 }
2529 }
2530<SkipInternal>[@\\]/"subsubparagraph"[ \t] {
2531 if (yyextra->sectionLevel>5)
2532 {
2533 unput('\\');
2534 BEGIN(Comment);
2535 }
2536 }
2537<SkipInternal>[@\\]"endinternal"[ \t]* {
2538 BEGIN(Comment);
2539 }
2540<SkipInternal>[^ \\@\n]+ { // skip non-special characters
2541 }
2542<SkipInternal>. { // any other character
2543 }
2544
2545
2546
2547
2548<NameParam>{DOCNL} { // end of argument
2549
2550
2552 BEGIN( Comment );
2553 }
2554<NameParam>{LC} { // line continuation
2555 yyextra->lineNr++;
2557 yyextra->docGroup.appendHeader(' ');
2558 }
2559<NameParam>. { // ignore other stuff
2560 yyextra->docGroup.appendHeader(*yytext);
2561 yyextra->current->name+=*yytext;
2562 }
2563
2564
2565<Noop>{DOCNL} { // end of argument
2566 if (*yytext=='\n')
2567 {
2568 yyextra->lineNr++;
2570 }
2571 BEGIN( Comment );
2572 }
2573<Noop>. { // ignore other stuff
2574 }
2575
2576<RaiseWarning,RaiseWarningSection>{DOCNL} { // end of argument
2578 "{}",yyextra->raiseWarning);
2579 yyextra->raiseWarning = "";
2580 if (*yytext=='\n') yyextra->lineNr++;
2582 if (YY_START == RaiseWarning)
2583 {
2584 BEGIN(Comment);
2585 }
2586 else
2587 {
2588 yyextra->sectionTitle+=yytext;
2589 BEGIN(SectionTitle);
2590 }
2591 }
#define warn_doc_error(file, line, fmt,...)
2592<RaiseWarning,RaiseWarningSection>. { // ignore other stuff
2593 yyextra->raiseWarning += yytext;
2594 }
2595
2596
2597<InGroupParam>{LABELID} { // group id
2598 yyextra->current->groups.emplace_back(
2600 );
2601 yyextra->inGroupParamFound=
TRUE;
2602 }
@ GROUPING_INGROUP
membership in group was defined by @ingroup
2603<InGroupParam>{DOCNL} { // missing argument
2604 if (!yyextra->inGroupParamFound)
2605 {
2606 warn(yyextra->fileName,yyextra->lineNr,
2607 "Missing group name for \\ingroup command"
2608 );
2609 }
2610
2611
2613 BEGIN( Comment );
2614 }
2615<InGroupParam>{LC} { // line continuation
2616 yyextra->lineNr++;
2618 }
2619<InGroupParam>. { // ignore other stuff
2621 }
2622
2623
2624
2625<FnParam>{DOCNL} { // end of argument
2626 if (yyextra->braceCount==0)
2627 {
2628 if (yyextra->functionProto.stripWhiteSpace().isEmpty())
2629 {
2630 warn(yyextra->fileName,yyextra->lineNr,
2631 "missing argument after '\\{}'.",yyextra->currentCmd
2632 );
2633 }
2634 else
2635 {
2637 yyextra->langParser->parsePrototype(yyextra->functionProto);
2638 }
2640 BEGIN( Comment );
2641 }
2642 }
2643<FnParam>{LC} { // line continuation
2644 yyextra->lineNr++;
2645 yyextra->functionProto+=' ';
2646 }
2647<FnParam>[^@\\\n()]+ { // non-special characters
2648 yyextra->functionProto+=yytext;
2649 }
2650<FnParam>"(" {
2651 yyextra->functionProto+=yytext;
2652 yyextra->braceCount++;
2653 }
2654<FnParam>")" {
2655 yyextra->functionProto+=yytext;
2656 yyextra->braceCount--;
2657 }
2658<FnParam>. { // add other stuff
2659 yyextra->functionProto+=*yytext;
2660 }
2661
2662
2663
2664
2665
2666<OverloadParam>{DOCNL} { // end of argument
2667 if (*yytext=='\n') yyextra->lineNr++;
2668 if (yyextra->functionProto.stripWhiteSpace().isEmpty())
2669 {
2672 }
2673 else
2674 {
2676 yyextra->langParser->parsePrototype(yyextra->functionProto);
2677 }
2678 BEGIN( Comment );
2679 }
QCString getOverloadDocs()
2680<OverloadParam>{LC} { // line continuation
2681 yyextra->lineNr++;
2682 yyextra->functionProto+=' ';
2683 }
2684<OverloadParam>. { // add other stuff
2685 yyextra->functionProto+=*yytext;
2686 }
2687
2688
2689
2690<InheritParam>({ID}("::"|"."))*{ID} { // found argument
2691 yyextra->current->extends.emplace_back(
2693 );
2694 BEGIN( Comment );
2695 }
2696<InheritParam>{DOCNL} { // missing argument
2697 warn(yyextra->fileName,yyextra->lineNr,
2698 "\\inherit command has no argument"
2699 );
2700 if (*yytext=='\n') yyextra->lineNr++;
2702 BEGIN( Comment );
2703 }
2704<InheritParam>. { // invalid character for anchor label
2705 warn(yyextra->fileName,yyextra->lineNr,
2706 "Invalid or missing name for \\inherit command"
2707 );
2708 BEGIN(Comment);
2709 }
2710
2711
2712
2713<ExtendsParam>({ID}("::"|"."))*{ID} { // found argument
2714 yyextra->current->extends.emplace_back(
2716 );
2717 BEGIN( Comment );
2718 }
2719<ExtendsParam>{DOCNL} { // missing argument
2720 warn(yyextra->fileName,yyextra->lineNr,
2721 "'\\{}' command has no argument",yyextra->currentCmd
2722 );
2723
2724
2726 BEGIN( Comment );
2727 }
2728<ExtendsParam>. { // ignore other stuff
2729 }
2730
2731
2732
2733<SkipLang>[\\@]"~"[a-zA-Z-]* { /* language switch */
2736 {
2737 warn(yyextra->fileName,yyextra->lineNr,
2739 }
2740 else if (langId.isEmpty() ||
2742 {
2743 BEGIN(Comment);
2744 }
2745 }
2746<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
2747 }
2748<SkipLang>{DOCNL} { /* new line in verbatim block */
2749 if (*yytext=='\n') yyextra->lineNr++;
2750 }
2751<SkipLang>. { /* any other character */
2752 }
2753
2754
2755
2756<CiteLabel,CiteLabelSection>{CITEID} { // found argument
2759 if (YY_START == CiteLabel)
2760 {
2761 BEGIN(Comment);
2762 }
2763 else
2764 {
2765 yyextra->sectionTitle+=yytext;
2766 BEGIN(SectionTitle);
2767 }
2768 }
2769<CiteLabel,CiteLabelSection>{DOCNL} { // missing argument
2770 warn(yyextra->fileName,yyextra->lineNr,
2771 "\\cite command has no label"
2772 );
2773
2774
2775 if (YY_START == CiteLabel)
2776 {
2778 BEGIN(Comment);
2779 }
2780 else
2781 {
2782 yyextra->sectionTitle+=yytext;
2784 BEGIN(SectionTitle);
2785 }
2786 }
2787<CiteLabel,CiteLabelSection>. { // invalid character for cite label
2788 warn(yyextra->fileName,yyextra->lineNr,
2789 "Invalid or missing cite label"
2790 );
2791 if (YY_START == CiteLabel)
2792 {
2793 BEGIN(Comment);
2794 }
2795 else
2796 {
2797 yyextra->sectionTitle+=yytext;
2798 BEGIN(SectionTitle);
2799 }
2800 }
2801
2802
2803
2804<CopyDoc><<EOF>> {
2806 addOutput(yyscanner,
" \\ilinebr\\ilinebr\\copydetails ");
2807 addOutput(yyscanner,yyextra->copyDocArg);
2809 BEGIN(Comment);
2810 }
2811<CopyDoc>{DOCNL} {
2812 if (*yytext=='\n') yyextra->lineNr++;
2813 if (yyextra->braceCount==0)
2814 {
2816 addOutput(yyscanner,
" \\ilinebr\\ilinebr\\copydetails ");
2817 addOutput(yyscanner,yyextra->copyDocArg);
2819 BEGIN(Comment);
2820 }
2821 }
2822<CopyDoc>{LC} { // line continuation
2823 yyextra->lineNr++;
2824 }
2825<CopyDoc>[^@\\\n()]+ { // non-special characters
2826 yyextra->copyDocArg+=yytext;
2828 }
2829<CopyDoc>"(" {
2830 yyextra->copyDocArg+=yytext;
2832 yyextra->braceCount++;
2833 }
2834<CopyDoc>")" {
2835 yyextra->copyDocArg+=yytext;
2837 yyextra->braceCount--;
2838 }
2839<CopyDoc>. {
2840 yyextra->copyDocArg+=yytext;
2842 }
2843
2844
2845<*>. { fprintf(stderr,"Lex scanner %s %sdefault rule for state %s: #%s#\n", __FILE__,!yyextra->fileName.isEmpty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START),yytext);}
2846<*>\n { fprintf(stderr,"Lex scanner %s %sdefault rule newline for state %s.\n", __FILE__, !yyextra->fileName.isEmpty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START));}
2847 */
2848
2849%%