254 {NUMBER} {
255 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
257 }
258<Scan>[^"'!\/\n\\#,\-=; \t@$]* { /* eat anything that is not " / , or \n */
260 }
261<Scan>[,= ;\t] { /* eat , so we have a nice separator in long initialization lines */
263 }
264<Scan>"'''"! |
265<Scan>"\"\"\""! { /* start of python long comment */
266 if (yyextra->lang!=SrcLangExt::Python)
267 {
268 REJECT;
269 }
270 else
271 {
272 yyextra->pythonDocString =
TRUE;
273 yyextra->pythonDocStringChar = yytext[0];
274 yyextra->nestingCount=1;
277 BEGIN(CComment);
278 yyextra->commentStack.push(yyextra->lineNr);
279 }
280 }
281<Scan>"'''" |
282<Scan>"\"\"\"" { /* start of python long comment */
283 if (yyextra->lang!=SrcLangExt::Python)
284 {
285 REJECT;
286 }
288 {
289 REJECT;
290 }
291 else
292 {
293 yyextra->pythonDocString =
TRUE;
294 yyextra->pythonDocStringChar = yytext[0];
295 yyextra->nestingCount=1;
298 BEGIN(CComment);
299 yyextra->commentStack.push(yyextra->lineNr);
300 }
301 }
302<Scan>{B}*![><!]/.*\n {
303 if (yyextra->lang!=SrcLangExt::Fortran)
304 {
305 REJECT;
306 }
307 else
308 {
309 yyextra->nestingCount=0;
311 yyextra->specialComment=true;
313 yyextra->blockHeadCol=yyextra->col-2;
314 BEGIN(CComment);
315 yyextra->commentStack.push(yyextra->lineNr);
316 }
317 }
318<Scan>[Cc\*][><!]/.*\n {
319 if (yyextra->lang!=SrcLangExt::Fortran)
320 {
321 REJECT;
322 }
323 else
324 {
325
326 if (yyextra->isFixedForm && (yyextra->col == 0))
327 {
328 yyextra->nestingCount=0;
330 yyextra->specialComment=true;
332 yyextra->blockHeadCol=yyextra->col-1;
333 BEGIN(CComment);
334 yyextra->commentStack.push(yyextra->lineNr);
335 }
336 else
337 {
338 REJECT;
339 }
340 }
341 }
342<Scan>!.*\n {
343 if (yyextra->lang!=SrcLangExt::Fortran)
344 {
345 REJECT;
346 }
347 else
348 {
350 }
351 }
352<Scan>[Cc\*].*\n {
353 if (yyextra->lang!=SrcLangExt::Fortran)
354 {
355 REJECT;
356 }
357 else
358 {
359 if (yyextra->col == 0)
360 {
362 }
363 else
364 {
365 REJECT;
366 }
367 }
368 }
369<Scan>[$]?"@\"" { /* start of an interpolated verbatim C# string */
370 if (yyextra->lang!=SrcLangExt::CSharp) REJECT
372 yyextra->stringContext = YY_START;
373 BEGIN(SkipVerbString);
374 }
375<Scan>"\"" { /* start of a string */
377 yyextra->stringContext = YY_START;
378 BEGIN(SkipString);
379 }
380<Scan>' {
382 yyextra->charContext = YY_START;
383 if (yyextra->lang!=SrcLangExt::VHDL)
384 {
385 BEGIN(SkipChar);
386 }
387 }
388<Scan>\n { /* new line */
390 }
391<Scan>{CPPC}"!"/.*\n[ \t]*{CPPC}[\/!][^\/] | /* start C++ style special comment block */
392<Scan>({CPPC}"/"[/]*)/[^/].*\n[ \t]*{CPPC}[\/!][^\/] { /* start C++ style special comment block */
393 if (yyextra->mlBrief)
394 {
395 REJECT;
396 }
397 else
398 {
399 int i=3;
400 if (yytext[2]=='/')
401 {
402 while (i<(int)yyleng && yytext[i]=='/') i++;
403 }
404 yyextra->blockHeadCol=yyextra->col+1;
405 if (yytext[2] == '!')
406 {
408 }
409 else
410 {
412 }
414 yyextra->inSpecialComment=
TRUE;
415
416 yyextra->readLineCtx=SComment;
417 BEGIN(ReadLine);
418 }
419 }
420<Scan>{CPPC}"##Documentation"{ANYopt}/\n { /* Start of Rational Rose ANSI C++ comment block */
421 if (yyextra->mlBrief) REJECT;
422 int i=17;
423 yyextra->blockHeadCol=yyextra->col+1;
426 yyextra->inRoseComment=
TRUE;
427 BEGIN(SComment);
428 }
429<Scan>{CPPC}[!\/]/.*\n[ \t]*{CPPC}[|\/][ \t]*[@\\]"}" { // next line contains an end marker, see bug 752712
430 yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!';
431 if (yyextra->inSpecialComment)
432 {
433 yyextra->blockHeadCol=yyextra->col+1;
434 }
436 yyextra->readLineCtx=YY_START;
437 BEGIN(ReadLine);
438 }
439<Scan>{CPPC}[!/]/.*\n { /* one line special C++ comment */
440 yyextra->inSpecialComment=true;
441 yyextra->blockHeadCol=yyextra->col+1;
442 yyextra->insertCppCommentMarker=true;
444 yyextra->readLineCtx=YY_START;
445 BEGIN(ReadLine);
446 }
447<Scan>{CPPC}/.*\n { /* one line normal C++ comment */
448 yyextra->inSpecialComment=false;
450 yyextra->readLineCtx=YY_START;
451 BEGIN(CopyLine);
452 }
453<Scan>{CCS}{CCE} { /* avoid matching next rule for empty C comment, see bug 711723 */
455 }
456<Scan>{CCS}[*!]? { /* start of a C comment */
457 if (yyextra->lang==SrcLangExt::Python)
458 {
459 REJECT;
460 }
461 yyextra->specialComment=(int)yyleng==3;
462 yyextra->nestingCount=1;
465 if (yyextra->specialComment)
466 {
467 yyextra->blockHeadCol=0;
468 BEGIN(CComment);
469 }
470 else
471 {
472 BEGIN(CNComment);
473 }
474 yyextra->commentStack.push(yyextra->lineNr);
475 }
476<Scan>"#"[^\n]*\n {
477 if (yyextra->lang!=SrcLangExt::PHP)
478 {
479 REJECT;
480 }
482 }
483<Scan>"#"("#")? {
484 if (yyextra->lang!=SrcLangExt::Python)
485 {
486 REJECT;
487 }
488 else
489 {
490 yyextra->nestingCount=0;
492 yyextra->specialComment=(int)yyleng==2;
493 if (yyextra->specialComment)
494 {
495 yyextra->blockHeadCol=yyextra->col;
496 }
497 yyextra->commentStack.push(yyextra->lineNr);
499 BEGIN(CComment);
500 }
501 }
502<Scan>"--"[^!][^\n]* {
503 if (yyextra->lang!=SrcLangExt::VHDL)
504 {
505 REJECT;
506 }
507 else
508 {
510 }
511 }
512<Scan>"--!" {
513 if (yyextra->lang!=SrcLangExt::VHDL)
514 {
515 REJECT;
516 }
517 else
518 {
519 yyextra->specialComment=true;
520 yyextra->blockHeadCol=yyextra->col;
521 yyextra->vhdl =
TRUE;
522 yyextra->nestingCount=0;
524 yyextra->commentStack.push(yyextra->lineNr);
526 BEGIN(CComment);
527 }
528 }
529<Scan>{B}*![><!] {
530 if (yyextra->lang!=SrcLangExt::Fortran)
531 {
532 REJECT;
533 }
534 else
535 {
536 yyextra->nestingCount=0;
538 yyextra->specialComment=true;
539 yyextra->blockHeadCol=yyextra->col;
540 yyextra->commentStack.push(yyextra->lineNr);
542 BEGIN(CComment);
543 }
544 }
545<CComment,CNComment,ReadLine,IncludeFile>{MAILADDR} |
546<CComment,CNComment,ReadLine,IncludeFile>"<"{MAILADDR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block
548 }
549<CComment,IncludeFile>"{"[ \t]*"@code"/[ \t\n] {
551 yyextra->lastCommentContext = YY_START;
552 yyextra->javaBlock=1;
553 yyextra->blockName=
QCString(
"end")+&yytext[1];
554 yyextra->inVerbatim=true;
555 BEGIN(VerbatimCode);
556 }
557<CComment,IncludeFile>"{"[ \t]*"@literal"/[ \t\n] {
559 yyextra->lastCommentContext = YY_START;
560 yyextra->javaBlock=1;
561 yyextra->blockName=
QCString(
"end")+&yytext[1];
562 yyextra->inVerbatim=true;
563 BEGIN(VerbatimCode);
564 }
565<CComment,ReadLine,IncludeFile>{CMD}"ilinebr"[ \t]+("```"[`]*|"~~~"[~]*) { /* start of markdown code block */
567 {
568 REJECT;
569 }
571 yyextra->lastCommentContext = YY_START;
572 yyextra->javaBlock=0;
574 yyextra->inVerbatim=true;
575 BEGIN(VerbatimCode);
576 }
QCString right(size_t len) const
577<CComment,ReadLine,IncludeFile>^[ \t]*("```"[`]*|"~~~"[~]*) { /* start of markdown code block */
579 {
580 REJECT;
581 }
583 yyextra->lastCommentContext = YY_START;
584 yyextra->javaBlock=0;
586 yyextra->inVerbatim=true;
587 BEGIN(VerbatimCode);
588 }
QCString left(size_t len) const
589<CComment,ReadLine,IncludeFile>[\\@]("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */
591 yyextra->lastCommentContext = YY_START;
592 yyextra->javaBlock=0;
593 if (
qstrcmp(&yytext[1],
"startuml")==0)
594 {
595 yyextra->blockName="enduml";
596 }
597 else
598 {
599 yyextra->blockName=
QCString(
"end")+&yytext[1];
600 }
601 yyextra->inVerbatim=true;
602 BEGIN(VerbatimCode);
603 }
int qstrcmp(const char *str1, const char *str2)
604<CComment,ReadLine,IncludeFile>[\\@]("f$"|"f["|"f{"|"f(") {
606 yyextra->blockName=&yytext[1];
607 if (yyextra->blockName.at(1)=='[')
608 {
609 yyextra->blockName.at(1)=']';
610 }
611 else if (yyextra->blockName.at(1)=='{')
612 {
613 yyextra->blockName.at(1)='}';
614 }
615 else if (yyextra->blockName.at(1)=='(')
616 {
617 yyextra->blockName.at(1)=')';
618 }
619 yyextra->lastCommentContext = YY_START;
620 yyextra->inVerbatim=true;
621 BEGIN(Verbatim);
622 }
623<CComment,ReadLine,IncludeFile>"<!--!" { /* HTML comment doxygen command*/
624 if (yyextra->inVerbatim) REJECT;
625
626 yyextra->inHtmlDoxygenCommand=true;
627 }
628<CComment,ReadLine,IncludeFile>"-->" { /* potential end HTML comment doxygen command*/
629 if (yyextra->inHtmlDoxygenCommand)
630 {
631 yyextra->inHtmlDoxygenCommand=false;
632 }
633 else
634 {
636 }
637 }
638<CComment,ReadLine,IncludeFile>"<!--" { /* HTML comment */
640 yyextra->blockName="-->";
641 yyextra->lastCommentContext = YY_START;
642 yyextra->inVerbatim=true;
643 BEGIN(Verbatim);
644 }
645<CComment,ReadLine,IncludeFile>[\\@]("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly")/[^a-z_A-Z0-9] { /* start of a verbatim block */
647 yyextra->blockName=
QCString(
"end")+&yytext[1];
648 yyextra->lastCommentContext = YY_START;
649 yyextra->inVerbatim=true;
650 BEGIN(Verbatim);
651 }
652<Scan>"\\\"" { /* escaped double quote */
654 }
655<Scan>"\\\\" { /* escaped backslash */
657 }
658<Scan>. { /* any other character */
660 }
661<Verbatim>[\\@]("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}"|"f)") { /* end of verbatim block */
663 if (&yytext[1]==yyextra->blockName)
664 {
665 yyextra->inVerbatim=false;
666 BEGIN(yyextra->lastCommentContext);
667 }
668 }
669<Verbatim>"-->" {
671 if (yytext==yyextra->blockName)
672 {
673 yyextra->inVerbatim=false;
674 BEGIN(yyextra->lastCommentContext);
675 }
676 }
677<VerbatimCode>"{" {
678 if (yyextra->javaBlock==0)
679 {
680 REJECT;
681 }
682 else
683 {
684 yyextra->javaBlock++;
686 }
687 }
688<VerbatimCode>"}" {
689 if (yyextra->javaBlock==0)
690 {
691 REJECT;
692 }
693 else
694 {
695 yyextra->javaBlock--;
696 if (yyextra->javaBlock==0)
697 {
699 yyextra->inVerbatim=false;
700 BEGIN(yyextra->lastCommentContext);
701 }
702 else
703 {
705 }
706 }
707 }
708<VerbatimCode>("```"[`]*|"~~~"[~]*) { /* end of markdown code block */
710 if (yytext[0]==yyextra->blockName[0])
711 {
712 yyextra->inVerbatim=false;
713 BEGIN(yyextra->lastCommentContext);
714 }
715 }
716<VerbatimCode>[\\@]("enddot"|"endcode"|"endmsc"|"enduml")/("{")? { /* end of verbatim block */
718 if (&yytext[1]==yyextra->blockName)
719 {
720 yyextra->inVerbatim=false;
721 BEGIN(yyextra->lastCommentContext);
722 }
723 }
724<VerbatimCode>^[ \t]*{CPPC}[\!\/]? { /* skip leading comments */
725 if (!yyextra->inSpecialComment || yyextra->mlBrief)
726 {
728 }
729 else
730 {
731 int l=0;
732 while (yytext[l]==' ' || yytext[l]=='\t')
733 {
734 l++;
735 }
737 if (yyleng-l==3)
738 {
740 }
741 else
742 {
744 }
745 }
746 }
747<Verbatim,VerbatimCode>[^`~@\/\-\\\n{}]* { /* any character not a backslash or new line or } */
749 }
750<Verbatim,VerbatimCode>\n { /* new line in verbatim block */
752 if (yyextra->lastCommentContext == IncludeFile)
753 {
755 }
756 }
757<Verbatim>^[ \t]*{CPPC}[/!] {
758 if (yyextra->blockName=="enddot" || yyextra->blockName=="endmsc" || yyextra->blockName=="enduml" || yyextra->blockName.at(0)=='f')
759 {
760
761 int l=0;
762 while (yytext[l]==' ' || yytext[l]=='\t')
763 {
764 l++;
765 }
768 }
769 else
770 {
771 REJECT;
772 }
773 }
774<Verbatim,VerbatimCode>. { /* any other character */
776 }
777<SkipString>\\. { /* escaped character in string */
778 if (yyextra->lang==SrcLangExt::Fortran || yyextra->lang==SrcLangExt::VHDL)
779 {
780 unput(yytext[1]);
782 }
783 else
784 {
786 }
787 }
788<SkipString>"\"" { /* end of string */
790 BEGIN(yyextra->stringContext);
791 }
792<SkipString>. { /* any other string character */
794 }
795<SkipString>\n { /* new line inside string (illegal for some compilers) */
797 }
798<SkipVerbString>[^"\n]+ {
800 }
801<SkipVerbString>\"\" { // escaped quote
803 }
804<SkipVerbString>"\"" { /* end of string */
806 BEGIN(yyextra->stringContext);
807 }
808<SkipVerbString>. {
810 }
811<SkipVerbString>\n {
813 }
814<SkipChar>\\. { /* escaped character */
815 if (yyextra->lang==SrcLangExt::Fortran || yyextra->lang==SrcLangExt::VHDL)
816 {
817 unput(yytext[1]);
819 }
820 else
821 {
823 }
824 }
825<SkipChar>' { /* end of character literal */
827 BEGIN(yyextra->charContext);
828 }
829<SkipChar>. { /* any other string character */
831 }
832<SkipChar>\n { /* new line character */
834 }
835
836<CComment,CNComment>[^ `~<\\!@*\n{\"'\/-]* { /* anything that is not a '*' or command */
838 }
839<CComment,CNComment>^{B}*"*"+[^*\/<\\@\n{\"]* { /* stars without slashes */
840 if (yyextra->lang==SrcLangExt::Markdown) REJECT;
842 if (yyextra->col>yyextra->blockHeadCol)
843 {
844
845 yyextra->blockHeadCol=yyextra->col;
846 }
848 }
849<CComment>"'''" |
850<CComment>"\"\"\"" { /* end of Python docstring */
851 if (yyextra->lang!=SrcLangExt::Python)
852 {
853 REJECT;
854 }
855 else if (yyextra->pythonDocStringChar != yytext[0])
856 {
858 }
859 else
860 {
861 yyextra->nestingCount--;
862 yyextra->pythonDocString =
FALSE;
863 yyextra->pythonDocStringChar = '\0';
865 BEGIN(Scan);
866 }
867 }
868<CComment,CNComment>\n { /* new line in comment */
870
871 if (yyextra->lang==SrcLangExt::Fortran)
872 {
873 BEGIN(Scan);
874 }
875 }
876<CComment,CNComment>"/""/"+/"*/" { /* we are already in C-comment so not a start of a nested comment but
877 * just the
end of the
comment (the
end part is handled later). */
879 }
DirIterator end(const DirIterator &) noexcept
880<CComment,CNComment>"/"+"*" { /* nested C comment */
881 if (yyextra->lang==SrcLangExt::Python ||
882 yyextra->lang==SrcLangExt::Markdown)
883 {
884 REJECT;
885 }
886 yyextra->nestingCount++;
887 yyextra->commentStack.push(yyextra->lineNr);
889 }
890<CComment,CNComment>^{B}*"*"+"/" |
891<CComment,CNComment>"*"+"/" { /* end of C comment */
892 if (yyextra->lang==SrcLangExt::Python ||
893 yyextra->lang==SrcLangExt::Markdown)
894 {
895 REJECT;
896 }
897 else
898 {
900 yyextra->nestingCount--;
901 if (yyextra->nestingCount<=0)
902 {
903 BEGIN(Scan);
904 }
905 else
906 {
907
908 yyextra->commentStack.pop();
909 }
910 }
911 }
912
913<CComment,CNComment>"\n"/[ \t]*"#" {
914 if (yyextra->lang!=SrcLangExt::VHDL)
915 {
916 REJECT;
917 }
918 else
919 {
920 if (yyextra->vhdl)
921 {
922 yyextra->vhdl =
FALSE;
924 BEGIN(Scan);
925 }
926 else
927 {
928 REJECT;
929 }
930 }
931 }
932<CComment,CNComment>"\n"/[ \t]*"-" {
933 if (yyextra->lang!=SrcLangExt::Python || yyextra->pythonDocString)
934 {
935 REJECT;
936 }
937 else
938 {
940 BEGIN(Scan);
941 }
942 }
943<CComment,CNComment>"\n"/[ \t]*[^ \t#\-] {
944 if (yyextra->lang==SrcLangExt::Python)
945 {
946 if (yyextra->pythonDocString)
947 {
948 REJECT;
949 }
950 else
951 {
953 BEGIN(Scan);
954 }
955 }
956 else if (yyextra->lang==SrcLangExt::VHDL)
957 {
958 if (yyextra->vhdl)
959 {
960 yyextra->vhdl =
FALSE;
962 BEGIN(Scan);
963 }
964 else
965 {
966 REJECT;
967 }
968 }
969 else
970 {
971 REJECT;
972 }
973 }
974
975<CComment,CNComment>"'" {
976 yyextra->charContext = YY_START;
978 BEGIN(SkipChar);
979 }
980<CComment,CNComment>"\"" {
981 yyextra->stringContext = YY_START;
983 BEGIN(SkipString);
984 }
985 */
986<CComment,CNComment>{CMD}"~"[a-z_A-Z-]* { // language switch command
987 if (yyextra->lang!=SrcLangExt::Markdown) REJECT;
991 {
993 {
994 warn(yyextra->fileName,yyextra->lineNr,
996 }
997 BEGIN(SkipLang);
998 }
999 }
#define Config_getEnumAsString(name)
#define Config_isAvailableEnum(name, value)
int qstricmp(const char *s1, const char *s2)
1000<CComment,CNComment>{CMD}{CMD} |
1001<CComment,CNComment>. {
1003 }
1004<SkipLang>{CMD}"~"[a-zA-Z-]* { /* language switch */
1007 {
1008 warn(yyextra->fileName,yyextra->lineNr,
1010 }
1013 {
1014 BEGIN(CComment);
1015 }
1016 }
1017<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
1018 }
1019<SkipLang>\n { /* new line in language block, needed for keeping track of line numbers */
1021 }
1022<SkipLang>. { /* any other character */
1023 }
1024<SComment>^[ \t]*{CPPC}"/"{SLASHopt}/\n {
1026 }
1027<SComment>\n[ \t]*{CPPC}"/"{SLASHopt}/\n {
1029 }
1030<SComment>^[ \t]*{CPPC}"/"[^\/\n]/.*\n {
1032 yyextra->readLineCtx=YY_START;
1033 BEGIN(ReadLine);
1034 }
1035<SComment>\n[ \t]*{CPPC}[\/!]("<")?[ \t]*[\\@]"}".*\n {
1036
1039 yyextra->inSpecialComment=false;
1040 yyextra->inRoseComment=false;
1041 BEGIN(Scan);
1042 }
1043<SComment>\n[ \t]*{CPPC}"/"[^\\@\/\n]/.*\n {
1045 yyextra->readLineCtx=YY_START;
1046 BEGIN(ReadLine);
1047 }
1048<SComment>^[ \t]*{CPPC}"!" | // just //!
1049<SComment>^[ \t]*{CPPC}"!<"/.*\n | // or //!< something
1050<SComment>^[ \t]*{CPPC}"!"[^<]/.*\n { // or //!something
1052 yyextra->readLineCtx=YY_START;
1053 BEGIN(ReadLine);
1054 }
1055<SComment>\n[ \t]*{CPPC}"!" |
1056<SComment>\n[ \t]*{CPPC}"!<"/.*\n |
1057<SComment>\n[ \t]*{CPPC}"!"[^<\n]/.*\n {
1059 yyextra->readLineCtx=YY_START;
1060 BEGIN(ReadLine);
1061 }
1062<SComment>^[ \t]*{CPPC}"##"/.*\n {
1063 if (!yyextra->inRoseComment)
1064 {
1065 REJECT;
1066 }
1067 else
1068 {
1070 yyextra->readLineCtx=YY_START;
1071 BEGIN(ReadLine);
1072 }
1073 }
1074<SComment>\n[ \t]*{CPPC}"##"/.*\n {
1075 if (!yyextra->inRoseComment)
1076 {
1077 REJECT;
1078 }
1079 else
1080 {
1082 yyextra->readLineCtx=YY_START;
1083 BEGIN(ReadLine);
1084 }
1085 }
1086<SComment>\n { /* end of special comment */
1089 yyextra->inSpecialComment=
FALSE;
1090 yyextra->inRoseComment=
FALSE;
1091 yyextra->insertCppCommentMarker=false;
1092 yyextra->readLineCtx = Scan;
1093
1094 BEGIN(Scan);
1095 }
1096<ReadLine>{CCS}"*" {
1098 }
1099<ReadLine>{CCE} {
1101 }
1102<ReadLine,CopyLine>"*" {
1104 }
1105<ReadLine,CopyLine>{RL} {
1107 }
1108<ReadLine,CopyLine>{RL}/{B}{CMD}"ilinebr"{B} {
1110 }
1111<ReadLine,CopyLine>{RLopt}/\n {
1113 yyextra->insertCppCommentMarker=false;
1114 BEGIN(yyextra->readLineCtx);
1115 }
1116<CComment,CNComment,ReadLine>"\<" { /* escaped html comment */
1118 }
1119<CComment,CNComment,ReadLine>[\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command
1121 }
1122
1123<CComment,ReadLine,IncludeFile>[\\@]("include"{OPTS}|"includedoc"{OPTS}*) {
1124 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1125 yyextra->includeCtx = YY_START;
1126 yyextra->firstIncludeLine = true;
1127 yyextra->insertCommentCol = yyextra->col;
1128 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1129 {
1130 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1131 }
1132
1133 BEGIN(IncludeDoc);
1134 }
1135<CComment,ReadLine,IncludeFile>[\\@]("snippet"{OPTS}|"snippetdoc"{OPTS}*) {
1136 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1137 yyextra->includeCtx = YY_START;
1138 yyextra->firstIncludeLine = true;
1139 yyextra->insertCommentCol = yyextra->col;
1140 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1141 {
1142 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1143 }
1144
1145 BEGIN(SnippetDoc);
1146 }
1147<IncludeDoc,SnippetDoc>{B}*
1148<IncludeDoc>{FILEMASK}|"\""[^\n\"]+"\"" {
1150 if (yytext[0]=='"')
1151 {
1152 fileName=fileName.
mid(1,fileName.
length()-2);
1153 }
1155 {
1156 BEGIN(IncludeFile);
1157 }
1158 else
1159 {
1160 BEGIN(yyextra->includeCtx);
1161 }
1162 }
1163<SnippetDoc>({FILEMASK}|"\""[^\n\"]+"\""){B}+ {
1164 yyextra->snippetFileName=yytext;
1165 yyextra->snippetFileName=yyextra->snippetFileName.stripWhiteSpace();
1166 if (yyextra->snippetFileName == "this") yyextra->snippetFileName=yyextra->fileName;
1167 yyextra->snippetName = "";
1168 BEGIN(SnippetDocTag);
1169 }
1170<SnippetDocTag>[^\\@\n]+ {
1171 yyextra->snippetName += yytext;
1172 }
1173<SnippetDocTag>{CMD} {
1174 yyextra->snippetName += yytext;
1175 }
1176<SnippetDocTag>(\n|{CMD}"ilinebr") {
1177 for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]);
1178 yyextra->snippetName = yyextra->snippetName.stripWhiteSpace();
1179 QCString blockId =
"["+yyextra->snippetName+
"]";
1181 {
1182 BEGIN(IncludeFile);
1183 }
1184 else
1185 {
1186 BEGIN(yyextra->includeCtx);
1187 }
1188 }
1189
1190<IncludeDoc,SnippetDoc>\n {
1193
1194
1195 BEGIN(yyextra->includeCtx);
1196 }
1197<IncludeDoc,SnippetDoc>. { // invalid character
1199 BEGIN(yyextra->includeCtx);
1200 }
1201<CComment,ReadLine,IncludeFile>[\\@]"cond"/[^a-z_A-Z0-9] { // conditional section
1202 yyextra->condCtx = YY_START;
1203 BEGIN(CondLine);
1204 }
1205<CComment,ReadLine,IncludeFile>[\\@]"endcond"/[^a-z_A-Z0-9] { // end of conditional section
1206 bool oldSkip=yyextra->skip;
1208 if (YY_START==CComment && oldSkip && !yyextra->skip)
1209 {
1210
1211 if (yyextra->lang!=SrcLangExt::Python &&
1212 yyextra->lang!=SrcLangExt::VHDL &&
1213 yyextra->lang!=SrcLangExt::Markdown &&
1214 yyextra->lang!=SrcLangExt::Fortran)
1215 {
1216 yyextra->outBuf+='/';
1217 yyextra->outBuf+='*';
1218 yyextra->col+=2;
1219 if (yyextra->specialComment)
1220 {
1221 yyextra->outBuf+='*';
1222 yyextra->col++;
1223 }
1224 }
1225 }
1226 }
1227<CondLine>[!()&| \ta-z_A-Z0-9.\-]+ {
1229 }
1230<CComment,ReadLine,IncludeFile>[\\@]"cond"{WSopt}/\n {
1231 yyextra->condCtx=YY_START;
1233 }
1234<CondLine>\n |
1235<CondLine>. { // forgot section id?
1238 }
1239<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>[\\@][a-z_A-Z][a-z_A-Z0-9-]* { // expand alias without arguments
1240 replaceAliases(yyscanner,yytext,YY_START==ReadLine && yyextra->readLineCtx==SComment);
1241 }
1242<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{B}?{CMD}"ilinebr"{B}[\\@]"ialias{" { // expand alias with arguments
1243 yyextra->lastBlockContext=YY_START;
1244 yyextra->blockCount=1;
1245 int extraSpace = (yytext[0]==' '? 1:0);
1246 yyextra->aliasString=yytext+9+extraSpace;
1247 yyextra->aliasCmd=yytext+9+extraSpace;
1248 yyextra->lastEscaped=0;
1249 BEGIN( ReadAliasArgs );
1250 }
1251<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>[\\@][a-z_A-Z][a-z_A-Z0-9-]*"{" { // expand alias with arguments
1252 yyextra->lastBlockContext=YY_START;
1253 yyextra->blockCount=1;
1254 yyextra->aliasString=yytext;
1255 yyextra->aliasCmd=yytext;
1256 yyextra->lastEscaped=0;
1257 BEGIN( ReadAliasArgs );
1258 }
1259<ReadAliasArgs>^[ \t]*"*" { // skip leading *
1260 }
1261<ReadAliasArgs>^[ \t]*{CPPC}[/!]/[^\n]* { // skip leading special comments (see bug 618079)
1262 }
1263<ReadAliasArgs>[^{}\n\\\*]+ {
1264 yyextra->aliasString+=yytext;
1265 yyextra->lastEscaped=
FALSE;
1266 }
1267<ReadAliasArgs>"\\" {
1268 if (yyextra->lastEscaped) yyextra->lastEscaped=
FALSE;
1269 else yyextra->lastEscaped=
TRUE;
1270 yyextra->aliasString+=yytext;
1271 }
1272<ReadAliasArgs>[\\@]("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}"|"f)") { /* end of verbatim block */
1273 yyextra->aliasString+=yytext;
1274 if (yyextra->inVerbatim && &yytext[1]==yyextra->blockName)
1275
1276
1277
1278
1279
1280
1281 {
1283 yyextra->inVerbatim=false;
1284 BEGIN(yyextra->lastCommentContext);
1285 }
1286 }
1287<ReadAliasArgs>\n {
1288 yyextra->aliasString+=yytext;
1289 yyextra->lastEscaped=
FALSE;
1290 if (yyextra->inVerbatim)
1291
1292 {
1294 BEGIN( yyextra->lastBlockContext );
1295 }
1296 }
1297<ReadAliasArgs>"{" {
1298 yyextra->aliasString+=yytext;
1299 if (!yyextra->lastEscaped) yyextra->blockCount++;
1300 yyextra->lastEscaped=
FALSE;
1301 }
1302<ReadAliasArgs>"}" {
1303 yyextra->aliasString+=yytext;
1304 if (!yyextra->lastEscaped) yyextra->blockCount--;
1305 if (yyextra->blockCount==0)
1306 {
1308 yyextra->lastBlockContext==ReadLine && yyextra->readLineCtx==SComment);
1309 BEGIN( yyextra->lastBlockContext );
1310 }
1311 yyextra->lastEscaped=
FALSE;
1312 }
1313<ReadAliasArgs>. {
1314 yyextra->aliasString+=yytext;
1315 yyextra->lastEscaped=
FALSE;
1316 }
1317<CopyLine>. {
1319 }
1320<CopyLine>\n {
1322 yyextra->insertCppCommentMarker=false;
1323 BEGIN(yyextra->readLineCtx);
1324 }
1325<ReadLine>``` {
1327 }
1328<ReadLine>`[^`]+` {
1330 }
1331<ReadLine>{CMD}{CMD} |
1332<ReadLine>. {
1334 }
1335<IncludeFile>. {
1337 }
1338<IncludeFile>\n {
1341 }
1342<*>. {
1344 }
1345<<EOF>> {
1346 if (YY_START == ReadAliasArgs)
1347 {
1348 warn(yyextra->fileName,yyextra->lineNr,
1349 "Reached end of file while still searching closing '}}' of an alias argument (probable start: '{}')",
1350 yyextra->aliasCmd);
1351 }
1352 if (yyextra->includeStack.empty())
1353 {
1354 yyextra->insertCppCommentMarker=false;
1356 }
1357 else
1358 {
1359 std::unique_ptr<commentcnv_FileState> &fs = yyextra->includeStack.back();
1360 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
1361 yy_switch_to_buffer(fs->bufState, yyscanner);
1362 yy_delete_buffer(oldBuf, yyscanner);
1363 BEGIN(fs->oldState);
1364 yyextra->fileName = fs->oldFileName;
1365 yyextra->lineNr = fs->oldLineNr;
1366 yyextra->inBuf = fs->oldFileBuf;
1367 yyextra->inBufPos = fs->oldFileBufPos;
1368 yyextra->includeCtx = fs->oldIncludeCtx;
1370 if (fs->oldRaiseLvl!=yyextra->raiseLevel)
1371 {
1372 lineStr+="\\iraise " + std::to_string(fs->oldRaiseLvl)+ " ";
1373 }
1374 if (fs->oldRaiseLbl!=yyextra->raiseLabel)
1375 {
1376 lineStr+="\\iprefix \"" + fs->oldRaiseLbl + "\" ";
1377 }
1378 lineStr+="\\ilinebr ";
1379 yyextra->raiseLevel = fs->oldRaiseLvl;
1380 yyextra->raiseLabel = fs->oldRaiseLbl;
1382 yyextra->includeStack.pop_back();
1383
1384
1385 }
1386 }
1387
1388<*>\n { fprintf(stderr,"Lex scanner %s (%s) default rule newline for state %s.\n", __FILE__, qPrint(yyextra->fileName),stateToString(YY_START));}
1389 */
1390%%