260 {NUMBER} {
261 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
263 }
264<Scan>{RAWBEGIN} {
265 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
267 BEGIN(RawString);
268 }
269<Scan>[^"'!\/\n\\#,\-=; \t@$]* { /* eat anything that is not " / , or \n */
271 }
272<Scan>[,= ;\t] { /* eat , so we have a nice separator in long initialization lines */
274 }
275<Scan>"'''"! |
276<Scan>"\"\"\""! { /* start of python long comment */
277 if (yyextra->lang!=SrcLangExt::Python)
278 {
279 REJECT;
280 }
281 else
282 {
283 yyextra->pythonDocString =
TRUE;
284 yyextra->pythonDocStringChar = yytext[0];
285 yyextra->nestingCount=1;
288 BEGIN(CComment);
289 yyextra->commentStack.push(yyextra->lineNr);
290 }
291 }
292<Scan>"'''" |
293<Scan>"\"\"\"" { /* start of python long comment */
294 if (yyextra->lang!=SrcLangExt::Python)
295 {
296 REJECT;
297 }
299 {
300 REJECT;
301 }
302 else
303 {
304 yyextra->pythonDocString =
TRUE;
305 yyextra->pythonDocStringChar = yytext[0];
306 yyextra->nestingCount=1;
309 BEGIN(CComment);
310 yyextra->commentStack.push(yyextra->lineNr);
311 }
312 }
313<Scan>{B}*![><!]/.*\n {
314 if (yyextra->lang!=SrcLangExt::Fortran)
315 {
316 REJECT;
317 }
318 else
319 {
320 yyextra->nestingCount=0;
322 yyextra->specialComment=true;
324 yyextra->blockHeadCol=yyextra->col-2;
325 BEGIN(CComment);
326 yyextra->commentStack.push(yyextra->lineNr);
327 }
328 }
329<Scan>[Cc\*][><!]/.*\n {
330 if (yyextra->lang!=SrcLangExt::Fortran)
331 {
332 REJECT;
333 }
334 else
335 {
336
337 if (yyextra->isFixedForm && (yyextra->col == 0))
338 {
339 yyextra->nestingCount=0;
341 yyextra->specialComment=true;
343 yyextra->blockHeadCol=yyextra->col-1;
344 BEGIN(CComment);
345 yyextra->commentStack.push(yyextra->lineNr);
346 }
347 else
348 {
349 REJECT;
350 }
351 }
352 }
353<Scan>!.*\n {
354 if (yyextra->lang!=SrcLangExt::Fortran)
355 {
356 REJECT;
357 }
358 else
359 {
361 }
362 }
363<Scan>[Cc\*].*\n {
364 if (yyextra->lang!=SrcLangExt::Fortran)
365 {
366 REJECT;
367 }
368 else
369 {
370 if (yyextra->col == 0)
371 {
373 }
374 else
375 {
376 REJECT;
377 }
378 }
379 }
380<Scan>[$]?"@\"" { /* start of an interpolated verbatim C# string */
381 if (yyextra->lang!=SrcLangExt::CSharp) REJECT
383 yyextra->stringContext = YY_START;
384 BEGIN(SkipVerbString);
385 }
386<Scan>"\"" { /* start of a string */
388 yyextra->stringContext = YY_START;
389 BEGIN(SkipString);
390 }
391<Scan>' {
393 yyextra->charContext = YY_START;
394 if (yyextra->lang!=SrcLangExt::VHDL)
395 {
396 BEGIN(SkipChar);
397 }
398 }
399<Scan>\n { /* new line */
401 }
402<Scan>{CPPC}[!/]/.*\n[ \t]*{CPPC}[!/][ \t]*{CMD}"}" { // see bug #8731, don't treat multiline C++ comment as detailed description
403
404 yyextra->inSpecialComment=true;
405 yyextra->blockHeadCol=yyextra->col+1;
406 yyextra->insertCppCommentMarker=true;
408 yyextra->readLineCtx=YY_START;
409 BEGIN(ReadLine);
410 }
411<Scan>{CPPC}"!"/.*\n[ \t]*{CPPC}[\/!][^\/] | /* start C++ style special comment block */
412<Scan>({CPPC}"/"[/]*)/[^/].*\n[ \t]*{CPPC}[\/!][^\/] { /* start C++ style special comment block */
413 if (yyextra->mlBrief)
414 {
415 REJECT;
416 }
417 else
418 {
419 int i=3;
420 if (yytext[2]=='/')
421 {
422 while (i<(int)yyleng && yytext[i]=='/') i++;
423 }
424 yyextra->blockHeadCol=yyextra->col+1;
425 if (yytext[2] == '!')
426 {
428 }
429 else
430 {
432 }
434 yyextra->inSpecialComment=
TRUE;
435
436 yyextra->readLineCtx=SComment;
437 BEGIN(ReadLine);
438 }
439 }
440<Scan>{CPPC}"##Documentation"{ANYopt}/\n { /* Start of Rational Rose ANSI C++ comment block */
441 if (yyextra->mlBrief) REJECT;
442 int i=17;
443 yyextra->blockHeadCol=yyextra->col+1;
446 yyextra->inRoseComment=
TRUE;
447 BEGIN(SComment);
448 }
449<Scan>{CPPC}[!\/]/.*\n[ \t]*{CPPC}[|\/][ \t]*{CMD}"}" { // next line contains an end marker, see bug 752712
450 yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!';
451 if (yyextra->inSpecialComment)
452 {
453 yyextra->blockHeadCol=yyextra->col+1;
454 }
456 yyextra->readLineCtx=YY_START;
457 BEGIN(ReadLine);
458 }
459<Scan>{CPPC}[!/]/.*\n { /* one line special C++ comment */
460 yyextra->inSpecialComment=true;
461 yyextra->blockHeadCol=yyextra->col+1;
462 yyextra->insertCppCommentMarker=true;
464 yyextra->readLineCtx=YY_START;
465 BEGIN(ReadLine);
466 }
467<Scan>{CPPC}/.*\n { /* one line normal C++ comment */
468 yyextra->inSpecialComment=false;
470 yyextra->readLineCtx=YY_START;
471 BEGIN(CopyLine);
472 }
473<Scan>{CCS}{CCE} { /* avoid matching next rule for empty C comment, see bug 711723 */
475 }
476<Scan>{CCS}[*!]? { /* start of a C comment */
477 if (yyextra->lang==SrcLangExt::Python)
478 {
479 REJECT;
480 }
481 yyextra->specialComment=(int)yyleng==3;
482 yyextra->nestingCount=1;
485 if (yyextra->specialComment)
486 {
487 yyextra->blockHeadCol=0;
488 BEGIN(CComment);
489 }
490 else
491 {
492 BEGIN(CNComment);
493 }
494 yyextra->commentStack.push(yyextra->lineNr);
495 }
496<Scan>"#"[^\n]*\n {
497 if (yyextra->lang!=SrcLangExt::PHP)
498 {
499 REJECT;
500 }
502 }
503<Scan>"#"("#")? {
504 if (yyextra->lang!=SrcLangExt::Python)
505 {
506 REJECT;
507 }
508 else
509 {
510 yyextra->nestingCount=0;
512 yyextra->specialComment=(int)yyleng==2;
513 if (yyextra->specialComment)
514 {
515 yyextra->blockHeadCol=yyextra->col;
516 }
517 yyextra->commentStack.push(yyextra->lineNr);
519 BEGIN(CComment);
520 }
521 }
522<Scan>"--"[^!][^\n]* {
523 if (yyextra->lang!=SrcLangExt::VHDL)
524 {
525 REJECT;
526 }
527 else
528 {
530 }
531 }
532<Scan>"--!" {
533 if (yyextra->lang!=SrcLangExt::VHDL)
534 {
535 REJECT;
536 }
537 else
538 {
539 yyextra->specialComment=true;
540 yyextra->blockHeadCol=yyextra->col;
541 yyextra->vhdl =
TRUE;
542 yyextra->nestingCount=0;
544 yyextra->commentStack.push(yyextra->lineNr);
546 BEGIN(CComment);
547 }
548 }
549<Scan>{B}*![><!] {
550 if (yyextra->lang!=SrcLangExt::Fortran)
551 {
552 REJECT;
553 }
554 else
555 {
556 yyextra->nestingCount=0;
558 yyextra->specialComment=true;
559 yyextra->blockHeadCol=yyextra->col;
560 yyextra->commentStack.push(yyextra->lineNr);
562 BEGIN(CComment);
563 }
564 }
565<RawString>{RAWEND} {
568 {
569 BEGIN(Scan);
570 }
571 }
QCString extractEndRawStringDelimiter(const char *rawEnd)
572<RawString>[^)\n]+ { copyToOutput(yyscanner,yytext,yyleng); }
573<RawString>\n { copyToOutput(yyscanner,yytext,yyleng); }
574<RawString>. { copyToOutput(yyscanner,yytext,yyleng); }
575
576<CComment,CNComment,ReadLine,IncludeFile>{MAILADDR} |
577<CComment,CNComment,ReadLine,IncludeFile>"<"{MAILADDR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block
579 }
580<CComment,IncludeFile>"{"[ \t]*"@code"/[ \t\n] {
582 yyextra->lastCommentContext = YY_START;
583 yyextra->javaBlock=1;
584 yyextra->blockName=
QCString(
"end")+&yytext[1];
585 yyextra->inVerbatim=true;
586 yyextra->verbatimLine=yyextra->lineNr;
587 BEGIN(VerbatimCode);
588 }
589<CComment,IncludeFile>"{"[ \t]*"@literal"/[ \t\n] {
591 yyextra->lastCommentContext = YY_START;
592 yyextra->javaBlock=1;
593 yyextra->blockName=
QCString(
"end")+&yytext[1];
594 yyextra->inVerbatim=true;
595 yyextra->verbatimLine=yyextra->lineNr;
596 BEGIN(VerbatimCode);
597 }
598<CComment,ReadLine,IncludeFile>{CMD}"ilinebr"[ \t]+("```"[`]*|"~~~"[~]*) { /* start of markdown code block */
600 {
601 REJECT;
602 }
604 yyextra->lastCommentContext = YY_START;
605 yyextra->javaBlock=0;
607 yyextra->inVerbatim=true;
608 yyextra->verbatimLine=yyextra->lineNr;
609 BEGIN(VerbatimCode);
610 }
QCString right(size_t len) const
611<CComment,ReadLine,IncludeFile>^[ \t]*("```"[`]*|"~~~"[~]*) { /* start of markdown code block */
613 {
614 REJECT;
615 }
617 yyextra->lastCommentContext = YY_START;
618 yyextra->javaBlock=0;
620 yyextra->inVerbatim=true;
621 yyextra->verbatimLine=yyextra->lineNr;
622 BEGIN(VerbatimCode);
623 }
QCString left(size_t len) const
624<CComment,ReadLine,IncludeFile>{CMD}("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */
626 yyextra->lastCommentContext = YY_START;
627 yyextra->javaBlock=0;
628 if (
qstrcmp(&yytext[1],
"startuml")==0)
629 {
630 yyextra->blockName="enduml";
631 }
632 else
633 {
634 yyextra->blockName=
QCString(
"end")+&yytext[1];
635 }
636 yyextra->inVerbatim=true;
637 yyextra->verbatimLine=yyextra->lineNr;
638 BEGIN(VerbatimCode);
639 }
int qstrcmp(const char *str1, const char *str2)
640<CComment,ReadLine,IncludeFile>"\\`" {
642 }
643<CComment,ReadLine,IncludeFile>"```" { // skip ``` if not at the start of the line
645 }
646<CComment,ReadLine,IncludeFile>"`"{1,2} {
648 {
649 REJECT;
650 }
652 yyextra->lastCommentContext = YY_START;
653 yyextra->javaBlock=0;
654 yyextra->blockName=yytext;
655 yyextra->inVerbatim=true;
656 yyextra->verbatimLine=yyextra->lineNr;
657 BEGIN(VerbatimCode);
658 }
659<CComment,ReadLine,IncludeFile>{CMD}("f$"|"f["|"f{"|"f(") {
661 yyextra->blockName=&yytext[1];
662 if (yyextra->blockName.at(1)=='[')
663 {
664 yyextra->blockName.at(1)=']';
665 }
666 else if (yyextra->blockName.at(1)=='{')
667 {
668 yyextra->blockName.at(1)='}';
669 }
670 else if (yyextra->blockName.at(1)=='(')
671 {
672 yyextra->blockName.at(1)=')';
673 }
674 yyextra->lastCommentContext = YY_START;
675 yyextra->inVerbatim=true;
676 yyextra->verbatimLine=yyextra->lineNr;
677 BEGIN(Verbatim);
678 }
679<CComment,ReadLine,IncludeFile>"<!--!" { /* HTML comment doxygen command*/
680 if (yyextra->inVerbatim) REJECT;
681
682 yyextra->inHtmlDoxygenCommand=true;
683 }
684<CComment,ReadLine,IncludeFile>"-->" { /* potential end HTML comment doxygen command*/
685 if (yyextra->inHtmlDoxygenCommand)
686 {
687 yyextra->inHtmlDoxygenCommand=false;
688 }
689 else
690 {
692 }
693 }
694<CComment,ReadLine,IncludeFile>"<!--" { /* HTML comment */
696 yyextra->blockName="-->";
697 yyextra->lastCommentContext = YY_START;
698 yyextra->inVerbatim=true;
699 yyextra->verbatimLine=yyextra->lineNr;
700 BEGIN(Verbatim);
701 }
702<CComment,ReadLine,IncludeFile>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly")/[^a-z_A-Z0-9] { /* start of a verbatim block */
704 yyextra->blockName=
QCString(
"end")+&yytext[1];
705 yyextra->lastCommentContext = YY_START;
706 yyextra->inVerbatim=true;
707 yyextra->verbatimLine=yyextra->lineNr;
708 BEGIN(Verbatim);
709 }
710<Scan>"\\\"" { /* escaped double quote */
712 }
713<Scan>"\\\\" { /* escaped backslash */
715 }
716<Scan>. { /* any other character */
718 }
719<Verbatim>{CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}"|"f)") { /* end of verbatim block */
721 if (&yytext[1]==yyextra->blockName)
722 {
723 yyextra->inVerbatim=false;
724 BEGIN(yyextra->lastCommentContext);
725 }
726 }
727<Verbatim>"-->" {
729 if (yytext==yyextra->blockName)
730 {
731 yyextra->inVerbatim=false;
732 BEGIN(yyextra->lastCommentContext);
733 }
734 }
735<VerbatimCode>"{" {
736 if (yyextra->javaBlock==0)
737 {
738 REJECT;
739 }
740 else
741 {
742 yyextra->javaBlock++;
744 }
745 }
746<VerbatimCode>"}" {
747 if (yyextra->javaBlock==0)
748 {
749 REJECT;
750 }
751 else
752 {
753 yyextra->javaBlock--;
754 if (yyextra->javaBlock==0)
755 {
757 yyextra->inVerbatim=false;
758 BEGIN(yyextra->lastCommentContext);
759 }
760 else
761 {
763 }
764 }
765 }
766<VerbatimCode>("```"[`]*|"~~~"[~]*) { /* end of markdown code block */
767 if (yytext[0]=='`' && (yyextra->blockName=="`" || yyextra->blockName=="``"))
768 {
769
771 }
772 else
773 {
775 if (yytext[0]==yyextra->blockName[0])
776 {
777 yyextra->inVerbatim=false;
778 BEGIN(yyextra->lastCommentContext);
779 }
780 }
781 }
782<VerbatimCode>"''" {
785 {
786 yyextra->inVerbatim=false;
787 BEGIN(yyextra->lastCommentContext);
788 }
789 }
790<VerbatimCode>"'" {
793 {
794 yyextra->inVerbatim=false;
795 BEGIN(yyextra->lastCommentContext);
796 }
797 }
798<VerbatimCode>"`"{1,2} {
800 if (yytext==yyextra->blockName)
801 {
802 yyextra->inVerbatim=false;
803 BEGIN(yyextra->lastCommentContext);
804 }
805 }
806<VerbatimCode>{CMD}("enddot"|"endcode"|"endmsc"|"enduml")/("{")? { // end of verbatim block
808 if (&yytext[1]==yyextra->blockName)
809 {
810 yyextra->inVerbatim=false;
811 BEGIN(yyextra->lastCommentContext);
812 }
813 }
814<VerbatimCode>^[ \t]*{CPPC}[\!\/]? { /* skip leading comments */
815 if (!yyextra->inSpecialComment || yyextra->mlBrief)
816 {
818 }
819 else
820 {
821 int l=0;
822 while (yytext[l]==' ' || yytext[l]=='\t')
823 {
824 l++;
825 }
827 if (yyleng-l==3)
828 {
830 }
831 else
832 {
834 }
835 }
836 }
837<Verbatim,VerbatimCode>[^`'~@\/\-\\\n{}]* { /* any character not a backslash or new line or } */
839 }
840<Verbatim,VerbatimCode>[^`'~@\/\-\\\n{}]+/\n{B}*"//" {
841 if (yyextra->lastCommentContext!=ReadLine)
842 {
843 REJECT;
844 }
845 else
846 {
848 }
849 }
850<Verbatim,VerbatimCode>[^`'~@\/\-\\\n{}]+/\n { /* premature end of comment block */
851 if (yyextra->lastCommentContext==ReadLine)
852 {
853 yyextra->inVerbatim=false;
854 BEGIN(yyextra->lastCommentContext);
855 }
857 }
858<Verbatim,VerbatimCode>\n { /* new line in verbatim block */
860 if (yyextra->lastCommentContext == IncludeFile)
861 {
863 }
864 }
865<Verbatim>^[ \t]*{CPPC}[/!] {
866 if (yyextra->blockName=="enddot" || yyextra->blockName=="endmsc" || yyextra->blockName=="enduml" || yyextra->blockName.at(0)=='f')
867 {
868
869 int l=0;
870 while (yytext[l]==' ' || yytext[l]=='\t')
871 {
872 l++;
873 }
876 }
877 else
878 {
879 REJECT;
880 }
881 }
882<Verbatim,VerbatimCode>. { /* any other character */
884 }
885<SkipString>\\. { /* escaped character in string */
886 if (yyextra->lang==SrcLangExt::Fortran || yyextra->lang==SrcLangExt::VHDL)
887 {
888 unput(yytext[1]);
890 }
891 else
892 {
894 }
895 }
896<SkipString>"\"" { /* end of string */
898 BEGIN(yyextra->stringContext);
899 }
900<SkipString>. { /* any other string character */
902 }
903<SkipString>\n { /* new line inside string (illegal for some compilers) */
905 }
906<SkipVerbString>[^"\n]+ {
908 }
909<SkipVerbString>\"\" { // escaped quote
911 }
912<SkipVerbString>"\"" { /* end of string */
914 BEGIN(yyextra->stringContext);
915 }
916<SkipVerbString>. {
918 }
919<SkipVerbString>\n {
921 }
922<SkipChar>\\. { /* escaped character */
923 if (yyextra->lang==SrcLangExt::Fortran || yyextra->lang==SrcLangExt::VHDL)
924 {
925 unput(yytext[1]);
927 }
928 else
929 {
931 }
932 }
933<SkipChar>' { /* end of character literal */
935 BEGIN(yyextra->charContext);
936 }
937<SkipChar>. { /* any other string character */
939 }
940<SkipChar>\n { /* new line character */
942 }
943
944<CComment,CNComment>[^ `~<\\!@*\n{\"'\/-`]* { /* anything that is not a '*' or command */
946 }
947<CComment,CNComment>^{B}*"*"+[^*\/<\\@\n{\"`]* { /* stars without slashes */
948 if (yyextra->lang==SrcLangExt::Markdown) REJECT;
950 if (yyextra->col>yyextra->blockHeadCol)
951 {
952
953 yyextra->blockHeadCol=yyextra->col;
954 }
956 }
957<CComment>"'''" |
958<CComment>"\"\"\"" { /* end of Python docstring */
959 if (yyextra->lang!=SrcLangExt::Python)
960 {
961 REJECT;
962 }
963 else if (yyextra->pythonDocStringChar != yytext[0])
964 {
966 }
967 else
968 {
969 yyextra->nestingCount--;
970 yyextra->pythonDocString =
FALSE;
971 yyextra->pythonDocStringChar = '\0';
973 BEGIN(Scan);
974 }
975 }
976<CComment,CNComment>\n { /* new line in comment */
978
979 if (yyextra->lang==SrcLangExt::Fortran)
980 {
981 BEGIN(Scan);
982 }
983 }
984<CComment,CNComment>"/""/"+/"*/" { /* we are already in C-comment so not a start of a nested comment but
985 * just the
end of the
comment (the
end part is handled later). */
987 }
DirIterator end(const DirIterator &) noexcept
988<CComment,CNComment>"/"+"*" { /* nested C comment */
989 if (yyextra->lang==SrcLangExt::Python ||
990 yyextra->lang==SrcLangExt::Markdown)
991 {
992 REJECT;
993 }
994 yyextra->nestingCount++;
995 yyextra->commentStack.push(yyextra->lineNr);
997 }
998<CComment,CNComment>^{B}*"*"+"/" |
999<CComment,CNComment>"*"+"/" { /* end of C comment */
1000 if (yyextra->lang==SrcLangExt::Python ||
1001 yyextra->lang==SrcLangExt::Markdown)
1002 {
1003 REJECT;
1004 }
1005 else
1006 {
1008 yyextra->nestingCount--;
1009 if (yyextra->nestingCount<=0)
1010 {
1011 BEGIN(Scan);
1012 }
1013 else
1014 {
1015
1016 yyextra->commentStack.pop();
1017 }
1018 }
1019 }
1020
1021<CComment,CNComment>"\n"/[ \t]*"#" {
1022 if (yyextra->lang!=SrcLangExt::VHDL)
1023 {
1024 REJECT;
1025 }
1026 else
1027 {
1028 if (yyextra->vhdl)
1029 {
1030 yyextra->vhdl =
FALSE;
1032 BEGIN(Scan);
1033 }
1034 else
1035 {
1036 REJECT;
1037 }
1038 }
1039 }
1040<CComment,CNComment>"\n"/[ \t]*"-" {
1041 if (yyextra->lang!=SrcLangExt::Python || yyextra->pythonDocString)
1042 {
1043 REJECT;
1044 }
1045 else
1046 {
1048 BEGIN(Scan);
1049 }
1050 }
1051<CComment,CNComment>"\n"/[ \t]*[^ \t#\-] {
1052 if (yyextra->lang==SrcLangExt::Python)
1053 {
1054 if (yyextra->pythonDocString)
1055 {
1056 REJECT;
1057 }
1058 else
1059 {
1061 BEGIN(Scan);
1062 }
1063 }
1064 else if (yyextra->lang==SrcLangExt::VHDL)
1065 {
1066 if (yyextra->vhdl)
1067 {
1068 yyextra->vhdl =
FALSE;
1070 BEGIN(Scan);
1071 }
1072 else
1073 {
1074 REJECT;
1075 }
1076 }
1077 else
1078 {
1079 REJECT;
1080 }
1081 }
1082
1083<CComment,CNComment>"'" {
1084 yyextra->charContext = YY_START;
1086 BEGIN(SkipChar);
1087 }
1088<CComment,CNComment>"\"" {
1089 yyextra->stringContext = YY_START;
1091 BEGIN(SkipString);
1092 }
1093 */
1094<CComment,CNComment>{CMD}"~"[a-z_A-Z-]* { // language switch command
1095 if (yyextra->lang!=SrcLangExt::Markdown) REJECT;
1099 {
1101 {
1102 warn(yyextra->fileName,yyextra->lineNr,
1104 }
1105 BEGIN(SkipLang);
1106 }
1107 }
#define Config_getEnumAsString(name)
#define Config_isAvailableEnum(name, value)
int qstricmp(const char *s1, const char *s2)
1108<CComment,CNComment>{CMD}{CMD} |
1109<CComment,CNComment>. {
1111 }
1112<SkipLang>{CMD}"~"[a-zA-Z-]* { /* language switch */
1115 {
1116 warn(yyextra->fileName,yyextra->lineNr,
1118 }
1121 {
1122 BEGIN(CComment);
1123 }
1124 }
1125<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
1126 }
1127<SkipLang>\n { /* new line in language block, needed for keeping track of line numbers */
1129 }
1130<SkipLang>. { /* any other character */
1131 }
1132<SComment>^[ \t]*{CPPC}"/"{SLASHopt}/\n {
1134 }
1135<SComment>\n[ \t]*{CPPC}"/"{SLASHopt}/\n {
1137 }
1138<SComment>^[ \t]*{CPPC}"/"[^\/\n]/.*\n {
1140 yyextra->readLineCtx=YY_START;
1141 YY_CURRENT_BUFFER->yy_at_bol=1;
1142 BEGIN(ReadLine);
1143 }
1144<SComment>\n[ \t]*{CPPC}[\/!]("<")?[ \t]*{CMD}"}".*\n {
1145
1148 yyextra->inSpecialComment=false;
1149 yyextra->inRoseComment=false;
1150 BEGIN(Scan);
1151 }
1152<SComment>\n[ \t]*{CPPC}"/"[^\\@\/\n]/.*\n {
1154 yyextra->readLineCtx=YY_START;
1155 YY_CURRENT_BUFFER->yy_at_bol=1;
1156 BEGIN(ReadLine);
1157 }
1158<SComment>^[ \t]*{CPPC}"!" | // just //!
1159<SComment>^[ \t]*{CPPC}"!<"/.*\n | // or //!< something
1160<SComment>^[ \t]*{CPPC}"!"[^<]/.*\n { // or //!something
1162 yyextra->readLineCtx=YY_START;
1163 YY_CURRENT_BUFFER->yy_at_bol=1;
1164 BEGIN(ReadLine);
1165 }
1166<SComment>\n[ \t]*{CPPC}"!" |
1167<SComment>\n[ \t]*{CPPC}"!<"/.*\n |
1168<SComment>\n[ \t]*{CPPC}"!"[^<\n]/.*\n {
1170 yyextra->readLineCtx=YY_START;
1171 YY_CURRENT_BUFFER->yy_at_bol=1;
1172 BEGIN(ReadLine);
1173 }
1174<SComment>^[ \t]*{CPPC}"##"/.*\n {
1175 if (!yyextra->inRoseComment)
1176 {
1177 REJECT;
1178 }
1179 else
1180 {
1182 yyextra->readLineCtx=YY_START;
1183 YY_CURRENT_BUFFER->yy_at_bol=1;
1184 BEGIN(ReadLine);
1185 }
1186 }
1187<SComment>\n[ \t]*{CPPC}"##"/.*\n {
1188 if (!yyextra->inRoseComment)
1189 {
1190 REJECT;
1191 }
1192 else
1193 {
1195 yyextra->readLineCtx=YY_START;
1196 YY_CURRENT_BUFFER->yy_at_bol=1;
1197 BEGIN(ReadLine);
1198 }
1199 }
1200<SComment>\n { /* end of special comment */
1203 yyextra->inSpecialComment=
FALSE;
1204 yyextra->inRoseComment=
FALSE;
1205 yyextra->insertCppCommentMarker=false;
1206 yyextra->readLineCtx = Scan;
1207
1208 BEGIN(Scan);
1209 }
1210<ReadLine>{CCS}"*" {
1212 }
1213<ReadLine>{CCE} {
1215 }
1216<ReadLine,CopyLine>"*" {
1218 }
1219<ReadLine,CopyLine>{RL} {
1221 }
1222<ReadLine,CopyLine>{RL}/{B}{CMD}"ilinebr"{B} {
1224 }
1225<ReadLine,CopyLine>{RLopt}/\n {
1227 yyextra->insertCppCommentMarker=false;
1228 BEGIN(yyextra->readLineCtx);
1229 }
1230<CComment,CNComment,ReadLine>"\<" { /* escaped html comment */
1232 }
1233<CComment,CNComment,ReadLine>{CMD}{CMD}[~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command
1235 }
1236
1237<CComment,ReadLine,IncludeFile>{CMD}("include"{OPTS}|"includedoc"{OPTS}*) {
1238 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1239 yyextra->includeCtx = YY_START;
1240 yyextra->firstIncludeLine = true;
1241 yyextra->insertCommentCol = yyextra->col;
1242 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1243 {
1244 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1245 }
1246
1247 BEGIN(IncludeDoc);
1248 }
1249<CComment,ReadLine,IncludeFile>{CMD}("snippet"{OPTS}|"snippetdoc"{OPTS}*) {
1250 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1251 yyextra->includeCtx = YY_START;
1252 yyextra->firstIncludeLine = true;
1253 yyextra->insertCommentCol = yyextra->col;
1254 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1255 {
1256 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1257 }
1258
1259 BEGIN(SnippetDoc);
1260 }
1261<IncludeDoc,SnippetDoc>{B}*
1262<IncludeDoc>{FILEMASK}|"\""[^\n\"]+"\"" {
1264 if (yytext[0]=='"')
1265 {
1266 fileName=fileName.
mid(1,fileName.
length()-2);
1267 }
1269 {
1270 BEGIN(IncludeFile);
1271 }
1272 else
1273 {
1274 BEGIN(yyextra->includeCtx);
1275 }
1276 }
1277<SnippetDoc>({FILEMASK}|"\""[^\n\"]+"\""){B}+ {
1278 yyextra->snippetFileName=yytext;
1279 yyextra->snippetFileName=yyextra->snippetFileName.stripWhiteSpace();
1280 if (yyextra->snippetFileName == "this") yyextra->snippetFileName=yyextra->fileName;
1281 yyextra->snippetName = "";
1282 BEGIN(SnippetDocTag);
1283 }
1284<SnippetDocTag>[^\\@\n]+ {
1285 yyextra->snippetName += yytext;
1286 }
1287<SnippetDocTag>{CMD} {
1288 yyextra->snippetName += yytext;
1289 }
1290<SnippetDocTag>(\n|{CMD}"ilinebr") {
1291 for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]);
1292 yyextra->snippetName = yyextra->snippetName.stripWhiteSpace();
1293 QCString blockId =
"["+yyextra->snippetName+
"]";
1295 {
1296 BEGIN(IncludeFile);
1297 }
1298 else
1299 {
1300 BEGIN(yyextra->includeCtx);
1301 }
1302 }
1303
1304<IncludeDoc,SnippetDoc>\n {
1307
1308
1309 BEGIN(yyextra->includeCtx);
1310 }
1311<IncludeDoc,SnippetDoc>. { // invalid character
1313 BEGIN(yyextra->includeCtx);
1314 }
1315<CComment,ReadLine,IncludeFile>{CMD}"cond"/[^a-z_A-Z0-9] { // conditional section
1316 yyextra->condCtx = YY_START;
1317 BEGIN(CondLine);
1318 }
1319<CComment,ReadLine,IncludeFile>{CMD}"endcond"/[^a-z_A-Z0-9] { // end of conditional section
1320 bool oldSkip=yyextra->skip;
1322 if (YY_START==CComment && oldSkip && !yyextra->skip)
1323 {
1324
1325 if (yyextra->lang!=SrcLangExt::Python &&
1326 yyextra->lang!=SrcLangExt::VHDL &&
1327 yyextra->lang!=SrcLangExt::Markdown &&
1328 yyextra->lang!=SrcLangExt::Fortran)
1329 {
1330 yyextra->outBuf+='/';
1331 yyextra->outBuf+='*';
1332 yyextra->col+=2;
1333 if (yyextra->specialComment)
1334 {
1335 yyextra->outBuf+='*';
1336 yyextra->col++;
1337 }
1338 }
1339 }
1340 }
1341<CondLine>[!()&| \ta-z_A-Z0-9.\-]+ {
1343 }
1344<CComment,ReadLine,IncludeFile>{CMD}"cond"{WSopt}/\n {
1345 yyextra->condCtx=YY_START;
1347 }
1348<CondLine>\n |
1349<CondLine>. { // forgot section id?
1352 }
1353<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{CMD}[a-z_A-Z][a-z_A-Z0-9-]* { // expand alias without arguments
1354 bool inCppComment = YY_START==ReadLine && yyextra->readLineCtx==SComment;
1355 bool inCComment = YY_START==CComment && yyextra->blockHeadCol>0;
1357 }
1358<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{B}?{CMD}"ilinebr"{B}{CMD}"ialias{" { // expand alias with arguments
1359 yyextra->lastBlockContext=YY_START;
1360 yyextra->blockCount=1;
1361 int extraSpace = (yytext[0]==' '? 1:0);
1362 yyextra->aliasString=yytext+9+extraSpace;
1363 yyextra->aliasCmd=yytext+9+extraSpace;
1364 yyextra->lastEscaped=0;
1365 BEGIN( ReadAliasArgs );
1366 }
1367<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{CMD}[a-z_A-Z][a-z_A-Z0-9-]*"{" { // expand alias with arguments
1368 yyextra->lastBlockContext=YY_START;
1369 yyextra->blockCount=1;
1370 yyextra->aliasString=yytext;
1371 yyextra->aliasCmd=yytext;
1372 yyextra->lastEscaped=0;
1373 BEGIN( ReadAliasArgs );
1374 }
1375<ReadAliasArgs>^[ \t]*"*" {
1377 if (indent>yyextra->blockHeadCol)
1378 {
1379 yyextra->aliasString+=yytext;
1380 }
1381 else
1382 {
1383
1384 }
1385 }
1386<ReadAliasArgs>^[ \t]*{CPPC}[/!]/[^\n]* { // skip leading special comments (see bug 618079)
1387 }
1388<ReadAliasArgs>[^{}\n\\\*]+ {
1389 yyextra->aliasString+=yytext;
1390 yyextra->lastEscaped=
FALSE;
1391 }
1392<ReadAliasArgs>"\\" {
1393 if (yyextra->lastEscaped) yyextra->lastEscaped=
FALSE;
1394 else yyextra->lastEscaped=
TRUE;
1395 yyextra->aliasString+=yytext;
1396 }
1397<ReadAliasArgs>{CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}"|"f)") { /* end of verbatim block */
1398 yyextra->aliasString+=yytext;
1399 if (yyextra->inVerbatim && &yytext[1]==yyextra->blockName)
1400
1401
1402
1403
1404
1405
1406 {
1408 yyextra->inVerbatim=false;
1409 BEGIN(yyextra->lastCommentContext);
1410 }
1411 }
1412<ReadAliasArgs>\n {
1413 yyextra->aliasString+=yytext;
1414 yyextra->lastEscaped=
FALSE;
1415 if (yyextra->inVerbatim)
1416
1417 {
1419 BEGIN( yyextra->lastBlockContext );
1420 }
1421 }
1422<ReadAliasArgs>"{" {
1423 yyextra->aliasString+=yytext;
1424 if (!yyextra->lastEscaped) yyextra->blockCount++;
1425 yyextra->lastEscaped=
FALSE;
1426 }
1427<ReadAliasArgs>"}" {
1428 yyextra->aliasString+=yytext;
1429 if (!yyextra->lastEscaped) yyextra->blockCount--;
1430 if (yyextra->blockCount==0)
1431 {
1432 bool inCppComment = yyextra->lastBlockContext==ReadLine && yyextra->readLineCtx==SComment;
1433 bool inCComment = yyextra->lastBlockContext==CComment && yyextra->blockHeadCol>0;
1434 replaceAliases(yyscanner,yyextra->aliasString.view(),inCppComment,inCComment);
1435 BEGIN( yyextra->lastBlockContext );
1436 }
1437 yyextra->lastEscaped=
FALSE;
1438 }
1439<ReadAliasArgs>. {
1440 yyextra->aliasString+=yytext;
1441 yyextra->lastEscaped=
FALSE;
1442 }
1443<CopyLine>. {
1445 }
1446<CopyLine>\n {
1448 yyextra->insertCppCommentMarker=false;
1449 BEGIN(yyextra->readLineCtx);
1450 }
1451<ReadLine>{CMD}{CMD} |
1452<ReadLine>. {
1454 }
1455<IncludeFile>. {
1457 }
1458<IncludeFile>\n {
1461 }
1462<*>. {
1464 }
1465<<EOF>> {
1466 if (YY_START == ReadAliasArgs)
1467 {
1468 warn(yyextra->fileName,yyextra->lineNr,
1469 "Reached end of file while still searching closing '}}' of an alias argument (probable start: '{}')",
1470 yyextra->aliasCmd);
1471 }
1472 else if (YY_START==Verbatim || YY_START==VerbatimCode)
1473 {
1474 warn(yyextra->fileName,yyextra->lineNr,
1475 "Reached end of file while still searching closing '{}' of a verbatim block starting at line {}",
1476 yyextra->blockName,yyextra->verbatimLine);
1477 }
1478 if (yyextra->includeStack.empty())
1479 {
1480 yyextra->insertCppCommentMarker=false;
1482 }
1483 else
1484 {
1485 std::unique_ptr<commentcnv_FileState> &fs = yyextra->includeStack.back();
1486 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
1487 yy_switch_to_buffer(fs->bufState, yyscanner);
1488 yy_delete_buffer(oldBuf, yyscanner);
1489 BEGIN(fs->oldState);
1490 yyextra->fileName = fs->oldFileName;
1491 yyextra->lineNr = fs->oldLineNr;
1492 yyextra->inBuf = fs->oldFileBuf;
1493 yyextra->inBufPos = fs->oldFileBufPos;
1494 yyextra->includeCtx = fs->oldIncludeCtx;
1496 if (fs->oldRaiseLvl!=yyextra->raiseLevel)
1497 {
1498 lineStr+="\\iraise " + std::to_string(fs->oldRaiseLvl)+ " ";
1499 }
1500 if (fs->oldRaiseLbl!=yyextra->raiseLabel)
1501 {
1502 lineStr+="\\iprefix \"" + fs->oldRaiseLbl + "\" ";
1503 }
1504 lineStr+="\\ilinebr ";
1505 yyextra->raiseLevel = fs->oldRaiseLvl;
1506 yyextra->raiseLabel = fs->oldRaiseLbl;
1508 yyextra->includeStack.pop_back();
1509
1510
1511 }
1512 }
1513
1514<*>\n { fprintf(stderr,"Lex scanner %s (%s) default rule newline for state %s.\n", __FILE__, qPrint(yyextra->fileName),stateToString(YY_START));}
1515 */
1516%%