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 yyextra->inVerbatim=false;
772 BEGIN(yyextra->lastCommentContext);
773 }
774 else
775 {
777 if (yytext[0]==yyextra->blockName[0])
778 {
779 yyextra->inVerbatim=false;
780 BEGIN(yyextra->lastCommentContext);
781 }
782 }
783 }
784<VerbatimCode>"''" {
786 if (yyextra->blockName=="``")
787 {
788 yyextra->inVerbatim=false;
789 BEGIN(yyextra->lastCommentContext);
790 }
791 }
792<VerbatimCode>"'" {
794 if (yyextra->blockName=="`")
795 {
796 yyextra->inVerbatim=false;
797 BEGIN(yyextra->lastCommentContext);
798 }
799 }
800<VerbatimCode>"`"{1,2} {
802 if (yytext==yyextra->blockName)
803 {
804 yyextra->inVerbatim=false;
805 BEGIN(yyextra->lastCommentContext);
806 }
807 }
808<VerbatimCode>{CMD}("enddot"|"endcode"|"endmsc"|"enduml")/("{")? { // end of verbatim block
810 if (&yytext[1]==yyextra->blockName)
811 {
812 yyextra->inVerbatim=false;
813 BEGIN(yyextra->lastCommentContext);
814 }
815 }
816<VerbatimCode>^[ \t]*{CPPC}[\!\/]? { /* skip leading comments */
817 if (!yyextra->inSpecialComment || yyextra->mlBrief)
818 {
820 }
821 else
822 {
823 int l=0;
824 while (yytext[l]==' ' || yytext[l]=='\t')
825 {
826 l++;
827 }
829 if (yyleng-l==3)
830 {
832 }
833 else
834 {
836 }
837 }
838 }
839<Verbatim,VerbatimCode>[^`'~@\/\-\\\n{}]* { /* any character not a backslash or new line or } */
841 }
842<Verbatim,VerbatimCode>[^`'~@\/\-\\\n{}]+/\n{B}*"//" {
843 if (yyextra->lastCommentContext!=ReadLine)
844 {
845 REJECT;
846 }
847 else
848 {
850 }
851 }
852<Verbatim,VerbatimCode>[^`'~@\/\-\\\n{}]+/\n { /* premature end of comment block */
853 if (yyextra->lastCommentContext==ReadLine)
854 {
855 yyextra->inVerbatim=false;
856 BEGIN(yyextra->lastCommentContext);
857 }
859 }
860<Verbatim,VerbatimCode>\n { /* new line in verbatim block */
862 if (yyextra->lastCommentContext == IncludeFile)
863 {
865 }
866 }
867<Verbatim>^[ \t]*{CPPC}[/!] {
868 if (yyextra->blockName=="enddot" || yyextra->blockName=="endmsc" || yyextra->blockName=="enduml" || yyextra->blockName.at(0)=='f')
869 {
870
871 int l=0;
872 while (yytext[l]==' ' || yytext[l]=='\t')
873 {
874 l++;
875 }
878 }
879 else
880 {
881 REJECT;
882 }
883 }
884<Verbatim,VerbatimCode>. { /* any other character */
886 }
887<SkipString>\\. { /* escaped character in string */
888 if (yyextra->lang==SrcLangExt::Fortran || yyextra->lang==SrcLangExt::VHDL)
889 {
890 unput(yytext[1]);
892 }
893 else
894 {
896 }
897 }
898<SkipString>"\"" { /* end of string */
900 BEGIN(yyextra->stringContext);
901 }
902<SkipString>. { /* any other string character */
904 }
905<SkipString>\n { /* new line inside string (illegal for some compilers) */
907 }
908<SkipVerbString>[^"\n]+ {
910 }
911<SkipVerbString>\"\" { // escaped quote
913 }
914<SkipVerbString>"\"" { /* end of string */
916 BEGIN(yyextra->stringContext);
917 }
918<SkipVerbString>. {
920 }
921<SkipVerbString>\n {
923 }
924<SkipChar>\\. { /* escaped character */
925 if (yyextra->lang==SrcLangExt::Fortran || yyextra->lang==SrcLangExt::VHDL)
926 {
927 unput(yytext[1]);
929 }
930 else
931 {
933 }
934 }
935<SkipChar>' { /* end of character literal */
937 BEGIN(yyextra->charContext);
938 }
939<SkipChar>. { /* any other string character */
941 }
942<SkipChar>\n { /* new line character */
944 }
945
946<CComment,CNComment>[^ `~<\\!@*\n{\"'\/-`]* { /* anything that is not a '*' or command */
948 }
949<CComment,CNComment>^{B}*"*"+[^*\/<\\@\n{\"`]* { /* stars without slashes */
950 if (yyextra->lang==SrcLangExt::Markdown) REJECT;
952 if (yyextra->col>yyextra->blockHeadCol)
953 {
954
955 yyextra->blockHeadCol=yyextra->col;
956 }
958 }
959<CComment>"'''" |
960<CComment>"\"\"\"" { /* end of Python docstring */
961 if (yyextra->lang!=SrcLangExt::Python)
962 {
963 REJECT;
964 }
965 else if (yyextra->pythonDocStringChar != yytext[0])
966 {
968 }
969 else
970 {
971 yyextra->nestingCount--;
972 yyextra->pythonDocString =
FALSE;
973 yyextra->pythonDocStringChar = '\0';
975 BEGIN(Scan);
976 }
977 }
978<CComment,CNComment>\n { /* new line in comment */
980
981 if (yyextra->lang==SrcLangExt::Fortran)
982 {
983 BEGIN(Scan);
984 }
985 }
986<CComment,CNComment>"/""/"+/"*/" { /* we are already in C-comment so not a start of a nested comment but
987 * just the
end of the
comment (the
end part is handled later). */
989 }
DirIterator end(const DirIterator &) noexcept
990<CComment,CNComment>"/"+"*" { /* nested C comment */
991 if (yyextra->lang==SrcLangExt::Python ||
992 yyextra->lang==SrcLangExt::Markdown)
993 {
994 REJECT;
995 }
996 yyextra->nestingCount++;
997 yyextra->commentStack.push(yyextra->lineNr);
999 }
1000<CComment,CNComment>^{B}*"*"+"/" |
1001<CComment,CNComment>"*"+"/" { /* end of C comment */
1002 if (yyextra->lang==SrcLangExt::Python ||
1003 yyextra->lang==SrcLangExt::Markdown)
1004 {
1005 REJECT;
1006 }
1007 else
1008 {
1010 yyextra->nestingCount--;
1011 if (yyextra->nestingCount<=0)
1012 {
1013 BEGIN(Scan);
1014 }
1015 else
1016 {
1017
1018 yyextra->commentStack.pop();
1019 }
1020 }
1021 }
1022
1023<CComment,CNComment>"\n"/[ \t]*"#" {
1024 if (yyextra->lang!=SrcLangExt::VHDL)
1025 {
1026 REJECT;
1027 }
1028 else
1029 {
1030 if (yyextra->vhdl)
1031 {
1032 yyextra->vhdl =
FALSE;
1034 BEGIN(Scan);
1035 }
1036 else
1037 {
1038 REJECT;
1039 }
1040 }
1041 }
1042<CComment,CNComment>"\n"/[ \t]*"-" {
1043 if (yyextra->lang!=SrcLangExt::Python || yyextra->pythonDocString)
1044 {
1045 REJECT;
1046 }
1047 else
1048 {
1050 BEGIN(Scan);
1051 }
1052 }
1053<CComment,CNComment>"\n"/[ \t]*[^ \t#\-] {
1054 if (yyextra->lang==SrcLangExt::Python)
1055 {
1056 if (yyextra->pythonDocString)
1057 {
1058 REJECT;
1059 }
1060 else
1061 {
1063 BEGIN(Scan);
1064 }
1065 }
1066 else if (yyextra->lang==SrcLangExt::VHDL)
1067 {
1068 if (yyextra->vhdl)
1069 {
1070 yyextra->vhdl =
FALSE;
1072 BEGIN(Scan);
1073 }
1074 else
1075 {
1076 REJECT;
1077 }
1078 }
1079 else
1080 {
1081 REJECT;
1082 }
1083 }
1084
1085<CComment,CNComment>"'" {
1086 yyextra->charContext = YY_START;
1088 BEGIN(SkipChar);
1089 }
1090<CComment,CNComment>"\"" {
1091 yyextra->stringContext = YY_START;
1093 BEGIN(SkipString);
1094 }
1095 */
1096<CComment,CNComment>{CMD}"~"[a-z_A-Z-]* { // language switch command
1097 if (yyextra->lang!=SrcLangExt::Markdown) REJECT;
1101 {
1103 {
1104 warn(yyextra->fileName,yyextra->lineNr,
1106 }
1107 BEGIN(SkipLang);
1108 }
1109 }
#define Config_getEnumAsString(name)
#define Config_isAvailableEnum(name, value)
int qstricmp(const char *s1, const char *s2)
1110<CComment,CNComment>{CMD}{CMD} |
1111<CComment,CNComment>. {
1113 }
1114<SkipLang>{CMD}"~"[a-zA-Z-]* { /* language switch */
1117 {
1118 warn(yyextra->fileName,yyextra->lineNr,
1120 }
1123 {
1124 BEGIN(CComment);
1125 }
1126 }
1127<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
1128 }
1129<SkipLang>\n { /* new line in language block, needed for keeping track of line numbers */
1131 }
1132<SkipLang>. { /* any other character */
1133 }
1134<SComment>^[ \t]*{CPPC}"/"{SLASHopt}/\n {
1136 }
1137<SComment>\n[ \t]*{CPPC}"/"{SLASHopt}/\n {
1139 }
1140<SComment>^[ \t]*{CPPC}"/"[^\/\n]/.*\n {
1142 yyextra->readLineCtx=YY_START;
1143 YY_CURRENT_BUFFER->yy_at_bol=1;
1144 BEGIN(ReadLine);
1145 }
1146<SComment>\n[ \t]*{CPPC}[\/!]("<")?[ \t]*{CMD}"}".*\n {
1147
1150 yyextra->inSpecialComment=false;
1151 yyextra->inRoseComment=false;
1152 BEGIN(Scan);
1153 }
1154<SComment>\n[ \t]*{CPPC}"/"[^\\@\/\n]/.*\n {
1156 yyextra->readLineCtx=YY_START;
1157 YY_CURRENT_BUFFER->yy_at_bol=1;
1158 BEGIN(ReadLine);
1159 }
1160<SComment>^[ \t]*{CPPC}"!" | // just //!
1161<SComment>^[ \t]*{CPPC}"!<"/.*\n | // or //!< something
1162<SComment>^[ \t]*{CPPC}"!"[^<]/.*\n { // or //!something
1164 yyextra->readLineCtx=YY_START;
1165 YY_CURRENT_BUFFER->yy_at_bol=1;
1166 BEGIN(ReadLine);
1167 }
1168<SComment>\n[ \t]*{CPPC}"!" |
1169<SComment>\n[ \t]*{CPPC}"!<"/.*\n |
1170<SComment>\n[ \t]*{CPPC}"!"[^<\n]/.*\n {
1172 yyextra->readLineCtx=YY_START;
1173 YY_CURRENT_BUFFER->yy_at_bol=1;
1174 BEGIN(ReadLine);
1175 }
1176<SComment>^[ \t]*{CPPC}"##"/.*\n {
1177 if (!yyextra->inRoseComment)
1178 {
1179 REJECT;
1180 }
1181 else
1182 {
1184 yyextra->readLineCtx=YY_START;
1185 YY_CURRENT_BUFFER->yy_at_bol=1;
1186 BEGIN(ReadLine);
1187 }
1188 }
1189<SComment>\n[ \t]*{CPPC}"##"/.*\n {
1190 if (!yyextra->inRoseComment)
1191 {
1192 REJECT;
1193 }
1194 else
1195 {
1197 yyextra->readLineCtx=YY_START;
1198 YY_CURRENT_BUFFER->yy_at_bol=1;
1199 BEGIN(ReadLine);
1200 }
1201 }
1202<SComment>\n { /* end of special comment */
1205 yyextra->inSpecialComment=
FALSE;
1206 yyextra->inRoseComment=
FALSE;
1207 yyextra->insertCppCommentMarker=false;
1208 yyextra->readLineCtx = Scan;
1209
1210 BEGIN(Scan);
1211 }
1212<ReadLine>{CCS}"*" {
1214 }
1215<ReadLine>{CCE} {
1217 }
1218<ReadLine,CopyLine>"*" {
1220 }
1221<ReadLine,CopyLine>{RL} {
1223 }
1224<ReadLine,CopyLine>{RL}/{B}{CMD}"ilinebr"{B} {
1226 }
1227<ReadLine,CopyLine>{RLopt}/\n {
1229 yyextra->insertCppCommentMarker=false;
1230 BEGIN(yyextra->readLineCtx);
1231 }
1232<CComment,CNComment,ReadLine>"\<" { /* escaped html comment */
1234 }
1235<CComment,CNComment,ReadLine>{CMD}{CMD}[~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command
1237 }
1238
1239<CComment,ReadLine,IncludeFile>{CMD}("include"{OPTS}|"includedoc"{OPTS}*) {
1240 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1241 yyextra->includeCtx = YY_START;
1242 yyextra->firstIncludeLine = true;
1243 yyextra->insertCommentCol = yyextra->col;
1244 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1245 {
1246 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1247 }
1248
1249 BEGIN(IncludeDoc);
1250 }
1251<CComment,ReadLine,IncludeFile>{CMD}("snippet"{OPTS}|"snippetdoc"{OPTS}*) {
1252 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1253 yyextra->includeCtx = YY_START;
1254 yyextra->firstIncludeLine = true;
1255 yyextra->insertCommentCol = yyextra->col;
1256 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1257 {
1258 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1259 }
1260
1261 BEGIN(SnippetDoc);
1262 }
1263<IncludeDoc,SnippetDoc>{B}*
1264<IncludeDoc>{FILEMASK}|"\""[^\n\"]+"\"" {
1266 if (yytext[0]=='"')
1267 {
1268 fileName=fileName.
mid(1,fileName.
length()-2);
1269 }
1271 {
1272 BEGIN(IncludeFile);
1273 }
1274 else
1275 {
1276 BEGIN(yyextra->includeCtx);
1277 }
1278 }
1279<SnippetDoc>({FILEMASK}|"\""[^\n\"]+"\""){B}+ {
1280 yyextra->snippetFileName=yytext;
1281 yyextra->snippetFileName=yyextra->snippetFileName.stripWhiteSpace();
1282 if (yyextra->snippetFileName == "this") yyextra->snippetFileName=yyextra->fileName;
1283 yyextra->snippetName = "";
1284 BEGIN(SnippetDocTag);
1285 }
1286<SnippetDocTag>[^\\@\n]+ {
1287 yyextra->snippetName += yytext;
1288 }
1289<SnippetDocTag>{CMD} {
1290 yyextra->snippetName += yytext;
1291 }
1292<SnippetDocTag>(\n|{CMD}"ilinebr") {
1293 for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]);
1294 yyextra->snippetName = yyextra->snippetName.stripWhiteSpace();
1295 QCString blockId =
"["+yyextra->snippetName+
"]";
1297 {
1298 BEGIN(IncludeFile);
1299 }
1300 else
1301 {
1302 BEGIN(yyextra->includeCtx);
1303 }
1304 }
1305
1306<IncludeDoc,SnippetDoc>\n {
1309
1310
1311 BEGIN(yyextra->includeCtx);
1312 }
1313<IncludeDoc,SnippetDoc>. { // invalid character
1315 BEGIN(yyextra->includeCtx);
1316 }
1317<CComment,ReadLine,IncludeFile>{CMD}"cond"/[^a-z_A-Z0-9] { // conditional section
1318 yyextra->condCtx = YY_START;
1319 BEGIN(CondLine);
1320 }
1321<CComment,ReadLine,IncludeFile>{CMD}"endcond"/[^a-z_A-Z0-9] { // end of conditional section
1322 bool oldSkip=yyextra->skip;
1324 if (YY_START==CComment && oldSkip && !yyextra->skip)
1325 {
1326
1327 if (yyextra->lang!=SrcLangExt::Python &&
1328 yyextra->lang!=SrcLangExt::VHDL &&
1329 yyextra->lang!=SrcLangExt::Markdown &&
1330 yyextra->lang!=SrcLangExt::Fortran)
1331 {
1332 yyextra->outBuf+='/';
1333 yyextra->outBuf+='*';
1334 yyextra->col+=2;
1335 if (yyextra->specialComment)
1336 {
1337 yyextra->outBuf+='*';
1338 yyextra->col++;
1339 }
1340 }
1341 }
1342 }
1343<CondLine>[!()&| \ta-z_A-Z0-9.\-]+ {
1345 }
1346<CComment,ReadLine,IncludeFile>{CMD}"cond"{WSopt}/\n {
1347 yyextra->condCtx=YY_START;
1349 }
1350<CondLine>\n |
1351<CondLine>. { // forgot section id?
1354 }
1355<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{CMD}[a-z_A-Z][a-z_A-Z0-9-]* { // expand alias without arguments
1356 bool inCppComment = YY_START==ReadLine && yyextra->readLineCtx==SComment;
1357 bool inCComment = YY_START==CComment && yyextra->blockHeadCol>0;
1359 }
1360<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{B}?{CMD}"ilinebr"{B}{CMD}"ialias{" { // expand alias with arguments
1361 yyextra->lastBlockContext=YY_START;
1362 yyextra->blockCount=1;
1363 int extraSpace = (yytext[0]==' '? 1:0);
1364 yyextra->aliasString=yytext+9+extraSpace;
1365 yyextra->aliasCmd=yytext+9+extraSpace;
1366 yyextra->lastEscaped=0;
1367 BEGIN( ReadAliasArgs );
1368 }
1369<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{CMD}[a-z_A-Z][a-z_A-Z0-9-]*"{" { // expand alias with arguments
1370 yyextra->lastBlockContext=YY_START;
1371 yyextra->blockCount=1;
1372 yyextra->aliasString=yytext;
1373 yyextra->aliasCmd=yytext;
1374 yyextra->lastEscaped=0;
1375 BEGIN( ReadAliasArgs );
1376 }
1377<ReadAliasArgs>^[ \t]*"*" {
1379 if (indent>yyextra->blockHeadCol)
1380 {
1381 yyextra->aliasString+=yytext;
1382 }
1383 else
1384 {
1385
1386 }
1387 }
1388<ReadAliasArgs>^[ \t]*{CPPC}[/!]/[^\n]* { // skip leading special comments (see bug 618079)
1389 }
1390<ReadAliasArgs>[^{}\n\\\*]+ {
1391 yyextra->aliasString+=yytext;
1392 yyextra->lastEscaped=
FALSE;
1393 }
1394<ReadAliasArgs>"\\" {
1395 if (yyextra->lastEscaped) yyextra->lastEscaped=
FALSE;
1396 else yyextra->lastEscaped=
TRUE;
1397 yyextra->aliasString+=yytext;
1398 }
1399<ReadAliasArgs>{CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}"|"f)") { /* end of verbatim block */
1400 yyextra->aliasString+=yytext;
1401 if (yyextra->inVerbatim && &yytext[1]==yyextra->blockName)
1402
1403
1404
1405
1406
1407
1408 {
1410 yyextra->inVerbatim=false;
1411 BEGIN(yyextra->lastCommentContext);
1412 }
1413 }
1414<ReadAliasArgs>\n {
1415 yyextra->aliasString+=yytext;
1416 yyextra->lastEscaped=
FALSE;
1417 if (yyextra->inVerbatim)
1418
1419 {
1421 BEGIN( yyextra->lastBlockContext );
1422 }
1423 }
1424<ReadAliasArgs>"{" {
1425 yyextra->aliasString+=yytext;
1426 if (!yyextra->lastEscaped) yyextra->blockCount++;
1427 yyextra->lastEscaped=
FALSE;
1428 }
1429<ReadAliasArgs>"}" {
1430 yyextra->aliasString+=yytext;
1431 if (!yyextra->lastEscaped) yyextra->blockCount--;
1432 if (yyextra->blockCount==0)
1433 {
1434 bool inCppComment = yyextra->lastBlockContext==ReadLine && yyextra->readLineCtx==SComment;
1435 bool inCComment = yyextra->lastBlockContext==CComment && yyextra->blockHeadCol>0;
1436 replaceAliases(yyscanner,yyextra->aliasString.view(),inCppComment,inCComment);
1437 BEGIN( yyextra->lastBlockContext );
1438 }
1439 yyextra->lastEscaped=
FALSE;
1440 }
1441<ReadAliasArgs>. {
1442 yyextra->aliasString+=yytext;
1443 yyextra->lastEscaped=
FALSE;
1444 }
1445<CopyLine>. {
1447 }
1448<CopyLine>\n {
1450 yyextra->insertCppCommentMarker=false;
1451 BEGIN(yyextra->readLineCtx);
1452 }
1453<ReadLine>{CMD}{CMD} |
1454<ReadLine>. {
1456 }
1457<IncludeFile>. {
1459 }
1460<IncludeFile>\n {
1463 }
1464<*>. {
1466 }
1467<<EOF>> {
1468 if (YY_START == ReadAliasArgs)
1469 {
1470 warn(yyextra->fileName,yyextra->lineNr,
1471 "Reached end of file while still searching closing '}}' of an alias argument (probable start: '{}')",
1472 yyextra->aliasCmd);
1473 }
1474 else if (YY_START==Verbatim || YY_START==VerbatimCode)
1475 {
1476 warn(yyextra->fileName,yyextra->lineNr,
1477 "Reached end of file while still searching closing '{}' of a verbatim block starting at line {}",
1478 yyextra->blockName,yyextra->verbatimLine);
1479 }
1480 if (yyextra->includeStack.empty())
1481 {
1482 yyextra->insertCppCommentMarker=false;
1484 }
1485 else
1486 {
1487 std::unique_ptr<commentcnv_FileState> &fs = yyextra->includeStack.back();
1488 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
1489 yy_switch_to_buffer(fs->bufState, yyscanner);
1490 yy_delete_buffer(oldBuf, yyscanner);
1491 BEGIN(fs->oldState);
1492 yyextra->fileName = fs->oldFileName;
1493 yyextra->lineNr = fs->oldLineNr;
1494 yyextra->inBuf = fs->oldFileBuf;
1495 yyextra->inBufPos = fs->oldFileBufPos;
1496 yyextra->includeCtx = fs->oldIncludeCtx;
1498 if (fs->oldRaiseLvl!=yyextra->raiseLevel)
1499 {
1500 lineStr+="\\iraise " + std::to_string(fs->oldRaiseLvl)+ " ";
1501 }
1502 if (fs->oldRaiseLbl!=yyextra->raiseLabel)
1503 {
1504 lineStr+="\\iprefix \"" + fs->oldRaiseLbl + "\" ";
1505 }
1506 lineStr+="\\ilinebr ";
1507 yyextra->raiseLevel = fs->oldRaiseLvl;
1508 yyextra->raiseLabel = fs->oldRaiseLbl;
1510 yyextra->includeStack.pop_back();
1511
1512
1513 }
1514 }
1515
1516<*>\n { fprintf(stderr,"Lex scanner %s (%s) default rule newline for state %s.\n", __FILE__, qPrint(yyextra->fileName),stateToString(YY_START));}
1517 */
1518%%