253 {NUMBER} {
256 }
257<Scan>[^"'!\/\n\\#,\-=; \t@$]* { /* eat anything that is not " / , or \n */
259 }
260<Scan>[,= ;\t] { /* eat , so we have a nice separator in long initialization lines */
262 }
263<Scan>"'''"! |
264<Scan>"\"\"\""! { /* start of python long comment */
266 {
267 REJECT;
268 }
269 else
270 {
271 yyextra->pythonDocString =
TRUE;
272 yyextra->pythonDocStringChar = yytext[0];
273 yyextra->nestingCount=1;
276 BEGIN(CComment);
277 yyextra->commentStack.push(yyextra->lineNr);
278 }
279 }
280<Scan>"'''" |
281<Scan>"\"\"\"" { /* start of python long comment */
283 {
284 REJECT;
285 }
287 {
288 REJECT;
289 }
290 else
291 {
292 yyextra->pythonDocString =
TRUE;
293 yyextra->pythonDocStringChar = yytext[0];
294 yyextra->nestingCount=1;
297 BEGIN(CComment);
298 yyextra->commentStack.push(yyextra->lineNr);
299 }
300 }
301<Scan>{B}*![><!]/.*\n {
303 {
304 REJECT;
305 }
306 else
307 {
308 yyextra->nestingCount=0;
310 yyextra->specialComment=true;
312 yyextra->blockHeadCol=yyextra->col-2;
313 BEGIN(CComment);
314 yyextra->commentStack.push(yyextra->lineNr);
315 }
316 }
317<Scan>[Cc\*][><!]/.*\n {
319 {
320 REJECT;
321 }
322 else
323 {
324
325 if (yyextra->isFixedForm && (yyextra->col == 0))
326 {
327 yyextra->nestingCount=0;
329 yyextra->specialComment=true;
331 yyextra->blockHeadCol=yyextra->col-1;
332 BEGIN(CComment);
333 yyextra->commentStack.push(yyextra->lineNr);
334 }
335 else
336 {
337 REJECT;
338 }
339 }
340 }
341<Scan>!.*\n {
343 {
344 REJECT;
345 }
346 else
347 {
349 }
350 }
351<Scan>[Cc\*].*\n {
353 {
354 REJECT;
355 }
356 else
357 {
358 if (yyextra->col == 0)
359 {
361 }
362 else
363 {
364 REJECT;
365 }
366 }
367 }
368<Scan>[$]?"@\"" { /* start of an interpolated verbatim C# string */
371 yyextra->stringContext = YY_START;
372 BEGIN(SkipVerbString);
373 }
374<Scan>"\"" { /* start of a string */
376 yyextra->stringContext = YY_START;
377 BEGIN(SkipString);
378 }
379<Scan>' {
381 yyextra->charContext = YY_START;
383 {
384 BEGIN(SkipChar);
385 }
386 }
387<Scan>\n { /* new line */
389 }
390<Scan>{CPPC}"!"/.*\n[ \t]*{CPPC}[\/!][^\/] | /* start C++ style special comment block */
391<Scan>({CPPC}"/"[/]*)/[^/].*\n[ \t]*{CPPC}[\/!][^\/] { /* start C++ style special comment block */
392 if (yyextra->mlBrief)
393 {
394 REJECT;
395 }
396 else
397 {
398 int i=3;
399 if (yytext[2]=='/')
400 {
401 while (i<(int)yyleng && yytext[i]=='/') i++;
402 }
403 yyextra->blockHeadCol=yyextra->col+1;
404 if (yytext[2] == '!')
405 {
407 }
408 else
409 {
411 }
413 yyextra->inSpecialComment=
TRUE;
414
415 yyextra->readLineCtx=SComment;
416 BEGIN(ReadLine);
417 }
418 }
419<Scan>{CPPC}"##Documentation"{ANYopt}/\n { /* Start of Rational Rose ANSI C++ comment block */
420 if (yyextra->mlBrief) REJECT;
421 int i=17;
422 yyextra->blockHeadCol=yyextra->col+1;
425 yyextra->inRoseComment=
TRUE;
426 BEGIN(SComment);
427 }
428<Scan>{CPPC}[!\/]/.*\n[ \t]*{CPPC}[|\/][ \t]*[@\\]"}" { // next line contains an end marker, see bug 752712
429 yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!';
430 if (yyextra->inSpecialComment)
431 {
432 yyextra->blockHeadCol=yyextra->col+1;
433 }
435 yyextra->readLineCtx=YY_START;
436 BEGIN(ReadLine);
437 }
438<Scan>{CPPC}[!/]/.*\n { /* one line special C++ comment */
439 yyextra->inSpecialComment=true;
440 yyextra->blockHeadCol=yyextra->col+1;
441 yyextra->insertCppCommentMarker=true;
443 yyextra->readLineCtx=YY_START;
444 BEGIN(ReadLine);
445 }
446<Scan>{CPPC}/.*\n { /* one line normal C++ comment */
447 yyextra->inSpecialComment=false;
449 yyextra->readLineCtx=YY_START;
450 BEGIN(CopyLine);
451 }
452<Scan>{CCS}{CCE} { /* avoid matching next rule for empty C comment, see bug 711723 */
454 }
455<Scan>{CCS}[*!]? { /* start of a C comment */
457 {
458 REJECT;
459 }
460 yyextra->specialComment=(int)yyleng==3;
461 yyextra->nestingCount=1;
464 if (yyextra->specialComment)
465 {
466 yyextra->blockHeadCol=0;
467 BEGIN(CComment);
468 }
469 else
470 {
471 BEGIN(CNComment);
472 }
473 yyextra->commentStack.push(yyextra->lineNr);
474 }
475<Scan>"#"[^\n]*\n {
477 {
478 REJECT;
479 }
481 }
482<Scan>"#"("#")? {
484 {
485 REJECT;
486 }
487 else
488 {
489 yyextra->nestingCount=0;
491 yyextra->specialComment=(int)yyleng==2;
492 if (yyextra->specialComment)
493 {
494 yyextra->blockHeadCol=yyextra->col;
495 }
496 yyextra->commentStack.push(yyextra->lineNr);
498 BEGIN(CComment);
499 }
500 }
501<Scan>"--"[^!][^\n]* {
503 {
504 REJECT;
505 }
506 else
507 {
509 }
510 }
511<Scan>"--!" {
513 {
514 REJECT;
515 }
516 else
517 {
518 yyextra->specialComment=true;
519 yyextra->blockHeadCol=yyextra->col;
520 yyextra->vhdl =
TRUE;
521 yyextra->nestingCount=0;
523 yyextra->commentStack.push(yyextra->lineNr);
525 BEGIN(CComment);
526 }
527 }
528<Scan>{B}*![><!] {
530 {
531 REJECT;
532 }
533 else
534 {
535 yyextra->nestingCount=0;
537 yyextra->specialComment=true;
538 yyextra->blockHeadCol=yyextra->col;
539 yyextra->commentStack.push(yyextra->lineNr);
541 BEGIN(CComment);
542 }
543 }
544<CComment,CNComment,ReadLine,IncludeFile>{MAILADDR} |
545<CComment,CNComment,ReadLine,IncludeFile>"<"{MAILADDR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block
547 }
548<CComment,IncludeFile>"{"[ \t]*"@code"/[ \t\n] {
550 yyextra->lastCommentContext = YY_START;
551 yyextra->javaBlock=1;
552 yyextra->blockName=
QCString(
"end")+&yytext[1];
553 yyextra->inVerbatim=true;
554 BEGIN(VerbatimCode);
555 }
556<CComment,IncludeFile>"{"[ \t]*"@literal"/[ \t\n] {
558 yyextra->lastCommentContext = YY_START;
559 yyextra->javaBlock=1;
560 yyextra->blockName=
QCString(
"end")+&yytext[1];
561 yyextra->inVerbatim=true;
562 BEGIN(VerbatimCode);
563 }
564<CComment,ReadLine,IncludeFile>"\\ilinebr"[ \t]+("```"[`]*|"~~~"[~]*) { /* start of markdown code block */
566 {
567 REJECT;
568 }
570 yyextra->lastCommentContext = YY_START;
571 yyextra->javaBlock=0;
573 yyextra->inVerbatim=true;
574 BEGIN(VerbatimCode);
575 }
QCString right(size_t len) const
576<CComment,ReadLine,IncludeFile>^[ \t]*("```"[`]*|"~~~"[~]*) { /* start of markdown code block */
578 {
579 REJECT;
580 }
582 yyextra->lastCommentContext = YY_START;
583 yyextra->javaBlock=0;
585 yyextra->inVerbatim=true;
586 BEGIN(VerbatimCode);
587 }
QCString left(size_t len) const
588<CComment,ReadLine,IncludeFile>[\\@]("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */
590 yyextra->lastCommentContext = YY_START;
591 yyextra->javaBlock=0;
592 if (
qstrcmp(&yytext[1],
"startuml")==0)
593 {
594 yyextra->blockName="enduml";
595 }
596 else
597 {
598 yyextra->blockName=
QCString(
"end")+&yytext[1];
599 }
600 yyextra->inVerbatim=true;
601 BEGIN(VerbatimCode);
602 }
int qstrcmp(const char *str1, const char *str2)
603<CComment,ReadLine,IncludeFile>[\\@]("f$"|"f["|"f{"|"f(") {
605 yyextra->blockName=&yytext[1];
606 if (yyextra->blockName.at(1)=='[')
607 {
608 yyextra->blockName.at(1)=']';
609 }
610 else if (yyextra->blockName.at(1)=='{')
611 {
612 yyextra->blockName.at(1)='}';
613 }
614 else if (yyextra->blockName.at(1)=='(')
615 {
616 yyextra->blockName.at(1)=')';
617 }
618 yyextra->lastCommentContext = YY_START;
619 yyextra->inVerbatim=true;
620 BEGIN(Verbatim);
621 }
622<CComment,ReadLine,IncludeFile>"<!--!" { /* HTML comment doxygen command*/
623 if (yyextra->inVerbatim) REJECT;
624
625 yyextra->inHtmlDoxygenCommand=true;
626 }
627<CComment,ReadLine,IncludeFile>"-->" { /* potential end HTML comment doxygen command*/
628 if (yyextra->inHtmlDoxygenCommand)
629 {
630 yyextra->inHtmlDoxygenCommand=false;
631 }
632 else
633 {
635 }
636 }
637<CComment,ReadLine,IncludeFile>"<!--" { /* HTML comment */
639 yyextra->blockName="-->";
640 yyextra->lastCommentContext = YY_START;
641 yyextra->inVerbatim=true;
642 BEGIN(Verbatim);
643 }
644<CComment,ReadLine,IncludeFile>[\\@]("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly")/[^a-z_A-Z0-9] { /* start of a verbatim block */
646 yyextra->blockName=
QCString(
"end")+&yytext[1];
647 yyextra->lastCommentContext = YY_START;
648 yyextra->inVerbatim=true;
649 BEGIN(Verbatim);
650 }
651<Scan>"\\\"" { /* escaped double quote */
653 }
654<Scan>"\\\\" { /* escaped backslash */
656 }
657<Scan>. { /* any other character */
659 }
660<Verbatim>[\\@]("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}"|"f)") { /* end of verbatim block */
662 if (&yytext[1]==yyextra->blockName)
663 {
664 yyextra->inVerbatim=false;
665 BEGIN(yyextra->lastCommentContext);
666 }
667 }
668<Verbatim>"-->" {
670 if (yytext==yyextra->blockName)
671 {
672 yyextra->inVerbatim=false;
673 BEGIN(yyextra->lastCommentContext);
674 }
675 }
676<VerbatimCode>"{" {
677 if (yyextra->javaBlock==0)
678 {
679 REJECT;
680 }
681 else
682 {
683 yyextra->javaBlock++;
685 }
686 }
687<VerbatimCode>"}" {
688 if (yyextra->javaBlock==0)
689 {
690 REJECT;
691 }
692 else
693 {
694 yyextra->javaBlock--;
695 if (yyextra->javaBlock==0)
696 {
698 yyextra->inVerbatim=false;
699 BEGIN(yyextra->lastCommentContext);
700 }
701 else
702 {
704 }
705 }
706 }
707<VerbatimCode>("```"[`]*|"~~~"[~]*) { /* end of markdown code block */
709 if (yytext[0]==yyextra->blockName[0])
710 {
711 yyextra->inVerbatim=false;
712 BEGIN(yyextra->lastCommentContext);
713 }
714 }
715<VerbatimCode>[\\@]("enddot"|"endcode"|"endmsc"|"enduml")/("{")? { /* end of verbatim block */
717 if (&yytext[1]==yyextra->blockName)
718 {
719 yyextra->inVerbatim=false;
720 BEGIN(yyextra->lastCommentContext);
721 }
722 }
723<VerbatimCode>^[ \t]*{CPPC}[\!\/]? { /* skip leading comments */
724 if (!yyextra->inSpecialComment || yyextra->mlBrief)
725 {
727 }
728 else
729 {
730 int l=0;
731 while (yytext[l]==' ' || yytext[l]=='\t')
732 {
733 l++;
734 }
736 if (yyleng-l==3)
737 {
739 }
740 else
741 {
743 }
744 }
745 }
746<Verbatim,VerbatimCode>[^`~@\/\-\\\n{}]* { /* any character not a backslash or new line or } */
748 }
749<Verbatim,VerbatimCode>\n { /* new line in verbatim block */
751 if (yyextra->lastCommentContext == IncludeFile)
752 {
754 }
755 }
756<Verbatim>^[ \t]*{CPPC}[/!] {
757 if (yyextra->blockName=="enddot" || yyextra->blockName=="endmsc" || yyextra->blockName=="enduml" || yyextra->blockName.at(0)=='f')
758 {
759
760 int l=0;
761 while (yytext[l]==' ' || yytext[l]=='\t')
762 {
763 l++;
764 }
767 }
768 else
769 {
770 REJECT;
771 }
772 }
773<Verbatim,VerbatimCode>. { /* any other character */
775 }
776<SkipString>\\. { /* escaped character in string */
778 {
779 unput(yytext[1]);
781 }
782 else
783 {
785 }
786 }
787<SkipString>"\"" { /* end of string */
789 BEGIN(yyextra->stringContext);
790 }
791<SkipString>. { /* any other string character */
793 }
794<SkipString>\n { /* new line inside string (illegal for some compilers) */
796 }
797<SkipVerbString>[^"\n]+ {
799 }
800<SkipVerbString>\"\" { // escaped quote
802 }
803<SkipVerbString>"\"" { /* end of string */
805 BEGIN(yyextra->stringContext);
806 }
807<SkipVerbString>. {
809 }
810<SkipVerbString>\n {
812 }
813<SkipChar>\\. { /* escaped character */
815 {
816 unput(yytext[1]);
818 }
819 else
820 {
822 }
823 }
824<SkipChar>' { /* end of character literal */
826 BEGIN(yyextra->charContext);
827 }
828<SkipChar>. { /* any other string character */
830 }
831<SkipChar>\n { /* new line character */
833 }
834
835<CComment,CNComment>[^ `~<\\!@*\n{\"'\/-]* { /* anything that is not a '*' or command */
837 }
838<CComment,CNComment>^{B}*"*"+[^*\/<\\@\n{\"]* { /* stars without slashes */
841 if (yyextra->col>yyextra->blockHeadCol)
842 {
843
844 yyextra->blockHeadCol=yyextra->col;
845 }
847 }
848<CComment>"'''" |
849<CComment>"\"\"\"" { /* end of Python docstring */
851 {
852 REJECT;
853 }
854 else if (yyextra->pythonDocStringChar != yytext[0])
855 {
857 }
858 else
859 {
860 yyextra->nestingCount--;
861 yyextra->pythonDocString =
FALSE;
862 yyextra->pythonDocStringChar = '\0';
864 BEGIN(Scan);
865 }
866 }
867<CComment,CNComment>\n { /* new line in comment */
869
871 {
872 BEGIN(Scan);
873 }
874 }
875<CComment,CNComment>"/""/"+/"*/" { /* we are already in C-comment so not a start of a nested comment but
876 * just the
end of the
comment (the
end part is handled later). */
878 }
DirIterator end(const DirIterator &) noexcept
879<CComment,CNComment>"/"+"*" { /* nested C comment */
882 {
883 REJECT;
884 }
885 yyextra->nestingCount++;
886 yyextra->commentStack.push(yyextra->lineNr);
888 }
889<CComment,CNComment>^{B}*"*"+"/" |
890<CComment,CNComment>"*"+"/" { /* end of C comment */
893 {
894 REJECT;
895 }
896 else
897 {
899 yyextra->nestingCount--;
900 if (yyextra->nestingCount<=0)
901 {
902 BEGIN(Scan);
903 }
904 else
905 {
906
907 yyextra->commentStack.pop();
908 }
909 }
910 }
911
912<CComment,CNComment>"\n"/[ \t]*"#" {
914 {
915 REJECT;
916 }
917 else
918 {
919 if (yyextra->vhdl)
920 {
921 yyextra->vhdl =
FALSE;
923 BEGIN(Scan);
924 }
925 else
926 {
927 REJECT;
928 }
929 }
930 }
931<CComment,CNComment>"\n"/[ \t]*"-" {
933 {
934 REJECT;
935 }
936 else
937 {
939 BEGIN(Scan);
940 }
941 }
942<CComment,CNComment>"\n"/[ \t]*[^ \t#\-] {
944 {
945 if (yyextra->pythonDocString)
946 {
947 REJECT;
948 }
949 else
950 {
952 BEGIN(Scan);
953 }
954 }
956 {
957 if (yyextra->vhdl)
958 {
959 yyextra->vhdl =
FALSE;
961 BEGIN(Scan);
962 }
963 else
964 {
965 REJECT;
966 }
967 }
968 else
969 {
970 REJECT;
971 }
972 }
973
974<CComment,CNComment>"'" {
975 yyextra->charContext = YY_START;
977 BEGIN(SkipChar);
978 }
979<CComment,CNComment>"\"" {
980 yyextra->stringContext = YY_START;
982 BEGIN(SkipString);
983 }
984 */
985<CComment,CNComment>{CMD}{CMD} |
986<CComment,CNComment>. {
988 }
989<SComment>^[ \t]*{CPPC}"/"{SLASHopt}/\n {
991 }
992<SComment>\n[ \t]*{CPPC}"/"{SLASHopt}/\n {
994 }
995<SComment>^[ \t]*{CPPC}"/"[^\/\n]/.*\n {
997 yyextra->readLineCtx=YY_START;
998 BEGIN(ReadLine);
999 }
1000<SComment>\n[ \t]*{CPPC}[\/!]("<")?[ \t]*[\\@]"}".*\n {
1001
1004 yyextra->inSpecialComment=false;
1005 yyextra->inRoseComment=false;
1006 BEGIN(Scan);
1007 }
1008<SComment>\n[ \t]*{CPPC}"/"[^\\@\/\n]/.*\n {
1010 yyextra->readLineCtx=YY_START;
1011 BEGIN(ReadLine);
1012 }
1013<SComment>^[ \t]*{CPPC}"!" | // just //!
1014<SComment>^[ \t]*{CPPC}"!<"/.*\n | // or //!< something
1015<SComment>^[ \t]*{CPPC}"!"[^<]/.*\n { // or //!something
1017 yyextra->readLineCtx=YY_START;
1018 BEGIN(ReadLine);
1019 }
1020<SComment>\n[ \t]*{CPPC}"!" |
1021<SComment>\n[ \t]*{CPPC}"!<"/.*\n |
1022<SComment>\n[ \t]*{CPPC}"!"[^<\n]/.*\n {
1024 yyextra->readLineCtx=YY_START;
1025 BEGIN(ReadLine);
1026 }
1027<SComment>^[ \t]*{CPPC}"##"/.*\n {
1028 if (!yyextra->inRoseComment)
1029 {
1030 REJECT;
1031 }
1032 else
1033 {
1035 yyextra->readLineCtx=YY_START;
1036 BEGIN(ReadLine);
1037 }
1038 }
1039<SComment>\n[ \t]*{CPPC}"##"/.*\n {
1040 if (!yyextra->inRoseComment)
1041 {
1042 REJECT;
1043 }
1044 else
1045 {
1047 yyextra->readLineCtx=YY_START;
1048 BEGIN(ReadLine);
1049 }
1050 }
1051<SComment>\n { /* end of special comment */
1054 yyextra->inSpecialComment=
FALSE;
1055 yyextra->inRoseComment=
FALSE;
1056 yyextra->insertCppCommentMarker=false;
1057 yyextra->readLineCtx = Scan;
1058
1059 BEGIN(Scan);
1060 }
1061<ReadLine>{CCS}"*" {
1063 }
1064<ReadLine>{CCE} {
1066 }
1067<ReadLine,CopyLine>"*" {
1069 }
1070<ReadLine,CopyLine>{RL} {
1072 }
1073<ReadLine,CopyLine>{RL}/{B}"\\ilinebr"{B} {
1075 }
1076<ReadLine,CopyLine>{RLopt}/\n {
1078 yyextra->insertCppCommentMarker=false;
1079 BEGIN(yyextra->readLineCtx);
1080 }
1081<CComment,CNComment,ReadLine>"\<" { /* escaped html comment */
1083 }
1084<CComment,CNComment,ReadLine>[\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command
1086 }
1087
1088<CComment,ReadLine,IncludeFile>[\\@]("include"{OPTS}|"includedoc"{OPTS}*) {
1089 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1090 yyextra->includeCtx = YY_START;
1091 yyextra->firstIncludeLine = true;
1092 yyextra->insertCommentCol = yyextra->col;
1093 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1094 {
1095 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1096 }
1097
1098 BEGIN(IncludeDoc);
1099 }
1100<CComment,ReadLine,IncludeFile>[\\@]("snippet"{OPTS}|"snippetdoc"{OPTS}*) {
1101 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1102 yyextra->includeCtx = YY_START;
1103 yyextra->firstIncludeLine = true;
1104 yyextra->insertCommentCol = yyextra->col;
1105 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1106 {
1107 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1108 }
1109
1110 BEGIN(SnippetDoc);
1111 }
1112<IncludeDoc,SnippetDoc>{B}*
1113<IncludeDoc>{FILEMASK}|"\""[^\n\"]+"\"" {
1115 if (yytext[0]=='"')
1116 {
1117 fileName=fileName.
mid(1,fileName.
length()-2);
1118 }
1120 {
1121 BEGIN(IncludeFile);
1122 }
1123 else
1124 {
1125 BEGIN(yyextra->includeCtx);
1126 }
1127 }
1128<SnippetDoc>({FILEMASK}|"\""[^\n\"]+"\""){B}+ {
1129 yyextra->snippetFileName=yytext;
1130 yyextra->snippetFileName=yyextra->snippetFileName.stripWhiteSpace();
1131 if (yyextra->snippetFileName == "this") yyextra->snippetFileName=yyextra->fileName;
1132 yyextra->snippetName = "";
1133 BEGIN(SnippetDocTag);
1134 }
1135<SnippetDocTag>[^\\\n]+ {
1136 yyextra->snippetName += yytext;
1137 }
1138<SnippetDocTag>"\\" {
1139 yyextra->snippetName += yytext;
1140 }
1141<SnippetDocTag>(\n|"\\ilinebr") {
1142 for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]);
1143 yyextra->snippetName = yyextra->snippetName.stripWhiteSpace();
1144 QCString blockId =
"["+yyextra->snippetName+
"]";
1146 {
1147 BEGIN(IncludeFile);
1148 }
1149 else
1150 {
1151 BEGIN(yyextra->includeCtx);
1152 }
1153 }
1154
1155<IncludeDoc,SnippetDoc>\n {
1158
1159
1160 BEGIN(yyextra->includeCtx);
1161 }
1162<IncludeDoc,SnippetDoc>. { // invalid character
1164 BEGIN(yyextra->includeCtx);
1165 }
1166<CComment,ReadLine,IncludeFile>[\\@]"cond"/[^a-z_A-Z0-9] { // conditional section
1167 yyextra->condCtx = YY_START;
1168 BEGIN(CondLine);
1169 }
1170<CComment,ReadLine,IncludeFile>[\\@]"endcond"/[^a-z_A-Z0-9] { // end of conditional section
1171 bool oldSkip=yyextra->skip;
1173 if (YY_START==CComment && oldSkip && !yyextra->skip)
1174 {
1175
1180 {
1181 yyextra->outBuf+='/';
1182 yyextra->outBuf+='*';
1183 yyextra->col+=2;
1184 if (yyextra->specialComment)
1185 {
1186 yyextra->outBuf+='*';
1187 yyextra->col++;
1188 }
1189 }
1190 }
1191 }
1192<CondLine>[!()&| \ta-z_A-Z0-9.\-]+ {
1194 }
1195<CComment,ReadLine,IncludeFile>[\\@]"cond"{WSopt}/\n {
1196 yyextra->condCtx=YY_START;
1198 }
1199<CondLine>\n |
1200<CondLine>. { // forgot section id?
1203 }
1204<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>[\\@][a-z_A-Z][a-z_A-Z0-9-]* { // expand alias without arguments
1205 replaceAliases(yyscanner,yytext,YY_START==ReadLine && yyextra->readLineCtx==SComment);
1206 }
1207<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{B}?"\\ilinebr"{B}[\\@]"ialias{" { // expand alias with arguments
1208 yyextra->lastBlockContext=YY_START;
1209 yyextra->blockCount=1;
1210 int extraSpace = (yytext[0]==' '? 1:0);
1211 yyextra->aliasString=yytext+9+extraSpace;
1212 yyextra->aliasCmd=yytext+9+extraSpace;
1213 yyextra->lastEscaped=0;
1214 BEGIN( ReadAliasArgs );
1215 }
1216<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>[\\@][a-z_A-Z][a-z_A-Z0-9-]*"{" { // expand alias with arguments
1217 yyextra->lastBlockContext=YY_START;
1218 yyextra->blockCount=1;
1219 yyextra->aliasString=yytext;
1220 yyextra->aliasCmd=yytext;
1221 yyextra->lastEscaped=0;
1222 BEGIN( ReadAliasArgs );
1223 }
1224<ReadAliasArgs>^[ \t]*"*" { // skip leading *
1225 }
1226<ReadAliasArgs>^[ \t]*{CPPC}[/!]/[^\n]* { // skip leading special comments (see bug 618079)
1227 }
1228<ReadAliasArgs>[^{}\n\\\*]+ {
1229 yyextra->aliasString+=yytext;
1230 yyextra->lastEscaped=
FALSE;
1231 }
1232<ReadAliasArgs>"\\" {
1233 if (yyextra->lastEscaped) yyextra->lastEscaped=
FALSE;
1234 else yyextra->lastEscaped=
TRUE;
1235 yyextra->aliasString+=yytext;
1236 }
1237<ReadAliasArgs>[\\@]("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}"|"f)") { /* end of verbatim block */
1238 yyextra->aliasString+=yytext;
1239 if (yyextra->inVerbatim && &yytext[1]==yyextra->blockName)
1240
1241
1242
1243
1244
1245
1246 {
1248 yyextra->inVerbatim=false;
1249 BEGIN(yyextra->lastCommentContext);
1250 }
1251 }
1252<ReadAliasArgs>\n {
1253 yyextra->aliasString+=yytext;
1254 yyextra->lastEscaped=
FALSE;
1255 if (yyextra->inVerbatim)
1256
1257 {
1259 BEGIN( yyextra->lastBlockContext );
1260 }
1261 }
1262<ReadAliasArgs>"{" {
1263 yyextra->aliasString+=yytext;
1264 if (!yyextra->lastEscaped) yyextra->blockCount++;
1265 yyextra->lastEscaped=
FALSE;
1266 }
1267<ReadAliasArgs>"}" {
1268 yyextra->aliasString+=yytext;
1269 if (!yyextra->lastEscaped) yyextra->blockCount--;
1270 if (yyextra->blockCount==0)
1271 {
1273 yyextra->lastBlockContext==ReadLine && yyextra->readLineCtx==SComment);
1274 BEGIN( yyextra->lastBlockContext );
1275 }
1276 yyextra->lastEscaped=
FALSE;
1277 }
1278<ReadAliasArgs>. {
1279 yyextra->aliasString+=yytext;
1280 yyextra->lastEscaped=
FALSE;
1281 }
1282<CopyLine>. {
1284 }
1285<CopyLine>\n {
1287 yyextra->insertCppCommentMarker=false;
1288 BEGIN(yyextra->readLineCtx);
1289 }
1290<ReadLine>``` {
1292 }
1293<ReadLine>`[^`]+` {
1295 }
1296<ReadLine>{CMD}{CMD} |
1297<ReadLine>. {
1299 }
1300<IncludeFile>. {
1302 }
1303<IncludeFile>\n {
1306 }
1307<*>. {
1309 }
1310<<EOF>> {
1311 if (YY_START == ReadAliasArgs)
1312 {
1313 warn(yyextra->fileName,yyextra->lineNr,
1314 "Reached end of file while still searching closing '}}' of an alias argument (probable start: '{}')",
1315 yyextra->aliasCmd);
1316 }
1317 if (yyextra->includeStack.empty())
1318 {
1319 yyextra->insertCppCommentMarker=false;
1321 }
1322 else
1323 {
1324 std::unique_ptr<commentcnv_FileState> &fs = yyextra->includeStack.back();
1325 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
1326 yy_switch_to_buffer(fs->bufState, yyscanner);
1327 yy_delete_buffer(oldBuf, yyscanner);
1328 BEGIN(fs->oldState);
1329 yyextra->fileName = fs->oldFileName;
1330 yyextra->lineNr = fs->oldLineNr;
1331 yyextra->inBuf = fs->oldFileBuf;
1332 yyextra->inBufPos = fs->oldFileBufPos;
1333 yyextra->includeCtx = fs->oldIncludeCtx;
1335 if (fs->oldRaiseLvl!=yyextra->raiseLevel)
1336 {
1337 lineStr+="\\iraise " + std::to_string(fs->oldRaiseLvl)+ " ";
1338 }
1339 if (fs->oldRaiseLbl!=yyextra->raiseLabel)
1340 {
1341 lineStr+="\\iprefix \"" + fs->oldRaiseLbl + "\" ";
1342 }
1343 lineStr+="\\ilinebr ";
1344 yyextra->raiseLevel = fs->oldRaiseLvl;
1345 yyextra->raiseLabel = fs->oldRaiseLbl;
1347 yyextra->includeStack.pop_back();
1348
1349
1350 }
1351 }
1352
1353<*>\n { fprintf(stderr,"Lex scanner %s (%s) default rule newline for state %s.\n", __FILE__, qPrint(yyextra->fileName),stateToString(YY_START));}
1354 */
1355%%