715 {CMD}{CMD}[a-z_A-Z]+{B}* {
717 }
718<Comment>{CMD}{CMD}"~"[a-z_A-Z]* { // escaped command
720 }
721<Comment>{MAILADDR} { // mail address
723 }
724<Comment>"\""[^"\n]*"\"" { // quoted text
726 }
727<Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!)
729 }
730<Comment>"<"{DETAILEDHTML}{ATTR}">" { // HTML command that ends a brief description
732 int spacePos = htmlOpenTag.find(' ');
733 if (spacePos==-1) spacePos=yyleng-1;
734 QCString htmlTagName = htmlOpenTag.
mid(1,spacePos-1);
735
736 yyextra->htmlContextStack.emplace_back(htmlTagName,yyextra->inContext);
738 {
740 }
741
742 REJECT;
743 }
744<Comment>"</"{DETAILEDHTML}">" { // HTML command that ends a brief description
746 QCString htmlTagName = htmlCloseTag.
mid(2,htmlCloseTag.length()-3);
747
748 if (!yyextra->htmlContextStack.empty() &&
749 yyextra->htmlContextStack.back().tagName==htmlTagName)
750 {
752 {
753
755 }
756 yyextra->htmlContextStack.pop_back();
757 }
758 REJECT;
759 }
760<Comment>"<"{DETAILEDHTMLOPT}">" { // HTML <code> command that ends a brief description
761
763 {
764 yyextra->CScode=true;
767 }
768 else
769 {
770
771 REJECT;
772 }
773 }
774<Comment>"<"{DETAILEDHTMLOPTEND}">" { // HTML command that ends a brief description
775 if (yyextra->CScode)
776 {
778 yyextra->CScode=false;
779 }
780 else
781 {
782 yyextra->CScode=false;
783
784 REJECT;
785 }
786 }
787<Comment>"<"{DETAILEDHTMLOPT}{ATTR}">" { // HTML <code> command that ends a brief description
788
790 {
792 }
793
794 REJECT;
795 }
796<Comment>"<"{DETAILS}{ATTR}">" { // start of a HTML style details description
797 yyextra->htmlDetailsStack.push_back(0);
798 yyextra->htmlContextStack.emplace_back("details",yyextra->inContext);
800 {
802 }
804 }
805<Comment>"</"{DETAILS}">" { // end of a HTML style details description
806 if (!yyextra->htmlDetailsStack.empty())
807 {
808 yyextra->htmlDetailsStack.pop_back();
809 }
810 if (!yyextra->htmlContextStack.empty() &&
811 yyextra->htmlContextStack.back().tagName=="details")
812 {
814 {
815
817 }
818 yyextra->htmlContextStack.pop_back();
819 }
821 }
822<Comment>"<"{AHTML} { // potential start of HTML anchor, see issue 9200
823 yyextra->htmlAnchorStr = yytext;
824 yyextra->htmlAnchor = false;
825 BEGIN(HtmlA);
826 }
827<HtmlA>{ANCHTML} { // only labels that can be converted to doxygen anchor
828 yyextra->htmlAnchorStr += yytext;
830 int s=tag.find("=");
831 char c=tag[s+1];
833 if (c=='\'' || c=='"')
834 {
835 int e=tag.find(c,s+2);
836 if (e!=-1)
837 {
838 id=tag.mid(s+2,e-s-2);
840 }
841 }
842 else
843 {
844 id=tag.mid(s+1);
846 }
847 if (!id.isEmpty() && !yyextra->htmlAnchor)
848 {
849
853 yyextra->htmlAnchor = true;
854 }
855 }
856<HtmlA>("\""[^\n\"]*"\""|"'"[^\n']*"'") {
857 yyextra->htmlAnchorStr += yytext;
858 }
859<HtmlA>">"|"/>" {
860 if (!yyextra->htmlAnchor)
861 {
862 addOutput(yyscanner,yyextra->htmlAnchorStr);
864 }
865 else
866 {
867 if (yyleng == 1)
868 {
870 }
871 }
872 BEGIN(Comment);
873 }
874<HtmlA>{DOCNL} { // newline
875 yyextra->htmlAnchorStr += yytext;
876 if (*yytext == '\n') yyextra->lineNr++;
877 }
878<HtmlA>. { // catch-all for anything else
879 yyextra->htmlAnchorStr += yytext;
880 }
881<Comment>"<"{SUMMARY}">" { // start of a .NET XML style brief description
882 if (yyextra->htmlDetailsStack.empty())
883 {
885 }
886 else
887 {
889 }
890 }
891<Comment>"<"{REMARKS}">" { // start of a .NET XML style detailed description
894 }
895<Comment>"</"{SUMMARY}">" { // start of a .NET XML style detailed description
896 if (!yyextra->htmlDetailsStack.empty())
897 {
899 }
900 else
901 {
903 }
904 }
905<Comment>"</"{REMARKS}">" { // end of a brief or detailed description
908 }
909<Comment>"<"{CAPTION}{ATTR}">" {
911 int s=tag.find("id=");
912 if (s!=-1)
913 {
914 char c=tag[s+3];
915 if (c=='\'' || c=='"')
916 {
917 int e=tag.find(c,s+4);
918 if (e!=-1)
919 {
922 }
923 }
924 }
926 }
927<Comment>"<"{PRE}{ATTR}">" {
928 yyextra->insidePre=
TRUE;
930 }
931<Comment>"</"{PRE}">" {
932 yyextra->insidePre=
FALSE;
934 }
935<Comment>{RCSTAG} { // RCS tag which end a brief description
937 REJECT;
938 }
939<Comment>"<!--" {
940 BEGIN(HtmlComment);
941 }
942<Comment>"<!\[CDATA\[" {
943 BEGIN(CdataSection);
944 }
945<Comment>{B}*{CMD}"endinternal"{B}* {
947 if (!yyextra->inInternalDocs)
948 warn(yyextra->fileName,yyextra->lineNr,
949 "found \\endinternal without matching \\internal"
950 );
951 yyextra->inInternalDocs =
FALSE;
952 }
953<Comment>{B}*"\\ilinebr "{B}* { // preserve spacing around \\ilinebr
955 }
956<Comment>(\n|"\\ilinebr ")/({B}*(\n|{IFILELINE}?"\\ilinebr "))+ { // at least one blank line (or blank line command)
958 {
960 }
961 else
962 {
963 REJECT;
964 }
965 }
966<Comment>{B}*{CMD}[a-z_A-Z]+"{"[^}]*"}"{B}* |
967<Comment>{B}*{CMD}[a-z_A-Z]+{B}* { // potentially interesting command
968
970 int idx = fullMatch.
find(
'{');
971
972 if ((idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT;
973 int idxEnd = fullMatch.
find(
"}",idx+1);
976 if (idx == -1)
977 {
979 }
980 else
981 {
985 }
987
989 {
990 int i=0;
991 while (yytext[i]==' ' || yytext[i]=='\t') i++;
995 !(yyextra->inContext==
OutputXRef && cmdName==
"parblock"))
996 {
997 yyextra->briefEndsAtDot=
FALSE;
999
1001 }
1002
1003 if (it->second.handler && it->second.handler(yyscanner, cmdName, optList))
1004 {
1005
1006
1007
1008 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.
1009
1010 yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);
1012 }
1013 else if (it->second.handler==nullptr)
1014 {
1015
1016
1018 }
1019 }
1020 else
1021 {
1023 }
1024 }
1025<Comment>{B}*({CMD}{CMD})"f"[$\[{] { // escaped formula command
1027 }
1028<Comment>{B}*{CMD}"~"[a-z_A-Z-]* { // language switch command
1032 {
1034 {
1035 warn(yyextra->fileName,yyextra->lineNr,
1037 }
1038 BEGIN(SkipLang);
1039 }
1040 }
#define Config_getEnumAsString(name)
#define Config_isAvailableEnum(name, value)
int qstricmp(const char *s1, const char *s2)
1041<Comment>{B}*{CMD}"f{"[^}\n]+"}"("{"?) { // start of a formula with custom environment
1043 yyextra->formulaText="";
1044 yyextra->formulaPreText="\\begin";
1045 yyextra->formulaPostText="";
1047 if (yyextra->formulaEnv.at(yyextra->formulaEnv.length()-1)=='{')
1048 {
1049
1050 yyextra->formulaEnv=yyextra->formulaEnv.left(yyextra->formulaEnv.length()-1);
1051 }
1052 yyextra->formulaPreText+=yyextra->formulaEnv;
1053 yyextra->formulaNewLines=0;
1054 BEGIN(ReadFormulaLong);
1055 }
1056<Comment>{B}*{CMD}"f$" { // start of a inline formula
1057 yyextra->formulaText="";
1058 yyextra->formulaPreText="$";
1059 yyextra->formulaPostText="";
1060 yyextra->formulaNewLines=0;
1061 BEGIN(ReadFormulaShort);
1062 }
1063<Comment>{B}*{CMD}"f(" { // start of a inline formula
1064 yyextra->formulaText="";
1065 yyextra->formulaPreText="";
1066 yyextra->formulaPostText="";
1067 yyextra->formulaNewLines=0;
1068 BEGIN(ReadFormulaRound);
1069 }
1070<Comment>{B}*{CMD}"f[" { // start of a block formula
1072 yyextra->formulaText="";
1073 yyextra->formulaPreText="\\[";
1074 yyextra->formulaPostText="";
1075 yyextra->formulaNewLines=0;
1076 BEGIN(ReadFormulaLong);
1077 }
1078<Comment>{B}*{CMD}"{" { // begin of a group
1079
1080 yyextra->docGroup.open(yyextra->current,yyextra->fileName,yyextra->lineNr);
1081 }
1082<Comment>{B}*{CMD}"}" { // end of a group
1083
1084 yyextra->docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,
TRUE);
1085 yyextra->docGroup.clearHeader();
1086 yyextra->parseMore=
TRUE;
1087 yyextra->needNewEntry =
TRUE;
1088 yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) + (int)strlen(yytext);
1090 }
1091<Comment>{B}*{CMD}[$@\\&~<>#%] { // escaped character
1093 }
1094<Comment>[a-z_A-Z]+ { // normal word
1096 }
1097<Comment>^{B}*"."{Bopt}/\n { // explicit end autolist: e.g " ."
1099 }
1100<Comment>^{B}*[1-9][0-9]*"."{B}+ |
1101<Comment>^{B}*[*+]{B}+ { // start of autolist
1102 if (!yyextra->markdownSupport)
1103 {
1104 REJECT;
1105 }
1106 else
1107 {
1109 {
1110 yyextra->briefEndsAtDot=
FALSE;
1112 }
1114 }
1115 }
1116<Comment>^{B}*"-"{B}+ { // start of autolist
1118 {
1119 yyextra->briefEndsAtDot=
FALSE;
1121 }
1123 }
1124<Comment>^{B}*([\-:|]{B}*)*("--"|"---")({B}*[\-:|])*{Bopt}/\n { // horizontal line (dashed)
1126 }
1127<Comment>{CMD}"---" { // escaped mdash
1129 }
1130<Comment>{CMD}"--" { // escaped mdash
1132 }
1133<Comment>"---" { // mdash
1134 addOutput(yyscanner,yyextra->insidePre || yyextra->markdownSupport ? yytext :
"—");
1135 }
1136<Comment>"--" { // ndash
1137 addOutput(yyscanner,yyextra->insidePre || yyextra->markdownSupport ? yytext :
"–");
1138 }
1139<Comment>"-#"{B}+ { // numbered item
1141 {
1142 yyextra->briefEndsAtDot=
FALSE;
1144 }
1146 }
1147<Comment>[?!][a-z_A-Z0-9\(\)=<] |
1148<Comment>("."+)[a-z_A-Z0-9\)] { // . at start or in the middle of a word, or ellipsis
1149
1151 }
1152<Comment>{CMD}[\.?!] { // we have to be a bit careful with the special commands
1153
1155 }
1156<Comment>".\\"[ \t] { // . with escaped space.
1159 }
1160<Comment>"."[,:;] { // . with some puntuations such as "e.g.," or "e.g.:"
1162 }
1163<Comment>"...\\"[ \t] { // ellipsis with escaped space.
1165 }
1166<Comment>"..."/[^\.] { // ellipsis
1168 }
1169<Comment>".."[\.]?/[^ \t\n] { // internal ellipsis
1171 }
1172<Comment>(\n|"\\ilinebr ")({B}*(\n|"\\ilinebr "))+ { // at least one blank line (or blank line command)
1174 {
1175
1177 yy_size_t i;
1178 for (i=0;i<(yy_size_t)yyleng;)
1179 {
1180 if (yytext[i]==
'\n')
addOutput(yyscanner,
'\n'),i++;
1181 else if (strncmp(yytext+i,
"\\ilinebr ",9)==0)
addOutput(yyscanner,
"\\ilinebr "),i+=9;
1182 else i++;
1183 }
1184 }
1186 {
1187 yy_size_t i;
1188 for (i=0;i<(yy_size_t)yyleng;)
1189 {
1190 if (yytext[i]==
'\n')
addOutput(yyscanner,
'\n'),i++;
1191 else if (strncmp(yytext+i,
"\\ilinebr ",9)==0)
addOutput(yyscanner,
"\\ilinebr "),i+=9;
1192 else i++;
1193 }
1195 }
1196 else
1197 {
1198
1200 }
1202 }
1203<Comment>"."[?!] |
1204<Comment>[\.?!] { // potential end of a JavaDoc style comment
1206 if (yyextra->briefEndsAtDot)
1207 {
1209 yyextra->briefEndsAtDot=
FALSE;
1210 }
1211 }
1212<Comment>{DOCNL} { // newline
1214 if (*yytext == '\n') yyextra->lineNr++;
1215 }
1216<Comment>. { // catch-all for anything else
1218 }
1219
1220
1221
1222
1223<HtmlComment>"---"[!]?">"{B}* {
1224 warn(yyextra->fileName,yyextra->lineNr,
1225 "incorrect HTML end comment --->"
1226 );
1227 }
1228<HtmlComment>"--"[!]?">"{B}* { BEGIN( Comment ); }
1229<HtmlComment>{DOCNL} {
1230 if (*yytext=='\n')
1231 {
1232 yyextra->lineNr++;
1234 }
1235 }
1236<HtmlComment>[^\\\n\-]+ { // ignore unimportant characters
1237 }
1238<HtmlComment>. { // ignore every else
1239 }
1240
1241<CdataSection>"\]\]>" {
1242 BEGIN( Comment );
1243 }
1244<CdataSection>{DOCNL} {
1246 if (*yytext=='\n') yyextra->lineNr++;
1247 }
1248<CdataSection>[<>&] { // the special XML characters for iwhich the CDATA section is especially used
1251 }
1252<CdataSection>[^\\\n\]<>&]+ {
1254 }
1255<CdataSection>. {
1257 }
1258
1259
1260
1261<ReadFormulaShort,ReadFormulaShortSection>{CMD}"f$" { // end of inline formula
1262 yyextra->formulaPostText+="$";
1265 if (YY_START == ReadFormulaShort)
1266 {
1267 BEGIN(Comment);
1268 }
1269 else
1270 {
1271 yyextra->sectionTitle+= " "+form;
1272 BEGIN(SectionTitle);
1273 }
1274 }
1275<ReadFormulaRound,ReadFormulaRoundSection>{CMD}"f)" { // end of inline formula
1278 if (YY_START == ReadFormulaRound)
1279 {
1280 BEGIN(Comment);
1281 }
1282 else
1283 {
1284 yyextra->sectionTitle+= " "+form;
1285 BEGIN(SectionTitle);
1286 }
1287 }
1288<ReadFormulaLong>{CMD}"f]" { // end of block formula
1289 yyextra->formulaPostText+="\\]";
1291 BEGIN(Comment);
1292 }
1293<ReadFormulaLong>{CMD}"f}" { // end of custom env formula
1294 yyextra->formulaPostText+="\\end";
1295 yyextra->formulaPostText+=yyextra->formulaEnv;
1297 BEGIN(Comment);
1298 }
1299<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>[^\\@\n]+ { // any non-special character
1300 yyextra->formulaText+=yytext;
1301 }
1302<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>\n { // new line
1303 yyextra->formulaNewLines++;
1304 yyextra->formulaText+=*yytext;
1305 yyextra->lineNr++;
1306 addIline(yyscanner,yyextra->lineNr);
1307 }
1308<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>. { // any other character
1309 yyextra->formulaText+=*yytext;
1310 }
1311
1312
1313
1314<EnumDocArg1>{SCOPEID} { // handle argument
1316 yyextra->current->name = yytext;
1317 BEGIN( Comment );
1318 }
1319<EnumDocArg1>{LC} { // line continuation
1320 yyextra->lineNr++;
1322 }
1323<EnumDocArg1>{DOCNL} { // missing argument
1324 warn(yyextra->fileName,yyextra->lineNr,
1325 "missing argument after '\\enum'."
1326 );
1328 BEGIN( Comment );
1329 }
1330<EnumDocArg1>. { // ignore other stuff
1331 }
1332
1333
1334
1335<NameSpaceDocArg1>{SCOPENAME} { // handle argument
1339 BEGIN( Comment );
1340 }
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)
1341<NameSpaceDocArg1>{LC} { // line continuation
1342 yyextra->lineNr++;
1344 }
1345<NameSpaceDocArg1>{DOCNL} { // missing argument
1346 warn(yyextra->fileName,yyextra->lineNr,
1347 "missing argument after '\\namespace'."
1348 );
1350 BEGIN( Comment );
1351 }
1352<NameSpaceDocArg1>. { // ignore other stuff
1353 }
1354
1355
1356
1357<PackageDocArg1>{ID}("."{ID})* { // handle argument
1358 yyextra->current->name = yytext;
1359 BEGIN( Comment );
1360 }
1361<PackageDocArg1>{LC} { // line continuation
1362 yyextra->lineNr++;
1364 }
1365<PackageDocArg1>{DOCNL} { // missing argument
1366 warn(yyextra->fileName,yyextra->lineNr,
1367 "missing argument after \\package."
1368 );
1370
1371
1372 BEGIN( Comment );
1373 }
1374<PackageDocArg1>. { // ignore other stuff
1375 }
1376
1377
1378
1379<ConceptDocArg1>{SCOPEID} { // handle argument
1381 yyextra->current->name = yytext;
1382 BEGIN( Comment );
1383 }
1384<ConceptDocArg1>{LC} { // line continuation
1385 yyextra->lineNr++;
1387 }
1388<ConceptDocArg1>{DOCNL} { // missing argument
1389 warn(yyextra->fileName,yyextra->lineNr,
1390 "missing argument after '\\concept'."
1391 );
1393 BEGIN( Comment );
1394 }
1395<ConceptDocArg1>. { // ignore other stuff
1396 }
1397
1398
1399<ModuleDocArg1>{MODULE_ID} { // handle argument
1401 yyextra->current->name = yytext;
1402 BEGIN( Comment );
1403 }
1404<ModuleDocArg1>{LC} { // line continuation
1405 yyextra->lineNr++;
1407 }
1408<ModuleDocArg1>{DOCNL} { // missing argument
1409 warn(yyextra->fileName,yyextra->lineNr,
1410 "missing argument after '\\module'."
1411 );
1413 BEGIN( Comment );
1414 }
1415<ModuleDocArg1>. { // ignore other stuff
1416 }
1417
1418
1419
1420<ClassDocArg1>{SCOPENAME}{TMPLSPEC} {
1424 BEGIN( ClassDocArg2 );
1425 }
1426<ClassDocArg1>{SCOPENAME} { // first argument
1430 if (yyextra->current->section.isProtocolDoc())
1431 {
1432 yyextra->current->name+="-p";
1433 }
1434
1435 BEGIN( ClassDocArg2 );
1436 }
1437<CategoryDocArg1>{SCOPENAME}{B}*"("[^\)]+")" {
1441 BEGIN( ClassDocArg2 );
1442 }
1443<ClassDocArg1,CategoryDocArg1>{LC} { // line continuation
1444 yyextra->lineNr++;
1446 }
1447<ClassDocArg1,CategoryDocArg1>{DOCNL} {
1448 warn(yyextra->fileName,yyextra->lineNr,
1449 "missing argument after '\\{}'.",yyextra->currentCmd
1450 );
1452 BEGIN( Comment );
1453 }
1454<ClassDocArg1,CategoryDocArg1>. { // ignore other stuff
1455 }
1456
1457<ClassDocArg2>{DOCNL} {
1459 BEGIN( Comment );
1460 }
1461<ClassDocArg2>{FILE}|"<>" { // second argument; include file
1462 yyextra->current->includeFile = yytext;
1463 BEGIN( ClassDocArg3 );
1464 }
1465<ClassDocArg2>{LC} { // line continuation
1466 yyextra->lineNr++;
1468 }
1469<ClassDocArg2>. { // ignore other stuff
1470 }
1471
1472<ClassDocArg3>[<"]?{FILE}?[">]? { // third argument; include file name
1473 yyextra->current->includeName = yytext;
1474 BEGIN( Comment );
1475 }
1476<ClassDocArg3>{LC} { // line continuation
1477 yyextra->lineNr++;
1479 }
1480<ClassDocArg3>{DOCNL} {
1481
1483 BEGIN( Comment );
1484 }
1485<ClassDocArg3>. { // ignore other stuff
1486 }
1487
1488
1489
1490<GroupDocArg1>{LABELID}(".html"?) { // group name
1491 yyextra->current->name = yytext;
1492
1493
1494
1495 if (yyextra->current->name.endsWith(".html"))
1496 {
1497 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-5);
1498 }
1499 yyextra->current->type.clear();
1500 BEGIN(GroupDocArg2);
1501 }
1502<GroupDocArg1>"\\"{B}*"\n" { // line continuation
1503 yyextra->lineNr++;
1505 }
1506<GroupDocArg1>{DOCNL} { // missing argument!
1507 warn(yyextra->fileName,yyextra->lineNr,
1508 "missing group name after {}",
1509 yyextra->current->groupDocCmd()
1510 );
1511
1512
1514 BEGIN( Comment );
1515 }
1516<GroupDocArg1>. { // ignore other stuff
1517 }
1518<GroupDocArg2>"\\"{B}*"\n" { // line continuation
1519 yyextra->lineNr++;
1521 }
1522<GroupDocArg2>[^\n\\]+ { // title (stored in type)
1523 yyextra->current->type += yytext;
1524 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
1525 }
1526<GroupDocArg2>{DOCNL}+ {
1528 yyextra->current->type.isEmpty()
1529 )
1530 {
1531 warn(yyextra->fileName,yyextra->lineNr,
1532 "missing title after "
1533 "\\defgroup {}", yyextra->current->name
1534 );
1535 }
1537 int extraLineNr = 0;
1539 {
1540 for (int i = 0; i < yyleng; i++)
1541 {
1542 if (yytext[i]=='\n') extraLineNr++;
1543 }
1544 }
1545
1546
1548 {
1549 addOutput(yyscanner,
" \\ifile \""+ yyextra->fileName);
1550 addOutput(yyscanner,
"\" \\iline " +
QCString().setNum(yyextra->lineNr + extraLineNr) +
" \\ilinebr ");
1551 }
1552 BEGIN( Comment );
1553 }
1554<GroupDocArg2>. { // title (stored in type)
1555 yyextra->current->type += yytext;
1556 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
1557 }
1558
1559
1560
1561<PageDocArg1>[^\n]*"\\ilinebr @ianchor"\{[^\]\n]*\}{B}{FILE} { // special case where the Markdown processor has rewritten
1562
1563
1565 int start = text.
find(
'{');
1566 int end = text.
find(
'}',start+1);
1567 yyextra->current->name = text.
mid(
end+2);
1568 int istart = yyextra->current->name.
find(
"\\ilinebr");
1569 if (istart != -1)
1570 {
1571 QCString rest = yyextra->current->name.
mid(istart);
1573 yyextra->current->name = yyextra->current->name.mid(0,istart);
1574 }
1575 yyextra->current->args = text.
mid(start+1,
end-start-1);
1576
1577 BEGIN( PageDocArg2 );
1578 }
DirIterator end(const DirIterator &) noexcept
1579<PageDocArg1>{FILE} { // first argument; page name
1581 yyextra->current->args = "";
1582 BEGIN( PageDocArg2 );
1583 }
1584<PageDocArg1>{LC} { yyextra->lineNr++;
1586 }
1587<PageDocArg1>{DOCNL} {
1588 warn(yyextra->fileName,yyextra->lineNr,
1589 "missing argument after \\page."
1590 );
1592
1593
1594 BEGIN( Comment );
1595 }
1596<PageDocArg1>. { // ignore other stuff
1597 }
1598<PageDocArg2>{DOCNL} { // second argument; page title
1600
1601
1602 addOutput(yyscanner,
" \\ifile \""+ yyextra->fileName);
1603 addOutput(yyscanner,
"\" \\iline " +
QCString().setNum(yyextra->lineNr) +
" \\ilinebr ");
1604 BEGIN( Comment );
1605 }
1606<PageDocArg2>{CMD}[<>] {
1607
1611 yyextra->current->args += tmp;
1612 }
1613<PageDocArg2>. {
1614 yyextra->current->args += yytext;
1615 }
1616
1617<ParamArg1>{ID}/{B}*"," {
1619 }
1620<ParamArg1>"," {
1622 }
1623<ParamArg1>{DOCNL} {
1624 if (*yytext=='\n') yyextra->lineNr++;
1626 }
1627<ParamArg1>{ID} {
1629 BEGIN( Comment );
1630 }
1631<ParamArg1>. {
1632 unput(yytext[0]);
1633 BEGIN( Comment );
1634 }
1635
1636
1637
1638<FileDocArg1>{DOCNL} { // no file name specified
1640
1641
1642 BEGIN( Comment );
1643 }
1644<FileDocArg1>{FILE} { // first argument; name
1646 BEGIN( Comment );
1647 }
1648<FileDocArg1>{LC} { yyextra->lineNr++;
1650 }
1651<FileDocArg1>. { // ignore other stuff
1652 }
1653
1654
1655
1656<XRefItemParam1>{LABELID} { // first argument
1657 yyextra->newXRefItemKey=yytext;
1659 BEGIN(XRefItemParam2);
1660 }
1661<XRefItemParam1>{LC} { // line continuation
1662 yyextra->lineNr++;
1664 }
1665<XRefItemParam1>{DOCNL} { // missing arguments
1666 warn(yyextra->fileName,yyextra->lineNr,
1667 "Missing first argument of \\xrefitem"
1668 );
1669 if (*yytext=='\n') yyextra->lineNr++;
1672 BEGIN( Comment );
1673 }
1674<XRefItemParam1>. { // ignore other stuff
1675 }
1676
1677<XRefItemParam2>"\""[^\n\"]*"\"" { // second argument
1679 BEGIN(XRefItemParam3);
1680 }
1681<XRefItemParam2>{LC} { // line continuation
1682 yyextra->lineNr++;
1684 }
1685<XRefItemParam2>{DOCNL} { // missing argument
1686 warn(yyextra->fileName,yyextra->lineNr,
1687 "Missing second argument of \\xrefitem"
1688 );
1689 if (*yytext=='\n') yyextra->lineNr++;
1692 BEGIN( Comment );
1693 }
1694<XRefItemParam2>. { // ignore other stuff
1695 }
1696
1697<XRefItemParam3>"\""[^\n\"]*"\"" { // third argument
1700 BEGIN( Comment );
1701 }
1702<XRefItemParam2,XRefItemParam3>{LC} { // line continuation
1703 yyextra->lineNr++;
1705 }
1706<XRefItemParam3>{DOCNL} { // missing argument
1707 warn(yyextra->fileName,yyextra->lineNr,
1708 "Missing third argument of \\xrefitem"
1709 );
1710 if (*yytext=='\n') yyextra->lineNr++;
1713 BEGIN( Comment );
1714 }
1715<XRefItemParam3>. { // ignore other stuff
1716 }
1717
1718
1719
1720
1721<RelatesParam1>({ID}("::"|"."))*{ID} { // argument
1722 yyextra->current->relates = yytext;
1723
1724
1725
1726
1727 BEGIN( Comment );
1728 }
1729<RelatesParam1>{LC} { // line continuation
1730 yyextra->lineNr++;
1732 }
1733<RelatesParam1>{DOCNL} { // missing argument
1734 warn(yyextra->fileName,yyextra->lineNr,
1735 "Missing argument of '\\{}' command",yyextra->currentCmd
1736 );
1738
1739
1740 BEGIN( Comment );
1741 }
1742<RelatesParam1>. { // ignore other stuff
1743 }
1744
1745
1746
1747<Qualifier>{LABELID} { // unquoted version, simple label
1748 yyextra->current->qualifiers.emplace_back(yytext);
1749 BEGIN( Comment );
1750 }
1751<Qualifier>"\""[^\"]*"\"" { // quotes version, add without quotes
1752 std::string inp(yytext);
1753 yyextra->current->qualifiers.push_back(inp.substr(1,yyleng-2));
1754 BEGIN( Comment );
1755 }
1756<Qualifier>{DOCNL} { // missing argument
1757 warn(yyextra->fileName,yyextra->lineNr,
1758 "Missing argument of '\\{}' command",yyextra->currentCmd
1759 );
1761 BEGIN( Comment );
1762 }
1763<Qualifier>. {
1764 warn(yyextra->fileName,yyextra->lineNr,
1765 "Argument of '\\{}' command should be quoted",yyextra->currentCmd
1766 );
1768 BEGIN( Comment );
1769 }
1770
1771<ILine>{LINENR}/[\\@\n\.] |
1772<ILine>{LINENR}{B} {
1773 bool ok = false;
1775 if (!ok)
1776 {
1777 warn(yyextra->fileName,yyextra->lineNr,
"Invalid line number '{}' for iline command",yytext);
1778 }
1779 else
1780 {
1781 yyextra->lineNr = nr;
1782 }
1784 if (YY_START == ILine)
1785 {
1786 BEGIN(Comment);
1787 }
1788 else
1789 {
1790 yyextra->sectionTitle+=yytext;
1791 BEGIN(SectionTitle);
1792 }
1793 }
int toInt(bool *ok=nullptr, int base=10) const
1794<ILine,ILineSection>. {
1796 if (YY_START == ILine)
1797 {
1798 BEGIN(Comment);
1799 }
1800 else
1801 {
1802 yyextra->sectionTitle+=yytext;
1803 BEGIN(SectionTitle);
1804 }
1805 }
1806
1807
1808<IRaise>{B}*[0-9]+/[\\@\n\.] |
1809<IRaise>{B}*[0-9]+{B} {
1810 bool ok = false;
1812 if (!ok)
1813 {
1814 warn(yyextra->fileName,yyextra->lineNr,
"Invalid level '{}' for iraise command",yytext);
1815 }
1816 else
1817 {
1818 yyextra->raiseLevel = nr;
1819 }
1820 BEGIN(Comment);
1821 }
1822<IRaise>. {
1823 unput(yytext[0]);
1824 BEGIN(Comment);
1825 }
1826
1827
1828<IRaisePrefix>{B}*"\""({LABELID})?"\"" {
1830 yyextra->raisePrefix = text.stripWhiteSpace().mid(1,text.length()-2);
1832 BEGIN(Comment);
1833 }
1834<IRaisePrefix>. {
1835 unput(yytext[0]);
1836 BEGIN(Comment);
1837 }
1838
1839
1840
1841
1842<IFile,IFileSection>{FILE} {
1845 if (yytext[0] == '\"') yyextra->fileName = text.mid(1,text.length()-2);
1846 else yyextra->fileName = yytext;
1847 if (YY_START == IFile)
1848 {
1849 BEGIN(Comment);
1850 }
1851 else
1852 {
1853 yyextra->sectionTitle+=yytext;
1854 BEGIN(SectionTitle);
1855 }
1856 }
1857
1858<LinkSection>[^\\@\n]* {
1859 yyextra->sectionTitle+=yytext;
1860 }
1861<LinkSection>{CMD}{CMD} {
1862 yyextra->sectionTitle+=yytext;
1863 }
1864<LinkSection>{DOCNL} {
1866 if (*yytext == '\n') yyextra->lineNr++;
1867 yyextra->sectionTitle+=yytext;
1868 }
1869<LinkSection>{CMD}"endlink" {
1870 yyextra->sectionTitle+=yytext;
1871 BEGIN(SectionTitle);
1872 }
1873<LinkSection>. {
1874 yyextra->sectionTitle+=yytext;
1875 }
1876<LinkSection><<EOF>> {
1877 warn(yyextra->fileName,yyextra->lineNr,
1878 "reached end of comment while inside a '\\link' command, missing '\\endlink' command"
1879 );
1881 }
1882
1883
1884<LineParam>{CMD}{CMD} { // escaped command
1886 }
1887<LineParam>{DOCNL} { // end of argument
1888
1889
1891 BEGIN( Comment );
1892 }
1893<LineParam>{LC} { // line continuation
1894 yyextra->lineNr++;
1896 }
1897<LineParam>({CMD}{CMD}){ID} { // escaped command
1899 }
1900<LineParam>. { // ignore other stuff
1902 }
1903
1904
1905
1906<SectionLabel>{LABELID} { // first argument
1907 yyextra->sectionLabel=yyextra->raisePrefix+yytext;
1908 addOutput(yyscanner,yyextra->sectionLabel.data());
1909 yyextra->sectionTitle.clear();
1910 BEGIN(SectionTitle);
1911 }
1912<SectionLabel>{DOCNL} { // missing argument
1913 warn(yyextra->fileName,yyextra->lineNr,
1914 "\\section command has no label"
1915 );
1916 if (*yytext=='\n') yyextra->lineNr++;
1918 BEGIN( Comment );
1919 }
1920<SectionLabel>. { // invalid character for section label
1921 warn(yyextra->fileName,yyextra->lineNr,
1922 "Invalid or missing section label"
1923 );
1924 BEGIN(Comment);
1925 }
1926<SectionTitle>{STAopt}/"\n" { // end of section title
1929 BEGIN( Comment );
1930 }
1931<SectionTitle>{STopt}"\\\\ilinebr" { // escaped end of section title
1932 yyextra->sectionTitle+=yytext;
1933 }
1934<SectionTitle>{STopt}/"\\ilinebr" { // end of section title
1937 BEGIN( Comment );
1938 }
1939<SectionTitle>{B}*{CMD}"f$" {
1940 yyextra->formulaText="";
1941 yyextra->formulaPreText="$";
1942 yyextra->formulaPostText="";
1943 yyextra->formulaNewLines=0;
1944 BEGIN(ReadFormulaShortSection);
1945 }
1946<SectionTitle>{B}*{CMD}"f(" { // start of a inline formula
1947 yyextra->formulaText="";
1948 yyextra->formulaPreText="";
1949 yyextra->formulaPostText="";
1950 yyextra->formulaNewLines=0;
1951 BEGIN(ReadFormulaRoundSection);
1952 }
1953<SectionTitle>{B}*{CMD}"~"[a-z_A-Z-]* | // language switch command
1954<SectionTitle>{B}*{CMD}"f"[\[{] { // block formula
1958 warn(yyextra->fileName,yyextra->lineNr,
1959 "'\\{}' command is not allowed in section title, ending section title.",
1961 );
1963 BEGIN(Comment);
1964 }
1965<SectionTitle>{LC} { // line continuation
1966 yyextra->lineNr++;
1968 }
1969<SectionTitle>[^\n@\\]* { // any character without special meaning
1970 yyextra->sectionTitle+=yytext;
1972 }
1973<SectionTitle>{B}*{CMD}{CMD} {
1974 yyextra->sectionTitle+=yytext;
1976 }
1977<SectionTitle>{B}*{CMD}[a-z_A-Z]+"{"[^}]*"}"{B}* |
1978<SectionTitle>{B}*{CMD}[a-z_A-Z]+{B}* { // handling command in section title
1980 int idx = fullMatch.
find(
'{');
1981
1982 if ((idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT;
1983 int idxEnd = fullMatch.
find(
"}",idx+1);
1986 if (idx == -1)
1987 {
1989 }
1990 else
1991 {
1995 }
1998 {
1999 switch (it->second.sectionHandling)
2000 {
2002 {
2003 int i=0;
2004 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2005 yyextra->sectionTitle+=fullMatch.
left(i);
2006 yyextra->sectionTitle+='@';
2007 yyextra->sectionTitle+=fullMatch.
mid(i);
2011 warn(yyextra->fileName,yyextra->lineNr,
2012 "'\\{}' command is not allowed in section title, escaping command.",cmdName
2013 );
2014 }
2015 break;
2017 {
2020 warn(yyextra->fileName,yyextra->lineNr,
2021 "'\\{}' command is not allowed in section title, ending section title.",cmdName
2022 );
2024 BEGIN(Comment);
2025 }
2026 break;
2028 {
2029 if (cmdName == "fileinfo")
2030 {
2031 int i=0;
2032 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2033 yyextra->sectionTitle+=fullMatch.
left(i);
2036 if (idxEnd == -1)
2037 {
2038 yyextra->sectionTitle+=fullMatch.
mid(i+9);
2040 }
2041 else
2042 {
2043 yyextra->sectionTitle+=fullMatch.
mid(idxEnd+1);
2045 }
2046 }
2047 else if (cmdName == "lineinfo")
2048 {
2049 int i=0;
2050 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2051 yyextra->sectionTitle+=fullMatch.
left(i);
2053 yyextra->sectionTitle+=' ';
2054 yyextra->sectionTitle+=fullMatch.
mid(i+9);
2059 }
2060 else if (cmdName == "raisewarning")
2061 {
2062 yyextra->raiseWarning = "";
2063 BEGIN(RaiseWarningSection);
2064 }
2065 else if (cmdName == "noop")
2066 {
2068 BEGIN(Noop);
2069 }
2070 else if (cmdName == "cite")
2071 {
2072 yyextra->sectionTitle+=yytext;
2074 BEGIN(CiteLabelSection);
2075 }
2076 else if (cmdName == "iline")
2077 {
2078 yyextra->sectionTitle+=yytext;
2080 BEGIN(ILineSection);
2081 }
2082 else if (cmdName == "ifile")
2083 {
2084 yyextra->sectionTitle+=yytext;
2086 BEGIN(IFileSection);
2087 }
2088 else if ((cmdName == "anchor") || (cmdName == "ianchor"))
2089 {
2091 if (optList.empty())
2092 {
2093 yyextra -> anchorTitle = "";
2094 }
2095 else
2096 {
2098 yyextra -> anchorTitle =
join(optList,
" ");
2099 }
2101 BEGIN(AnchorLabelSection);
2102 }
2103 else if (cmdName == "link")
2104 {
2105 yyextra->sectionTitle+=yytext;
2106 BEGIN(LinkSection);
2107 }
2108 else
2109 {
2110 yyextra->sectionTitle+=yytext;
2111 warn(yyextra->fileName,yyextra->lineNr,
2112 "internal error '\\{}' command is to be replaced in section title.",cmdName
2113 );
2114 }
2115 }
2116 break;
2118 {
2119 yyextra->sectionTitle+=yytext;
2121 }
2122 break;
2123 }
2124 }
2125 else
2126 {
2127 yyextra->sectionTitle+=yytext;
2129 }
2130 }
2131<SectionTitle>. { // anything else
2132 yyextra->sectionTitle+=yytext;
2134 }
2135
2136
2137
2138<SubpageLabel>{FILE} { // first argument
2140
2141
2143 BEGIN(SubpageTitle);
2144 }
2145<SubpageLabel>{DOCNL} { // missing argument
2146 warn(yyextra->fileName,yyextra->lineNr,
2147 "\\subpage command has no label"
2148 );
2149 if (*yytext=='\n') yyextra->lineNr++;
2151 BEGIN( Comment );
2152 }
2153<SubpageLabel>. {
2154 unput(yytext[0]);
2155 BEGIN( Comment );
2156 }
2157<SubpageTitle>{DOCNL} { // no title, end command
2159 BEGIN( Comment );
2160 }
2161<SubpageTitle>[ \t]*"\""[^\"\n]*"\"" { // add title, end of command
2163 BEGIN( Comment );
2164 }
2165<SubpageTitle>. { // no title, end of command
2166 unput(*yytext);
2167 BEGIN( Comment );
2168 }
2169
2170
2171
2172<AnchorLabel,AnchorLabelSection>{LABELID} { // found argument
2173 QCString lbl = yyextra->raisePrefix+yytext;
2174 addAnchor(yyscanner,lbl, yyextra->anchorTitle);
2176 if (YY_START == AnchorLabel)
2177 {
2178 BEGIN(Comment);
2179 }
2180 else
2181 {
2182 BEGIN(SectionTitle);
2183 }
2184 }
2185<AnchorLabel,AnchorLabelSection>{DOCNL} { // missing argument
2186 warn(yyextra->fileName,yyextra->lineNr,
2187 "\\anchor command has no label"
2188 );
2189 if (*yytext=='\n') yyextra->lineNr++;
2191 if (YY_START == AnchorLabel)
2192 {
2193 BEGIN(Comment);
2194 }
2195 else
2196 {
2197 BEGIN(SectionTitle);
2198 }
2199 }
2200<AnchorLabel,AnchorLabelSection>. { // invalid character for anchor label
2201 warn(yyextra->fileName,yyextra->lineNr,
2202 "Invalid or missing anchor label"
2203 );
2205 if (YY_START == AnchorLabel)
2206 {
2207 BEGIN(Comment);
2208 }
2209 else
2210 {
2211 BEGIN(SectionTitle);
2212 }
2213 }
2214
2215
2216
2217
2218<FormatBlock>{CMD}("endverbatim"|"endiverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"endicode"|"endmsc")/{NW} { // possible ends
2220 if (&yytext[4]==yyextra->blockName)
2221 {
2222 BEGIN(Comment);
2223 }
2224 }
2225<FormatBlock>{CMD}"enduml" {
2227 if (yyextra->blockName=="startuml")
2228 {
2229 BEGIN(Comment);
2230 }
2231 }
2232<FormatBlock>[^ \@\*\/\\\n]* { // some word
2234 }
2235<FormatBlock>{DOCNL} { // new line
2236 if (*yytext=='\n') yyextra->lineNr++;
2238 }
2239<FormatBlock>{CCS} { // start of a C-comment
2240 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2241 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2242 yyextra->blockName=="iliteral"
2243 )
2244 ) yyextra->commentCount++;
2246 }
2247<FormatBlock>{CCE} { // end of a C-comment
2249 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2250 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2251 yyextra->blockName=="iliteral"
2252 )
2253 )
2254 {
2255 yyextra->commentCount--;
2256 if (yyextra->commentCount<0)
2257 {
2258 QCString endTag =
"end"+yyextra->blockName;
2259 if (yyextra->blockName=="startuml") endTag="enduml";
2260 warn(yyextra->fileName,yyextra->lineNr,
2261 "found */ without matching /* while inside a \\{} block! Perhaps a missing \\{}?",
2262 yyextra->blockName,endTag);
2263 }
2264 }
2265 }
2266<FormatBlock>. {
2268 }
2269<FormatBlock><<EOF>> {
2270 QCString endTag =
"end"+yyextra->blockName;
2271 if (yyextra->blockName=="startuml") endTag="enduml";
2272 warn(yyextra->fileName,yyextra->lineNr,
2273 "reached end of comment while inside a \\{} block; check for missing \\{} tag!",
2274 yyextra->blockName,endTag
2275 );
2277 }
2278
2279
2280
2281<GuardParam>{B}*"(" {
2282 yyextra->guardExpr=yytext;
2283 yyextra->roundCount=1;
2284 BEGIN(GuardExpr);
2285 }
2286<GuardExpr>[^()]* {
2287 yyextra->guardExpr+=yytext;
2289 }
2290<GuardExpr>"(" {
2291 yyextra->guardExpr+=yytext;
2292 yyextra->roundCount++;
2293 }
2294<GuardExpr>")" {
2295 yyextra->guardExpr+=yytext;
2296 yyextra->roundCount--;
2297 if (yyextra->roundCount==0)
2298 {
2300 }
2301 }
2302<GuardExpr>\n {
2303 warn(yyextra->fileName,yyextra->lineNr,
2304 "invalid expression '{}' for yyextra->guards",yyextra->guardExpr);
2305 unput(*yytext);
2306 BEGIN(GuardParam);
2307 }
2308<GuardParam>{B}*[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot yyextra->guards
2310 }
2311<GuardParam>{DOCNL} { // end of argument
2312
2313
2317 }
2318<GuardParam>{LC} { // line continuation
2319 yyextra->lineNr++;
2321 }
2322<GuardParam>. { // empty condition
2323 unput(*yytext);
2325 }
2326<GuardParamEnd>{B}*{DOCNL} {
2328 yyextra->spaceBeforeIf.clear();
2330 BEGIN(Comment);
2331 }
2332<GuardParamEnd>{B}* {
2333 if (!yyextra->spaceBeforeIf.isEmpty())
2334 {
2335 addOutput(yyscanner,yyextra->spaceBeforeIf);
2336 }
2337 yyextra->spaceBeforeIf.clear();
2339 BEGIN(Comment);
2340 }
2341<GuardParamEnd>. {
2342 unput(*yytext);
2344 BEGIN(Comment);
2345 }
2346
2347
2348
2349<SkipGuardedSection>{CMD}"ifnot"/{NW} {
2351 yyextra->guards->emplace(false);
2352 BEGIN( GuardParam );
2353 }
2354<SkipGuardedSection>{CMD}"if"/{NW} {
2356 yyextra->guards->emplace(false);
2357 BEGIN( GuardParam );
2358 }
2359<SkipGuardedSection>{CMD}"endif"/{NW} {
2360 if (yyextra->guards->empty())
2361 {
2362 warn(yyextra->fileName,yyextra->lineNr,
2363 "found \\endif without matching start command");
2364 BEGIN( Comment );
2365 }
2366 else
2367 {
2368 yyextra->guards->pop();
2369 if (yyextra->guards->empty())
2370 {
2371 BEGIN( GuardParamEnd );
2372 }
2373 else
2374 {
2375 if (yyextra->guards->top().isEnabled())
2376 {
2377 BEGIN( GuardParamEnd );
2378 }
2379 else
2380 {
2381 BEGIN( SkipGuardedSection );
2382 }
2383 }
2384 }
2385 }
2386<SkipGuardedSection>{CMD}"else"/{NW} {
2387 if (yyextra->guards->empty())
2388 {
2389 warn(yyextra->fileName,yyextra->lineNr,
2390 "found \\else without matching start command");
2391 }
2392 else if (yyextra->guards->top().hasElse())
2393 {
2394 warn(yyextra->fileName,yyextra->lineNr,
2395 "found multiple \\else commands in same \\if construct");
2396 yyextra->guards->top().setEnabled(false);
2397 BEGIN( SkipGuardedSection );
2398 }
2399 else if (!yyextra->guards->top().parentVisible())
2400 {
2401 yyextra->guards->top().setEnabled(false);
2402 BEGIN( SkipGuardedSection );
2403 }
2404 else
2405 {
2406 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2407 yyextra->guards->top().setElse();
2408 if (!yyextra->guards->top().parentVisible())
2409 {
2410 yyextra->guards->top().setEnabled(false);
2411 BEGIN( SkipGuardedSection );
2412 }
2413 else if (yyextra->guards->top().isEnabledFound())
2414 {
2415 yyextra->guards->top().setEnabled(false);
2416 BEGIN( SkipGuardedSection );
2417 }
2418 else
2419 {
2420 yyextra->guards->top().setEnabled(true);
2421 BEGIN( GuardParamEnd );
2422 }
2423 }
2424 }
2425<SkipGuardedSection>{CMD}"elseif"/{NW} {
2426 if (yyextra->guards->empty())
2427 {
2428 warn(yyextra->fileName,yyextra->lineNr,
2429 "found \\elseif without matching start command");
2430 }
2431 else if (yyextra->guards->top().hasElse())
2432 {
2433 warn(yyextra->fileName,yyextra->lineNr,
2434 "found \\elseif command after \\else command was given in \\if construct");
2436 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2437 yyextra->guards->top().setEnabled(false);
2438 BEGIN( GuardParam );
2439 }
2440 else
2441 {
2443 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2444 yyextra->guards->top().setEnabled(false);
2445 BEGIN( GuardParam );
2446 }
2447 }
2448<SkipGuardedSection>{DOCNL} { // skip line
2449 if (*yytext=='\n') yyextra->lineNr++;
2450
2451 }
2452<SkipGuardedSection>[^ \\@\n]+ { // skip non-special characters
2453 }
2454<SkipGuardedSection>{CMD}{CMD} |
2455<SkipGuardedSection>. { // any other character
2456 }
2457
2458
2459
2460
2461<SkipInternal>{DOCNL} { // skip line
2462 if (*yytext=='\n') yyextra->lineNr++;
2464 }
2465<SkipInternal>[@\\]"if"/[ \t] {
2466 yyextra->condCount++;
2467 }
2468<SkipInternal>[@\\]"ifnot"/[ \t] {
2469 yyextra->condCount++;
2470 }
2471<SkipInternal>[@\\]/"endif" {
2472 yyextra->condCount--;
2473 if (yyextra->condCount<0)
2474 {
2475 unput('\\');
2476 BEGIN(Comment);
2477 }
2478 }
2479<SkipInternal>[@\\]/"section"[ \t] {
2480 if (yyextra->sectionLevel>0)
2481 {
2482 unput('\\');
2483 BEGIN(Comment);
2484 }
2485 }
2486<SkipInternal>[@\\]/"subsection"[ \t] {
2487 if (yyextra->sectionLevel>1)
2488 {
2489 unput('\\');
2490 BEGIN(Comment);
2491 }
2492 }
2493<SkipInternal>[@\\]/"subsubsection"[ \t] {
2494 if (yyextra->sectionLevel>2)
2495 {
2496 unput('\\');
2497 BEGIN(Comment);
2498 }
2499 }
2500<SkipInternal>[@\\]/"paragraph"[ \t] {
2501 if (yyextra->sectionLevel>3)
2502 {
2503 unput('\\');
2504 BEGIN(Comment);
2505 }
2506 }
2507<SkipInternal>[@\\]/"subparagraph"[ \t] {
2508 if (yyextra->sectionLevel>4)
2509 {
2510 unput('\\');
2511 BEGIN(Comment);
2512 }
2513 }
2514<SkipInternal>[@\\]/"subsubparagraph"[ \t] {
2515 if (yyextra->sectionLevel>5)
2516 {
2517 unput('\\');
2518 BEGIN(Comment);
2519 }
2520 }
2521<SkipInternal>[@\\]"endinternal"[ \t]* {
2522 BEGIN(Comment);
2523 }
2524<SkipInternal>[^ \\@\n]+ { // skip non-special characters
2525 }
2526<SkipInternal>. { // any other character
2527 }
2528
2529
2530
2531
2532<NameParam>{DOCNL} { // end of argument
2533
2534
2536 BEGIN( Comment );
2537 }
2538<NameParam>{LC} { // line continuation
2539 yyextra->lineNr++;
2541 yyextra->docGroup.appendHeader(' ');
2542 }
2543<NameParam>. { // ignore other stuff
2544 yyextra->docGroup.appendHeader(*yytext);
2545 yyextra->current->name+=*yytext;
2546 }
2547
2548
2549<Noop>{DOCNL} { // end of argument
2550 if (*yytext=='\n')
2551 {
2552 yyextra->lineNr++;
2554 }
2555 BEGIN( Comment );
2556 }
2557<Noop>. { // ignore other stuff
2558 }
2559
2560<RaiseWarning,RaiseWarningSection>{DOCNL} { // end of argument
2562 "{}",yyextra->raiseWarning);
2563 yyextra->raiseWarning = "";
2564 if (*yytext=='\n') yyextra->lineNr++;
2566 if (YY_START == RaiseWarning)
2567 {
2568 BEGIN(Comment);
2569 }
2570 else
2571 {
2572 yyextra->sectionTitle+=yytext;
2573 BEGIN(SectionTitle);
2574 }
2575 }
#define warn_doc_error(file, line, fmt,...)
2576<RaiseWarning,RaiseWarningSection>. { // ignore other stuff
2577 yyextra->raiseWarning += yytext;
2578 }
2579
2580
2581<InGroupParam>{LABELID} { // group id
2582 yyextra->current->groups.emplace_back(
2584 );
2585 yyextra->inGroupParamFound=
TRUE;
2586 }
@ GROUPING_INGROUP
membership in group was defined by @ingroup
2587<InGroupParam>{DOCNL} { // missing argument
2588 if (!yyextra->inGroupParamFound)
2589 {
2590 warn(yyextra->fileName,yyextra->lineNr,
2591 "Missing group name for \\ingroup command"
2592 );
2593 }
2594
2595
2597 BEGIN( Comment );
2598 }
2599<InGroupParam>{LC} { // line continuation
2600 yyextra->lineNr++;
2602 }
2603<InGroupParam>. { // ignore other stuff
2605 }
2606
2607
2608
2609<FnParam>{DOCNL} { // end of argument
2610 if (yyextra->braceCount==0)
2611 {
2612 if (yyextra->functionProto.stripWhiteSpace().isEmpty())
2613 {
2614 warn(yyextra->fileName,yyextra->lineNr,
2615 "missing argument after '\\{}'.",yyextra->currentCmd
2616 );
2617 }
2618 else
2619 {
2621 yyextra->langParser->parsePrototype(yyextra->functionProto);
2622 }
2624 BEGIN( Comment );
2625 }
2626 }
2627<FnParam>{LC} { // line continuation
2628 yyextra->lineNr++;
2629 yyextra->functionProto+=' ';
2630 }
2631<FnParam>[^@\\\n()]+ { // non-special characters
2632 yyextra->functionProto+=yytext;
2633 }
2634<FnParam>"(" {
2635 yyextra->functionProto+=yytext;
2636 yyextra->braceCount++;
2637 }
2638<FnParam>")" {
2639 yyextra->functionProto+=yytext;
2640 yyextra->braceCount--;
2641 }
2642<FnParam>. { // add other stuff
2643 yyextra->functionProto+=*yytext;
2644 }
2645
2646
2647
2648
2649
2650<OverloadParam>{DOCNL} { // end of argument
2651 if (*yytext=='\n') yyextra->lineNr++;
2652 if (yyextra->functionProto.stripWhiteSpace().isEmpty())
2653 {
2656 }
2657 else
2658 {
2660 yyextra->langParser->parsePrototype(yyextra->functionProto);
2661 }
2662 BEGIN( Comment );
2663 }
QCString getOverloadDocs()
2664<OverloadParam>{LC} { // line continuation
2665 yyextra->lineNr++;
2666 yyextra->functionProto+=' ';
2667 }
2668<OverloadParam>. { // add other stuff
2669 yyextra->functionProto+=*yytext;
2670 }
2671
2672
2673
2674<InheritParam>({ID}("::"|"."))*{ID} { // found argument
2675 yyextra->current->extends.emplace_back(
2677 );
2678 BEGIN( Comment );
2679 }
2680<InheritParam>{DOCNL} { // missing argument
2681 warn(yyextra->fileName,yyextra->lineNr,
2682 "\\inherit command has no argument"
2683 );
2684 if (*yytext=='\n') yyextra->lineNr++;
2686 BEGIN( Comment );
2687 }
2688<InheritParam>. { // invalid character for anchor label
2689 warn(yyextra->fileName,yyextra->lineNr,
2690 "Invalid or missing name for \\inherit command"
2691 );
2692 BEGIN(Comment);
2693 }
2694
2695
2696
2697<ExtendsParam>({ID}("::"|"."))*{ID} { // found argument
2698 yyextra->current->extends.emplace_back(
2700 );
2701 BEGIN( Comment );
2702 }
2703<ExtendsParam>{DOCNL} { // missing argument
2704 warn(yyextra->fileName,yyextra->lineNr,
2705 "'\\{}' command has no argument",yyextra->currentCmd
2706 );
2707
2708
2710 BEGIN( Comment );
2711 }
2712<ExtendsParam>. { // ignore other stuff
2713 }
2714
2715
2716
2717<SkipLang>[\\@]"~"[a-zA-Z-]* { /* language switch */
2720 {
2721 warn(yyextra->fileName,yyextra->lineNr,
2723 }
2724 else if (langId.isEmpty() ||
2726 {
2727 BEGIN(Comment);
2728 }
2729 }
2730<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
2731 }
2732<SkipLang>{DOCNL} { /* new line in verbatim block */
2733 if (*yytext=='\n') yyextra->lineNr++;
2734 }
2735<SkipLang>. { /* any other character */
2736 }
2737
2738
2739
2740<CiteLabel,CiteLabelSection>{CITEID} { // found argument
2743 if (YY_START == CiteLabel)
2744 {
2745 BEGIN(Comment);
2746 }
2747 else
2748 {
2749 yyextra->sectionTitle+=yytext;
2750 BEGIN(SectionTitle);
2751 }
2752 }
2753<CiteLabel,CiteLabelSection>{DOCNL} { // missing argument
2754 warn(yyextra->fileName,yyextra->lineNr,
2755 "\\cite command has no label"
2756 );
2757
2758
2759 if (YY_START == CiteLabel)
2760 {
2762 BEGIN(Comment);
2763 }
2764 else
2765 {
2766 yyextra->sectionTitle+=yytext;
2768 BEGIN(SectionTitle);
2769 }
2770 }
2771<CiteLabel,CiteLabelSection>. { // invalid character for cite label
2772 warn(yyextra->fileName,yyextra->lineNr,
2773 "Invalid or missing cite label"
2774 );
2775 if (YY_START == CiteLabel)
2776 {
2777 BEGIN(Comment);
2778 }
2779 else
2780 {
2781 yyextra->sectionTitle+=yytext;
2782 BEGIN(SectionTitle);
2783 }
2784 }
2785
2786
2787
2788<CopyDoc><<EOF>> {
2790 addOutput(yyscanner,
" \\ilinebr\\ilinebr\\copydetails ");
2791 addOutput(yyscanner,yyextra->copyDocArg);
2793 BEGIN(Comment);
2794 }
2795<CopyDoc>{DOCNL} {
2796 if (*yytext=='\n') yyextra->lineNr++;
2797 if (yyextra->braceCount==0)
2798 {
2800 addOutput(yyscanner,
" \\ilinebr\\ilinebr\\copydetails ");
2801 addOutput(yyscanner,yyextra->copyDocArg);
2803 BEGIN(Comment);
2804 }
2805 }
2806<CopyDoc>{LC} { // line continuation
2807 yyextra->lineNr++;
2808 }
2809<CopyDoc>[^@\\\n()]+ { // non-special characters
2810 yyextra->copyDocArg+=yytext;
2812 }
2813<CopyDoc>"(" {
2814 yyextra->copyDocArg+=yytext;
2816 yyextra->braceCount++;
2817 }
2818<CopyDoc>")" {
2819 yyextra->copyDocArg+=yytext;
2821 yyextra->braceCount--;
2822 }
2823<CopyDoc>. {
2824 yyextra->copyDocArg+=yytext;
2826 }
2827
2828
2829<*>. { fprintf(stderr,"Lex scanner %s %sdefault rule for state %s: #%s#\n", __FILE__,!yyextra->fileName.isEmpty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START),yytext);}
2830<*>\n { fprintf(stderr,"Lex scanner %s %sdefault rule newline for state %s.\n", __FILE__, !yyextra->fileName.isEmpty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START));}
2831 */
2832
2833%%