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\)] { // . at start or in the middle of a word, or ellipsis
1149 }
1150<Comment>".\\"[ \t] { // . with escaped space.
1153 }
1154<Comment>"."[,:;] { // . with some puntuations such as "e.g.," or "e.g.:"
1156 }
1157<Comment>"...\\"[ \t] { // ellipsis with escaped space.
1159 }
1160<Comment>"..."/[^\.] { // ellipsis
1162 }
1163<Comment>".."[\.]?/[^ \t\n] { // internal ellipsis
1165 }
1166<Comment>(\n|"\\ilinebr ")({B}*(\n|"\\ilinebr "))+ { // at least one blank line (or blank line command)
1168 {
1169
1171 yy_size_t i;
1172 for (i=0;i<(yy_size_t)yyleng;)
1173 {
1174 if (yytext[i]==
'\n')
addOutput(yyscanner,
'\n'),i++;
1175 else if (strncmp(yytext+i,
"\\ilinebr ",9)==0)
addOutput(yyscanner,
"\\ilinebr "),i+=9;
1176 else i++;
1177 }
1178 }
1180 {
1181 yy_size_t i;
1182 for (i=0;i<(yy_size_t)yyleng;)
1183 {
1184 if (yytext[i]==
'\n')
addOutput(yyscanner,
'\n'),i++;
1185 else if (strncmp(yytext+i,
"\\ilinebr ",9)==0)
addOutput(yyscanner,
"\\ilinebr "),i+=9;
1186 else i++;
1187 }
1189 }
1190 else
1191 {
1192
1194 }
1196 }
1197<Comment>"." { // potential end of a JavaDoc style comment
1199 if (yyextra->briefEndsAtDot)
1200 {
1202 yyextra->briefEndsAtDot=
FALSE;
1203 }
1204 }
1205<Comment>{DOCNL} { // newline
1207 if (*yytext == '\n') yyextra->lineNr++;
1208 }
1209<Comment>. { // catch-all for anything else
1211 }
1212
1213
1214
1215
1216<HtmlComment>"---"[!]?">"{B}* {
1217 warn(yyextra->fileName,yyextra->lineNr,
1218 "incorrect HTML end comment --->"
1219 );
1220 }
1221<HtmlComment>"--"[!]?">"{B}* { BEGIN( Comment ); }
1222<HtmlComment>{DOCNL} {
1223 if (*yytext=='\n')
1224 {
1225 yyextra->lineNr++;
1227 }
1228 }
1229<HtmlComment>[^\\\n\-]+ { // ignore unimportant characters
1230 }
1231<HtmlComment>. { // ignore every else
1232 }
1233
1234<CdataSection>"\]\]>" {
1235 BEGIN( Comment );
1236 }
1237<CdataSection>{DOCNL} {
1239 if (*yytext=='\n') yyextra->lineNr++;
1240 }
1241<CdataSection>[<>&] { // the special XML characters for iwhich the CDATA section is especially used
1244 }
1245<CdataSection>[^\\\n\]<>&]+ {
1247 }
1248<CdataSection>. {
1250 }
1251
1252
1253
1254<ReadFormulaShort,ReadFormulaShortSection>{CMD}"f$" { // end of inline formula
1255 yyextra->formulaPostText+="$";
1258 if (YY_START == ReadFormulaShort)
1259 {
1260 BEGIN(Comment);
1261 }
1262 else
1263 {
1264 yyextra->sectionTitle+= " "+form;
1265 BEGIN(SectionTitle);
1266 }
1267 }
1268<ReadFormulaRound,ReadFormulaRoundSection>{CMD}"f)" { // end of inline formula
1271 if (YY_START == ReadFormulaRound)
1272 {
1273 BEGIN(Comment);
1274 }
1275 else
1276 {
1277 yyextra->sectionTitle+= " "+form;
1278 BEGIN(SectionTitle);
1279 }
1280 }
1281<ReadFormulaLong>{CMD}"f]" { // end of block formula
1282 yyextra->formulaPostText+="\\]";
1284 BEGIN(Comment);
1285 }
1286<ReadFormulaLong>{CMD}"f}" { // end of custom env formula
1287 yyextra->formulaPostText+="\\end";
1288 yyextra->formulaPostText+=yyextra->formulaEnv;
1290 BEGIN(Comment);
1291 }
1292<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>[^\\@\n]+ { // any non-special character
1293 yyextra->formulaText+=yytext;
1294 }
1295<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>\n { // new line
1296 yyextra->formulaNewLines++;
1297 yyextra->formulaText+=*yytext;
1298 yyextra->lineNr++;
1299 addIline(yyscanner,yyextra->lineNr);
1300 }
1301<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>. { // any other character
1302 yyextra->formulaText+=*yytext;
1303 }
1304
1305
1306
1307<EnumDocArg1>{SCOPEID} { // handle argument
1309 yyextra->current->name = yytext;
1310 BEGIN( Comment );
1311 }
1312<EnumDocArg1>{LC} { // line continuation
1313 yyextra->lineNr++;
1315 }
1316<EnumDocArg1>{DOCNL} { // missing argument
1317 warn(yyextra->fileName,yyextra->lineNr,
1318 "missing argument after '\\enum'."
1319 );
1321 BEGIN( Comment );
1322 }
1323<EnumDocArg1>. { // ignore other stuff
1324 }
1325
1326
1327
1328<NameSpaceDocArg1>{SCOPENAME} { // handle argument
1332 BEGIN( Comment );
1333 }
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)
1334<NameSpaceDocArg1>{LC} { // line continuation
1335 yyextra->lineNr++;
1337 }
1338<NameSpaceDocArg1>{DOCNL} { // missing argument
1339 warn(yyextra->fileName,yyextra->lineNr,
1340 "missing argument after "
1341 "'\\namespace'."
1342 );
1344 BEGIN( Comment );
1345 }
1346<NameSpaceDocArg1>. { // ignore other stuff
1347 }
1348
1349
1350
1351<PackageDocArg1>{ID}("."{ID})* { // handle argument
1352 yyextra->current->name = yytext;
1353 BEGIN( Comment );
1354 }
1355<PackageDocArg1>{LC} { // line continuation
1356 yyextra->lineNr++;
1358 }
1359<PackageDocArg1>{DOCNL} { // missing argument
1360 warn(yyextra->fileName,yyextra->lineNr,
1361 "missing argument after "
1362 "\\package."
1363 );
1365
1366
1367 BEGIN( Comment );
1368 }
1369<PackageDocArg1>. { // ignore other stuff
1370 }
1371
1372
1373
1374<ConceptDocArg1>{SCOPEID} { // handle argument
1376 yyextra->current->name = yytext;
1377 BEGIN( Comment );
1378 }
1379<ConceptDocArg1>{LC} { // line continuation
1380 yyextra->lineNr++;
1382 }
1383<ConceptDocArg1>{DOCNL} { // missing argument
1384 warn(yyextra->fileName,yyextra->lineNr,
1385 "missing argument after "
1386 "'\\concept'."
1387 );
1389 BEGIN( Comment );
1390 }
1391<ConceptDocArg1>. { // ignore other stuff
1392 }
1393
1394
1395<ModuleDocArg1>{MODULE_ID} { // handle argument
1397 yyextra->current->name = yytext;
1398 BEGIN( Comment );
1399 }
1400<ModuleDocArg1>{LC} { // line continuation
1401 yyextra->lineNr++;
1403 }
1404<ModuleDocArg1>{DOCNL} { // missing argument
1405 warn(yyextra->fileName,yyextra->lineNr,
1406 "missing argument after "
1407 "'\\module'."
1408 );
1410 BEGIN( Comment );
1411 }
1412<ModuleDocArg1>. { // ignore other stuff
1413 }
1414
1415
1416
1417<ClassDocArg1>{SCOPENAME}{TMPLSPEC} {
1421 BEGIN( ClassDocArg2 );
1422 }
1423<ClassDocArg1>{SCOPENAME} { // first argument
1427 if (yyextra->current->section.isProtocolDoc())
1428 {
1429 yyextra->current->name+="-p";
1430 }
1431
1432 BEGIN( ClassDocArg2 );
1433 }
1434<CategoryDocArg1>{SCOPENAME}{B}*"("[^\)]+")" {
1438 BEGIN( ClassDocArg2 );
1439 }
1440<ClassDocArg1,CategoryDocArg1>{LC} { // line continuation
1441 yyextra->lineNr++;
1443 }
1444<ClassDocArg1,CategoryDocArg1>{DOCNL} {
1445 warn(yyextra->fileName,yyextra->lineNr,
1446 "missing argument after "
1447 "'\\%s'.",
qPrint(yyextra->currentCmd)
1448 );
1450 BEGIN( Comment );
1451 }
1452<ClassDocArg1,CategoryDocArg1>. { // ignore other stuff
1453 }
1454
1455<ClassDocArg2>{DOCNL} {
1457 BEGIN( Comment );
1458 }
1459<ClassDocArg2>{FILE}|"<>" { // second argument; include file
1460 yyextra->current->includeFile = yytext;
1461 BEGIN( ClassDocArg3 );
1462 }
1463<ClassDocArg2>{LC} { // line continuation
1464 yyextra->lineNr++;
1466 }
1467<ClassDocArg2>. { // ignore other stuff
1468 }
1469
1470<ClassDocArg3>[<"]?{FILE}?[">]? { // third argument; include file name
1471 yyextra->current->includeName = yytext;
1472 BEGIN( Comment );
1473 }
1474<ClassDocArg3>{LC} { // line continuation
1475 yyextra->lineNr++;
1477 }
1478<ClassDocArg3>{DOCNL} {
1479
1481 BEGIN( Comment );
1482 }
1483<ClassDocArg3>. { // ignore other stuff
1484 }
1485
1486
1487
1488<GroupDocArg1>{LABELID}(".html"?) { // group name
1489 yyextra->current->name = yytext;
1490
1491
1492
1493 if (yyextra->current->name.endsWith(".html"))
1494 {
1495 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-5);
1496 }
1497 yyextra->current->type.clear();
1498 BEGIN(GroupDocArg2);
1499 }
1500<GroupDocArg1>"\\"{B}*"\n" { // line continuation
1501 yyextra->lineNr++;
1503 }
1504<GroupDocArg1>{DOCNL} { // missing argument!
1505 warn(yyextra->fileName,yyextra->lineNr,
1506 "missing group name after %s",
1507 yyextra->current->groupDocCmd()
1508 );
1509
1510
1512 BEGIN( Comment );
1513 }
1514<GroupDocArg1>. { // ignore other stuff
1515 }
1516<GroupDocArg2>"\\"{B}*"\n" { // line continuation
1517 yyextra->lineNr++;
1519 }
1520<GroupDocArg2>[^\n\\]+ { // title (stored in type)
1521 yyextra->current->type += yytext;
1522 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
1523 }
1524<GroupDocArg2>{DOCNL}+ {
1526 yyextra->current->type.isEmpty()
1527 )
1528 {
1529 warn(yyextra->fileName,yyextra->lineNr,
1530 "missing title after "
1531 "\\defgroup %s",
qPrint(yyextra->current->name)
1532 );
1533 }
1535 int extraLineNr = 0;
1537 {
1538 for (int i = 0; i < yyleng; i++)
1539 {
1540 if (yytext[i]=='\n') extraLineNr++;
1541 }
1542 }
1543
1544
1546 {
1547 addOutput(yyscanner,
" \\ifile \""+ yyextra->fileName);
1548 addOutput(yyscanner,
"\" \\iline " +
QCString().setNum(yyextra->lineNr + extraLineNr) +
" \\ilinebr ");
1549 }
1550 BEGIN( Comment );
1551 }
1552<GroupDocArg2>. { // title (stored in type)
1553 yyextra->current->type += yytext;
1554 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
1555 }
1556
1557
1558
1559<PageDocArg1>[^\n]*"\\ilinebr @ianchor"\{[^\]\n]*\}{B}{FILE} { // special case where the Markdown processor has rewritten
1560
1561
1563 int start = text.
find(
'{');
1564 int end = text.
find(
'}',start+1);
1565 yyextra->current->name = text.
mid(
end+2);
1566 int istart = yyextra->current->name.
find(
"\\ilinebr");
1567 if (istart != -1)
1568 {
1569 QCString rest = yyextra->current->name.
mid(istart);
1571 yyextra->current->name = yyextra->current->name.mid(0,istart);
1572 }
1573 yyextra->current->args = text.
mid(start+1,
end-start-1);
1574
1575 BEGIN( PageDocArg2 );
1576 }
DirIterator end(const DirIterator &) noexcept
1577<PageDocArg1>{FILE} { // first argument; page name
1579 yyextra->current->args = "";
1580 BEGIN( PageDocArg2 );
1581 }
1582<PageDocArg1>{LC} { yyextra->lineNr++;
1584 }
1585<PageDocArg1>{DOCNL} {
1586 warn(yyextra->fileName,yyextra->lineNr,
1587 "missing argument after "
1588 "\\page."
1589 );
1591
1592
1593 BEGIN( Comment );
1594 }
1595<PageDocArg1>. { // ignore other stuff
1596 }
1597<PageDocArg2>{DOCNL} { // second argument; page title
1599
1600
1601 addOutput(yyscanner,
" \\ifile \""+ yyextra->fileName);
1602 addOutput(yyscanner,
"\" \\iline " +
QCString().setNum(yyextra->lineNr) +
" \\ilinebr ");
1603 BEGIN( Comment );
1604 }
1605<PageDocArg2>{CMD}[<>] {
1606
1610 yyextra->current->args += tmp;
1611 }
1612<PageDocArg2>. {
1613 yyextra->current->args += yytext;
1614 }
1615
1616<ParamArg1>{ID}/{B}*"," {
1618 }
1619<ParamArg1>"," {
1621 }
1622<ParamArg1>{DOCNL} {
1623 if (*yytext=='\n') yyextra->lineNr++;
1625 }
1626<ParamArg1>{ID} {
1628 BEGIN( Comment );
1629 }
1630<ParamArg1>. {
1631 unput(yytext[0]);
1632 BEGIN( Comment );
1633 }
1634
1635
1636
1637<FileDocArg1>{DOCNL} { // no file name specified
1639
1640
1641 BEGIN( Comment );
1642 }
1643<FileDocArg1>{FILE} { // first argument; name
1645 BEGIN( Comment );
1646 }
1647<FileDocArg1>{LC} { yyextra->lineNr++;
1649 }
1650<FileDocArg1>. { // ignore other stuff
1651 }
1652
1653
1654
1655<XRefItemParam1>{LABELID} { // first argument
1656 yyextra->newXRefItemKey=yytext;
1658 BEGIN(XRefItemParam2);
1659 }
1660<XRefItemParam1>{LC} { // line continuation
1661 yyextra->lineNr++;
1663 }
1664<XRefItemParam1>{DOCNL} { // missing arguments
1665 warn(yyextra->fileName,yyextra->lineNr,
1666 "Missing first argument of \\xrefitem"
1667 );
1668 if (*yytext=='\n') yyextra->lineNr++;
1671 BEGIN( Comment );
1672 }
1673<XRefItemParam1>. { // ignore other stuff
1674 }
1675
1676<XRefItemParam2>"\""[^\n\"]*"\"" { // second argument
1678 BEGIN(XRefItemParam3);
1679 }
1680<XRefItemParam2>{LC} { // line continuation
1681 yyextra->lineNr++;
1683 }
1684<XRefItemParam2>{DOCNL} { // missing argument
1685 warn(yyextra->fileName,yyextra->lineNr,
1686 "Missing second argument of \\xrefitem"
1687 );
1688 if (*yytext=='\n') yyextra->lineNr++;
1691 BEGIN( Comment );
1692 }
1693<XRefItemParam2>. { // ignore other stuff
1694 }
1695
1696<XRefItemParam3>"\""[^\n\"]*"\"" { // third argument
1699 BEGIN( Comment );
1700 }
1701<XRefItemParam2,XRefItemParam3>{LC} { // line continuation
1702 yyextra->lineNr++;
1704 }
1705<XRefItemParam3>{DOCNL} { // missing argument
1706 warn(yyextra->fileName,yyextra->lineNr,
1707 "Missing third argument of \\xrefitem"
1708 );
1709 if (*yytext=='\n') yyextra->lineNr++;
1712 BEGIN( Comment );
1713 }
1714<XRefItemParam3>. { // ignore other stuff
1715 }
1716
1717
1718
1719
1720<RelatesParam1>({ID}("::"|"."))*{ID} { // argument
1721 yyextra->current->relates = yytext;
1722
1723
1724
1725
1726 BEGIN( Comment );
1727 }
1728<RelatesParam1>{LC} { // line continuation
1729 yyextra->lineNr++;
1731 }
1732<RelatesParam1>{DOCNL} { // missing argument
1733 warn(yyextra->fileName,yyextra->lineNr,
1734 "Missing argument of '\\%s' command",
qPrint(yyextra->currentCmd)
1735 );
1737
1738
1739 BEGIN( Comment );
1740 }
1741<RelatesParam1>. { // ignore other stuff
1742 }
1743
1744
1745
1746<Qualifier>{LABELID} { // unquoted version, simple label
1747 yyextra->current->qualifiers.emplace_back(yytext);
1748 BEGIN( Comment );
1749 }
1750<Qualifier>"\""[^\"]*"\"" { // quotes version, add without quotes
1751 std::string inp(yytext);
1752 yyextra->current->qualifiers.push_back(inp.substr(1,yyleng-2));
1753 BEGIN( Comment );
1754 }
1755<Qualifier>{DOCNL} { // missing argument
1756 warn(yyextra->fileName,yyextra->lineNr,
1757 "Missing argument of '\\%s' command",
qPrint(yyextra->currentCmd)
1758 );
1760 BEGIN( Comment );
1761 }
1762<Qualifier>. {
1763 warn(yyextra->fileName,yyextra->lineNr,
1764 "Argument of '\\%s' command should be quoted",
qPrint(yyextra->currentCmd)
1765 );
1767 BEGIN( Comment );
1768 }
1769
1770<ILine>{LINENR}/[\\@\n\.] |
1771<ILine>{LINENR}{B} {
1772 bool ok = false;
1774 if (!ok)
1775 {
1776 warn(yyextra->fileName,yyextra->lineNr,
"Invalid line number '%s' for iline command",yytext);
1777 }
1778 else
1779 {
1780 yyextra->lineNr = nr;
1781 }
1783 if (YY_START == ILine)
1784 {
1785 BEGIN(Comment);
1786 }
1787 else
1788 {
1789 yyextra->sectionTitle+=yytext;
1790 BEGIN(SectionTitle);
1791 }
1792 }
int toInt(bool *ok=nullptr, int base=10) const
1793<ILine,ILineSection>. {
1795 if (YY_START == ILine)
1796 {
1797 BEGIN(Comment);
1798 }
1799 else
1800 {
1801 yyextra->sectionTitle+=yytext;
1802 BEGIN(SectionTitle);
1803 }
1804 }
1805
1806
1807<IRaise>{B}*[0-9]+/[\\@\n\.] |
1808<IRaise>{B}*[0-9]+{B} {
1809 bool ok = false;
1811 if (!ok)
1812 {
1813 warn(yyextra->fileName,yyextra->lineNr,
"Invalid level '%s' for iraise command",yytext);
1814 }
1815 else
1816 {
1817 yyextra->raiseLevel = nr;
1818 }
1819 BEGIN(Comment);
1820 }
1821<IRaise>. {
1822 unput(yytext[0]);
1823 BEGIN(Comment);
1824 }
1825
1826
1827<IRaisePrefix>{B}*"\""({LABELID})?"\"" {
1829 yyextra->raisePrefix = text.stripWhiteSpace().mid(1,text.length()-2);
1831 BEGIN(Comment);
1832 }
1833<IRaisePrefix>. {
1834 unput(yytext[0]);
1835 BEGIN(Comment);
1836 }
1837
1838
1839
1840
1841<IFile,IFileSection>{FILE} {
1844 if (yytext[0] == '\"') yyextra->fileName = text.mid(1,text.length()-2);
1845 else yyextra->fileName = yytext;
1846 if (YY_START == IFile)
1847 {
1848 BEGIN(Comment);
1849 }
1850 else
1851 {
1852 yyextra->sectionTitle+=yytext;
1853 BEGIN(SectionTitle);
1854 }
1855 }
1856
1857<LinkSection>[^\\@\n]* {
1858 yyextra->sectionTitle+=yytext;
1859 }
1860<LinkSection>{CMD}{CMD} {
1861 yyextra->sectionTitle+=yytext;
1862 }
1863<LinkSection>{DOCNL} {
1865 if (*yytext == '\n') yyextra->lineNr++;
1866 yyextra->sectionTitle+=yytext;
1867 }
1868<LinkSection>{CMD}"endlink" {
1869 yyextra->sectionTitle+=yytext;
1870 BEGIN(SectionTitle);
1871 }
1872<LinkSection>. {
1873 yyextra->sectionTitle+=yytext;
1874 }
1875<LinkSection><<EOF>> {
1876 warn(yyextra->fileName,yyextra->lineNr,
1877 "reached end of comment while inside a '\\%s' command, missing '\\%s' command",
1878 "link","endlink"
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 "'\\%s' 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 "'\\%s' command is not allowed in section title, escaping command.",
qPrint(cmdName)
2013 );
2014 }
2015 break;
2017 {
2020 warn(yyextra->fileName,yyextra->lineNr,
2021 "'\\%s' command is not allowed in section title, ending section title.",
qPrint(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 '\\%s' command is to be replaced in section title.",
qPrint(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 \\%s block! Perhaps a missing \\%s?",
qPrint(yyextra->blockName),
qPrint(endTag));
2262 }
2263 }
2264 }
2265<FormatBlock>. {
2267 }
2268<FormatBlock><<EOF>> {
2269 QCString endTag =
"end"+yyextra->blockName;
2270 if (yyextra->blockName=="startuml") endTag="enduml";
2271 warn(yyextra->fileName,yyextra->lineNr,
2272 "reached end of comment while inside a \\%s block; check for missing \\%s tag!",
2274 );
2276 }
2277
2278
2279
2280<GuardParam>{B}*"(" {
2281 yyextra->guardExpr=yytext;
2282 yyextra->roundCount=1;
2283 BEGIN(GuardExpr);
2284 }
2285<GuardExpr>[^()]* {
2286 yyextra->guardExpr+=yytext;
2288 }
2289<GuardExpr>"(" {
2290 yyextra->guardExpr+=yytext;
2291 yyextra->roundCount++;
2292 }
2293<GuardExpr>")" {
2294 yyextra->guardExpr+=yytext;
2295 yyextra->roundCount--;
2296 if (yyextra->roundCount==0)
2297 {
2299 }
2300 }
2301<GuardExpr>\n {
2302 warn(yyextra->fileName,yyextra->lineNr,
2303 "invalid expression '%s' for yyextra->guards",
qPrint(yyextra->guardExpr));
2304 unput(*yytext);
2305 BEGIN(GuardParam);
2306 }
2307<GuardParam>{B}*[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot yyextra->guards
2309 }
2310<GuardParam>{DOCNL} { // end of argument
2311
2312
2316 }
2317<GuardParam>{LC} { // line continuation
2318 yyextra->lineNr++;
2320 }
2321<GuardParam>. { // empty condition
2322 unput(*yytext);
2324 }
2325<GuardParamEnd>{B}*{DOCNL} {
2327 yyextra->spaceBeforeIf.clear();
2329 BEGIN(Comment);
2330 }
2331<GuardParamEnd>{B}* {
2332 if (!yyextra->spaceBeforeIf.isEmpty())
2333 {
2334 addOutput(yyscanner,yyextra->spaceBeforeIf);
2335 }
2336 yyextra->spaceBeforeIf.clear();
2338 BEGIN(Comment);
2339 }
2340<GuardParamEnd>. {
2341 unput(*yytext);
2343 BEGIN(Comment);
2344 }
2345
2346
2347
2348<SkipGuardedSection>{CMD}"ifnot"/{NW} {
2350 yyextra->guards->emplace(false);
2351 BEGIN( GuardParam );
2352 }
2353<SkipGuardedSection>{CMD}"if"/{NW} {
2355 yyextra->guards->emplace(false);
2356 BEGIN( GuardParam );
2357 }
2358<SkipGuardedSection>{CMD}"endif"/{NW} {
2359 if (yyextra->guards->empty())
2360 {
2361 warn(yyextra->fileName,yyextra->lineNr,
2362 "found \\endif without matching start command");
2363 BEGIN( Comment );
2364 }
2365 else
2366 {
2367 yyextra->guards->pop();
2368 if (yyextra->guards->empty())
2369 {
2370 BEGIN( GuardParamEnd );
2371 }
2372 else
2373 {
2374 if (yyextra->guards->top().isEnabled())
2375 {
2376 BEGIN( GuardParamEnd );
2377 }
2378 else
2379 {
2380 BEGIN( SkipGuardedSection );
2381 }
2382 }
2383 }
2384 }
2385<SkipGuardedSection>{CMD}"else"/{NW} {
2386 if (yyextra->guards->empty())
2387 {
2388 warn(yyextra->fileName,yyextra->lineNr,
2389 "found \\else without matching start command");
2390 }
2391 else if (yyextra->guards->top().hasElse())
2392 {
2393 warn(yyextra->fileName,yyextra->lineNr,
2394 "found multiple \\else commands in same \\if construct");
2395 yyextra->guards->top().setEnabled(false);
2396 BEGIN( SkipGuardedSection );
2397 }
2398 else if (!yyextra->guards->top().parentVisible())
2399 {
2400 yyextra->guards->top().setEnabled(false);
2401 BEGIN( SkipGuardedSection );
2402 }
2403 else
2404 {
2405 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2406 yyextra->guards->top().setElse();
2407 if (!yyextra->guards->top().parentVisible())
2408 {
2409 yyextra->guards->top().setEnabled(false);
2410 BEGIN( SkipGuardedSection );
2411 }
2412 else if (yyextra->guards->top().isEnabledFound())
2413 {
2414 yyextra->guards->top().setEnabled(false);
2415 BEGIN( SkipGuardedSection );
2416 }
2417 else
2418 {
2419 yyextra->guards->top().setEnabled(true);
2420 BEGIN( GuardParamEnd );
2421 }
2422 }
2423 }
2424<SkipGuardedSection>{CMD}"elseif"/{NW} {
2425 if (yyextra->guards->empty())
2426 {
2427 warn(yyextra->fileName,yyextra->lineNr,
2428 "found \\elseif without matching start command");
2429 }
2430 else if (yyextra->guards->top().hasElse())
2431 {
2432 warn(yyextra->fileName,yyextra->lineNr,
2433 "found \\elseif command after \\else command was given in \\if construct");
2435 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2436 yyextra->guards->top().setEnabled(false);
2437 BEGIN( GuardParam );
2438 }
2439 else
2440 {
2442 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2443 yyextra->guards->top().setEnabled(false);
2444 BEGIN( GuardParam );
2445 }
2446 }
2447<SkipGuardedSection>{DOCNL} { // skip line
2448 if (*yytext=='\n') yyextra->lineNr++;
2449
2450 }
2451<SkipGuardedSection>[^ \\@\n]+ { // skip non-special characters
2452 }
2453<SkipGuardedSection>{CMD}{CMD} |
2454<SkipGuardedSection>. { // any other character
2455 }
2456
2457
2458
2459
2460<SkipInternal>{DOCNL} { // skip line
2461 if (*yytext=='\n') yyextra->lineNr++;
2463 }
2464<SkipInternal>[@\\]"if"/[ \t] {
2465 yyextra->condCount++;
2466 }
2467<SkipInternal>[@\\]"ifnot"/[ \t] {
2468 yyextra->condCount++;
2469 }
2470<SkipInternal>[@\\]/"endif" {
2471 yyextra->condCount--;
2472 if (yyextra->condCount<0)
2473 {
2474 unput('\\');
2475 BEGIN(Comment);
2476 }
2477 }
2478<SkipInternal>[@\\]/"section"[ \t] {
2479 if (yyextra->sectionLevel>0)
2480 {
2481 unput('\\');
2482 BEGIN(Comment);
2483 }
2484 }
2485<SkipInternal>[@\\]/"subsection"[ \t] {
2486 if (yyextra->sectionLevel>1)
2487 {
2488 unput('\\');
2489 BEGIN(Comment);
2490 }
2491 }
2492<SkipInternal>[@\\]/"subsubsection"[ \t] {
2493 if (yyextra->sectionLevel>2)
2494 {
2495 unput('\\');
2496 BEGIN(Comment);
2497 }
2498 }
2499<SkipInternal>[@\\]/"paragraph"[ \t] {
2500 if (yyextra->sectionLevel>3)
2501 {
2502 unput('\\');
2503 BEGIN(Comment);
2504 }
2505 }
2506<SkipInternal>[@\\]/"subparagraph"[ \t] {
2507 if (yyextra->sectionLevel>4)
2508 {
2509 unput('\\');
2510 BEGIN(Comment);
2511 }
2512 }
2513<SkipInternal>[@\\]/"subsubparagraph"[ \t] {
2514 if (yyextra->sectionLevel>5)
2515 {
2516 unput('\\');
2517 BEGIN(Comment);
2518 }
2519 }
2520<SkipInternal>[@\\]"endinternal"[ \t]* {
2521 BEGIN(Comment);
2522 }
2523<SkipInternal>[^ \\@\n]+ { // skip non-special characters
2524 }
2525<SkipInternal>. { // any other character
2526 }
2527
2528
2529
2530
2531<NameParam>{DOCNL} { // end of argument
2532
2533
2535 BEGIN( Comment );
2536 }
2537<NameParam>{LC} { // line continuation
2538 yyextra->lineNr++;
2540 yyextra->docGroup.appendHeader(' ');
2541 }
2542<NameParam>. { // ignore other stuff
2543 yyextra->docGroup.appendHeader(*yytext);
2544 yyextra->current->name+=*yytext;
2545 }
2546
2547
2548<Noop>{DOCNL} { // end of argument
2549 if (*yytext=='\n')
2550 {
2551 yyextra->lineNr++;
2553 }
2554 BEGIN( Comment );
2555 }
2556<Noop>. { // ignore other stuff
2557 }
2558
2559<RaiseWarning,RaiseWarningSection>{DOCNL} { // end of argument
2561 "%s",
qPrint(yyextra->raiseWarning));
2562 yyextra->raiseWarning = "";
2563 if (*yytext=='\n') yyextra->lineNr++;
2565 if (YY_START == RaiseWarning)
2566 {
2567 BEGIN(Comment);
2568 }
2569 else
2570 {
2571 yyextra->sectionTitle+=yytext;
2572 BEGIN(SectionTitle);
2573 }
2574 }
#define warn_doc_error(file, line, fmt,...)
2575<RaiseWarning,RaiseWarningSection>. { // ignore other stuff
2576 yyextra->raiseWarning += yytext;
2577 }
2578
2579
2580<InGroupParam>{LABELID} { // group id
2581 yyextra->current->groups.emplace_back(
2583 );
2584 yyextra->inGroupParamFound=
TRUE;
2585 }
@ GROUPING_INGROUP
membership in group was defined by @ingroup
2586<InGroupParam>{DOCNL} { // missing argument
2587 if (!yyextra->inGroupParamFound)
2588 {
2589 warn(yyextra->fileName,yyextra->lineNr,
2590 "Missing group name for \\ingroup command"
2591 );
2592 }
2593
2594
2596 BEGIN( Comment );
2597 }
2598<InGroupParam>{LC} { // line continuation
2599 yyextra->lineNr++;
2601 }
2602<InGroupParam>. { // ignore other stuff
2604 }
2605
2606
2607
2608<FnParam>{DOCNL} { // end of argument
2609 if (yyextra->braceCount==0)
2610 {
2611 if (yyextra->functionProto.stripWhiteSpace().isEmpty())
2612 {
2613 warn(yyextra->fileName,yyextra->lineNr,
2614 "missing argument after "
2615 "'\\%s'.",
qPrint(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 "'\\%s' command has no argument",
qPrint(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%%