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 if (yyextra->inSpecialComment || yyextra->specialComment || yyextra->lang==SrcLangExt::Markdown)
627 {
628 yyextra->lastCommentContext = YY_START;
629 yyextra->javaBlock=0;
630 if (
qstrcmp(&yytext[1],
"startuml")==0)
631 {
632 yyextra->blockName="enduml";
633 }
634 else
635 {
636 yyextra->blockName=
QCString(
"end")+&yytext[1];
637 }
638 yyextra->inVerbatim=true;
639 yyextra->verbatimLine=yyextra->lineNr;
640 BEGIN(VerbatimCode);
641 }
642 }
int qstrcmp(const char *str1, const char *str2)
643<CComment,ReadLine,IncludeFile>"\\`" {
645 }
646<CComment,ReadLine,IncludeFile>"```" { // skip ``` if not at the start of the line
648 }
649<CComment,ReadLine,IncludeFile>"`"{1,2} {
651 {
652 REJECT;
653 }
655 if (yyextra->inSpecialComment || yyextra->specialComment || yyextra->lang==SrcLangExt::Markdown)
656 {
657 yyextra->lastCommentContext = YY_START;
658 yyextra->javaBlock=0;
659 yyextra->blockName=yytext;
660 yyextra->inVerbatim=true;
661 yyextra->verbatimLine=yyextra->lineNr;
662 BEGIN(VerbatimCode);
663 }
664 }
665<CComment,ReadLine,IncludeFile>{CMD}("f$"|"f["|"f{"|"f(") {
667 if (yyextra->inSpecialComment || yyextra->specialComment || yyextra->lang==SrcLangExt::Markdown)
668 {
669 yyextra->blockName=&yytext[1];
670 if (yyextra->blockName.at(1)=='[')
671 {
672 yyextra->blockName.at(1)=']';
673 }
674 else if (yyextra->blockName.at(1)=='{')
675 {
676 yyextra->blockName.at(1)='}';
677 }
678 else if (yyextra->blockName.at(1)=='(')
679 {
680 yyextra->blockName.at(1)=')';
681 }
682 yyextra->lastCommentContext = YY_START;
683 yyextra->inVerbatim=true;
684 yyextra->verbatimLine=yyextra->lineNr;
685 BEGIN(Verbatim);
686 }
687 }
688<CComment,ReadLine,IncludeFile>"<!--!" { /* HTML comment doxygen command*/
689 if (yyextra->inVerbatim) REJECT;
690
691 yyextra->inHtmlDoxygenCommand=true;
692 }
693<CComment,ReadLine,IncludeFile>"-->" { /* potential end HTML comment doxygen command*/
694 if (yyextra->inHtmlDoxygenCommand)
695 {
696 yyextra->inHtmlDoxygenCommand=false;
697 }
698 else
699 {
701 }
702 }
703<CComment,ReadLine,IncludeFile>"<!--" { /* HTML comment */
705 if (yyextra->inSpecialComment || yyextra->specialComment || yyextra->lang==SrcLangExt::Markdown)
706 {
707 yyextra->blockName="-->";
708 yyextra->lastCommentContext = YY_START;
709 yyextra->inVerbatim=true;
710 yyextra->verbatimLine=yyextra->lineNr;
711 BEGIN(Verbatim);
712 }
713 }
714<CComment,ReadLine,IncludeFile>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly")/[^a-z_A-Z0-9] { /* start of a verbatim block */
716 if (yyextra->inSpecialComment || yyextra->specialComment || yyextra->lang==SrcLangExt::Markdown)
717 {
718 yyextra->blockName=
QCString(
"end")+&yytext[1];
719 yyextra->lastCommentContext = YY_START;
720 yyextra->inVerbatim=true;
721 yyextra->verbatimLine=yyextra->lineNr;
722 BEGIN(Verbatim);
723 }
724 }
725<Scan>"\\\"" { /* escaped double quote */
727 }
728<Scan>"\\\\" { /* escaped backslash */
730 }
731<Scan>. { /* any other character */
733 }
734<Verbatim>{CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}"|"f)") { /* end of verbatim block */
736 if (&yytext[1]==yyextra->blockName)
737 {
738 yyextra->inVerbatim=false;
739 BEGIN(yyextra->lastCommentContext);
740 }
741 }
742<Verbatim>"-->" {
744 if (yytext==yyextra->blockName)
745 {
746 yyextra->inVerbatim=false;
747 BEGIN(yyextra->lastCommentContext);
748 }
749 }
750<VerbatimCode>"{" {
751 if (yyextra->javaBlock==0)
752 {
753 REJECT;
754 }
755 else
756 {
757 yyextra->javaBlock++;
759 }
760 }
761<VerbatimCode>"}" {
762 if (yyextra->javaBlock==0)
763 {
764 REJECT;
765 }
766 else
767 {
768 yyextra->javaBlock--;
769 if (yyextra->javaBlock==0)
770 {
772 yyextra->inVerbatim=false;
773 BEGIN(yyextra->lastCommentContext);
774 }
775 else
776 {
778 }
779 }
780 }
781<VerbatimCode>("```"[`]*|"~~~"[~]*) { /* end of markdown code block */
782 if (yytext[0]=='`' && (yyextra->blockName=="`" || yyextra->blockName=="``"))
783 {
784
786 }
787 else
788 {
790 if (yytext[0]==yyextra->blockName[0])
791 {
792 yyextra->inVerbatim=false;
793 BEGIN(yyextra->lastCommentContext);
794 }
795 }
796 }
797<VerbatimCode>"''" {
800 {
801 yyextra->inVerbatim=false;
802 BEGIN(yyextra->lastCommentContext);
803 }
804 }
805<VerbatimCode>"'" {
808 {
809 yyextra->inVerbatim=false;
810 BEGIN(yyextra->lastCommentContext);
811 }
812 }
813<VerbatimCode>"`"{1,2} {
815 if (yytext==yyextra->blockName)
816 {
817 yyextra->inVerbatim=false;
818 BEGIN(yyextra->lastCommentContext);
819 }
820 }
821<VerbatimCode>{CMD}("enddot"|"endcode"|"endmsc"|"enduml")/("{")? { // end of verbatim block
823 if (&yytext[1]==yyextra->blockName)
824 {
825 yyextra->inVerbatim=false;
826 BEGIN(yyextra->lastCommentContext);
827 }
828 }
829<VerbatimCode>^[ \t]*{CPPC}[\!\/]? { /* skip leading comments */
830 if (!yyextra->inSpecialComment || yyextra->mlBrief)
831 {
833 }
834 else
835 {
836 int l=0;
837 while (yytext[l]==' ' || yytext[l]=='\t')
838 {
839 l++;
840 }
842 if (yyleng-l==3)
843 {
845 }
846 else
847 {
849 }
850 }
851 }
852<Verbatim,VerbatimCode>[^`'~@\/\-\\\n{}]* { /* any character not a backslash or new line or } */
854 }
855<Verbatim,VerbatimCode>[^`'~@\/\-\\\n{}]+/\n{B}*"//" {
856 if (yyextra->lastCommentContext!=ReadLine)
857 {
858 REJECT;
859 }
860 else
861 {
863 }
864 }
865<Verbatim,VerbatimCode>[^`'~@\/\-\\\n{}]+/\n { /* premature end of comment block */
866 if (yyextra->lastCommentContext==ReadLine)
867 {
868 yyextra->inVerbatim=false;
869 BEGIN(yyextra->lastCommentContext);
870 }
872 }
873<Verbatim,VerbatimCode>\n { /* new line in verbatim block */
875 if (yyextra->lastCommentContext == IncludeFile)
876 {
878 }
879 }
880<Verbatim>^[ \t]*{CPPC}[/!] {
881 if (yyextra->blockName=="enddot" || yyextra->blockName=="endmsc" || yyextra->blockName=="enduml" || yyextra->blockName.at(0)=='f')
882 {
883
884 int l=0;
885 while (yytext[l]==' ' || yytext[l]=='\t')
886 {
887 l++;
888 }
891 }
892 else
893 {
894 REJECT;
895 }
896 }
897<Verbatim,VerbatimCode>. { /* any other character */
899 }
900<SkipString>\\. { /* escaped character in string */
901 if (yyextra->lang==SrcLangExt::Fortran || yyextra->lang==SrcLangExt::VHDL)
902 {
903 unput(yytext[1]);
905 }
906 else
907 {
909 }
910 }
911<SkipString>"\"" { /* end of string */
913 BEGIN(yyextra->stringContext);
914 }
915<SkipString>. { /* any other string character */
917 }
918<SkipString>\n { /* new line inside string (illegal for some compilers) */
920 }
921<SkipVerbString>[^"\n]+ {
923 }
924<SkipVerbString>\"\" { // escaped quote
926 }
927<SkipVerbString>"\"" { /* end of string */
929 BEGIN(yyextra->stringContext);
930 }
931<SkipVerbString>. {
933 }
934<SkipVerbString>\n {
936 }
937<SkipChar>\\. { /* escaped character */
938 if (yyextra->lang==SrcLangExt::Fortran || yyextra->lang==SrcLangExt::VHDL)
939 {
940 unput(yytext[1]);
942 }
943 else
944 {
946 }
947 }
948<SkipChar>' { /* end of character literal */
950 BEGIN(yyextra->charContext);
951 }
952<SkipChar>. { /* any other string character */
954 }
955<SkipChar>\n { /* new line character */
957 }
958
959<CComment,CNComment>[^ `~<\\!@*\n{\"'\/-`]* { /* anything that is not a '*' or command */
961 }
962<CComment,CNComment>^{B}*"*"+[^*\/<\\@\n{\"`]* { /* stars without slashes */
963 if (yyextra->lang==SrcLangExt::Markdown) REJECT;
965 if (yyextra->col>yyextra->blockHeadCol)
966 {
967
968 yyextra->blockHeadCol=yyextra->col;
969 }
971 }
972<CComment>"'''" |
973<CComment>"\"\"\"" { /* end of Python docstring */
974 if (yyextra->lang!=SrcLangExt::Python)
975 {
976 REJECT;
977 }
978 else if (yyextra->pythonDocStringChar != yytext[0])
979 {
981 }
982 else
983 {
984 yyextra->nestingCount--;
985 yyextra->pythonDocString =
FALSE;
986 yyextra->pythonDocStringChar = '\0';
988 BEGIN(Scan);
989 }
990 }
991<CComment,CNComment>\n { /* new line in comment */
993
994 if (yyextra->lang==SrcLangExt::Fortran)
995 {
996 BEGIN(Scan);
997 }
998 }
999<CComment,CNComment>"/""/"+/"*/" { /* we are already in C-comment so not a start of a nested comment but
1000 * just the
end of the
comment (the
end part is handled later). */
1002 }
DirIterator end(const DirIterator &) noexcept
1003<CComment,CNComment>"/"+"*" { /* nested C comment */
1004 if (yyextra->lang==SrcLangExt::Python ||
1005 yyextra->lang==SrcLangExt::Markdown)
1006 {
1007 REJECT;
1008 }
1009 yyextra->nestingCount++;
1010 yyextra->commentStack.push(yyextra->lineNr);
1012 }
1013<CComment,CNComment>^{B}*"*"+"/" |
1014<CComment,CNComment>"*"+"/" { /* end of C comment */
1015 if (yyextra->lang==SrcLangExt::Python ||
1016 yyextra->lang==SrcLangExt::Markdown)
1017 {
1018 REJECT;
1019 }
1020 else
1021 {
1023 yyextra->nestingCount--;
1024 if (yyextra->nestingCount<=0)
1025 {
1026 BEGIN(Scan);
1027 }
1028 else
1029 {
1030
1031 yyextra->commentStack.pop();
1032 }
1033 }
1034 }
1035
1036<CComment,CNComment>"\n"/[ \t]*"#" {
1037 if (yyextra->lang!=SrcLangExt::VHDL)
1038 {
1039 REJECT;
1040 }
1041 else
1042 {
1043 if (yyextra->vhdl)
1044 {
1045 yyextra->vhdl =
FALSE;
1047 BEGIN(Scan);
1048 }
1049 else
1050 {
1051 REJECT;
1052 }
1053 }
1054 }
1055<CComment,CNComment>"\n"/[ \t]*"-" {
1056 if (yyextra->lang!=SrcLangExt::Python || yyextra->pythonDocString)
1057 {
1058 REJECT;
1059 }
1060 else
1061 {
1063 BEGIN(Scan);
1064 }
1065 }
1066<CComment,CNComment>"\n"/[ \t]*[^ \t#\-] {
1067 if (yyextra->lang==SrcLangExt::Python)
1068 {
1069 if (yyextra->pythonDocString)
1070 {
1071 REJECT;
1072 }
1073 else
1074 {
1076 BEGIN(Scan);
1077 }
1078 }
1079 else if (yyextra->lang==SrcLangExt::VHDL)
1080 {
1081 if (yyextra->vhdl)
1082 {
1083 yyextra->vhdl =
FALSE;
1085 BEGIN(Scan);
1086 }
1087 else
1088 {
1089 REJECT;
1090 }
1091 }
1092 else
1093 {
1094 REJECT;
1095 }
1096 }
1097
1098<CComment,CNComment>"'" {
1099 yyextra->charContext = YY_START;
1101 BEGIN(SkipChar);
1102 }
1103<CComment,CNComment>"\"" {
1104 yyextra->stringContext = YY_START;
1106 BEGIN(SkipString);
1107 }
1108 */
1109<CComment,CNComment>{CMD}"~"[a-z_A-Z-]* { // language switch command
1110 if (yyextra->lang!=SrcLangExt::Markdown) REJECT;
1114 {
1116 {
1117 warn(yyextra->fileName,yyextra->lineNr,
1119 }
1120 BEGIN(SkipLang);
1121 }
1122 }
#define Config_getEnumAsString(name)
#define Config_isAvailableEnum(name, value)
int qstricmp(const char *s1, const char *s2)
1123<CComment,CNComment>{CMD}{CMD} |
1124<CComment,CNComment>. {
1126 }
1127<SkipLang>{CMD}"~"[a-zA-Z-]* { /* language switch */
1130 {
1131 warn(yyextra->fileName,yyextra->lineNr,
1133 }
1136 {
1137 BEGIN(CComment);
1138 }
1139 }
1140<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
1141 }
1142<SkipLang>\n { /* new line in language block, needed for keeping track of line numbers */
1144 }
1145<SkipLang>. { /* any other character */
1146 }
1147<SComment>^[ \t]*{CPPC}"/"{SLASHopt}/\n {
1149 }
1150<SComment>\n[ \t]*{CPPC}"/"{SLASHopt}/\n {
1152 }
1153<SComment>^[ \t]*{CPPC}"/"[^\/\n]/.*\n {
1155 yyextra->readLineCtx=YY_START;
1156 YY_CURRENT_BUFFER->yy_at_bol=1;
1157 BEGIN(ReadLine);
1158 }
1159<SComment>\n[ \t]*{CPPC}[\/!]("<")?[ \t]*{CMD}"}".*\n {
1160
1163 yyextra->inSpecialComment=false;
1164 yyextra->inRoseComment=false;
1165 BEGIN(Scan);
1166 }
1167<SComment>\n[ \t]*{CPPC}"/"[^\\@\/\n]/.*\n {
1169 yyextra->readLineCtx=YY_START;
1170 YY_CURRENT_BUFFER->yy_at_bol=1;
1171 BEGIN(ReadLine);
1172 }
1173<SComment>^[ \t]*{CPPC}"!" | // just //!
1174<SComment>^[ \t]*{CPPC}"!<"/.*\n | // or //!< something
1175<SComment>^[ \t]*{CPPC}"!"[^<]/.*\n { // or //!something
1177 yyextra->readLineCtx=YY_START;
1178 YY_CURRENT_BUFFER->yy_at_bol=1;
1179 BEGIN(ReadLine);
1180 }
1181<SComment>\n[ \t]*{CPPC}"!" |
1182<SComment>\n[ \t]*{CPPC}"!<"/.*\n |
1183<SComment>\n[ \t]*{CPPC}"!"[^<\n]/.*\n {
1185 yyextra->readLineCtx=YY_START;
1186 YY_CURRENT_BUFFER->yy_at_bol=1;
1187 BEGIN(ReadLine);
1188 }
1189<SComment>^[ \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[ \t]*{CPPC}"##"/.*\n {
1203 if (!yyextra->inRoseComment)
1204 {
1205 REJECT;
1206 }
1207 else
1208 {
1210 yyextra->readLineCtx=YY_START;
1211 YY_CURRENT_BUFFER->yy_at_bol=1;
1212 BEGIN(ReadLine);
1213 }
1214 }
1215<SComment>\n { /* end of special comment */
1218 yyextra->inSpecialComment=
FALSE;
1219 yyextra->inRoseComment=
FALSE;
1220 yyextra->insertCppCommentMarker=false;
1221 yyextra->readLineCtx = Scan;
1222
1223 BEGIN(Scan);
1224 }
1225<ReadLine>{CCS}"*" {
1227 }
1228<ReadLine>{CCE} {
1230 }
1231<ReadLine,CopyLine>"*" {
1233 }
1234<ReadLine,CopyLine>{RL} {
1236 }
1237<ReadLine,CopyLine>{RL}/{B}{CMD}"ilinebr"{B} {
1239 }
1240<ReadLine,CopyLine>{RLopt}/\n {
1242 yyextra->insertCppCommentMarker=false;
1243 BEGIN(yyextra->readLineCtx);
1244 }
1245<CComment,CNComment,ReadLine>"\<" { /* escaped html comment */
1247 }
1248<CComment,CNComment,ReadLine>{CMD}{CMD}[~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command
1250 }
1251
1252<CComment,ReadLine,IncludeFile>{CMD}("include"{OPTS}|"includedoc"{OPTS}*) {
1253 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1254 yyextra->includeCtx = YY_START;
1255 yyextra->firstIncludeLine = true;
1256 yyextra->insertCommentCol = yyextra->col;
1257 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1258 {
1259 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1260 }
1261
1262 BEGIN(IncludeDoc);
1263 }
1264<CComment,ReadLine,IncludeFile>{CMD}("snippet"{OPTS}|"snippetdoc"{OPTS}*) {
1265 if (!
parseIncludeOptions(yyscanner,std::string_view{yytext,
static_cast<size_t>(yyleng)})) REJECT;
1266 yyextra->includeCtx = YY_START;
1267 yyextra->firstIncludeLine = true;
1268 yyextra->insertCommentCol = yyextra->col;
1269 if (!yyextra->insertCppCommentMarker && (yyextra->includeCtx==ReadLine || yyextra->includeCtx==IncludeFile))
1270 {
1271 yyextra->insertCppCommentMarker = yyextra->mlBrief;
1272 }
1273
1274 BEGIN(SnippetDoc);
1275 }
1276<IncludeDoc,SnippetDoc>{B}*
1277<IncludeDoc>{FILEMASK}|"\""[^\n\"]+"\"" {
1279 if (yytext[0]=='"')
1280 {
1281 fileName=fileName.
mid(1,fileName.
length()-2);
1282 }
1284 {
1285 BEGIN(IncludeFile);
1286 }
1287 else
1288 {
1289 BEGIN(yyextra->includeCtx);
1290 }
1291 }
1292<SnippetDoc>({FILEMASK}|"\""[^\n\"]+"\""){B}+ {
1293 yyextra->snippetFileName=yytext;
1294 yyextra->snippetFileName=yyextra->snippetFileName.stripWhiteSpace();
1295 if (yyextra->snippetFileName == "this") yyextra->snippetFileName=yyextra->fileName;
1296 yyextra->snippetName = "";
1297 BEGIN(SnippetDocTag);
1298 }
1299<SnippetDocTag>[^\\@\n]+ {
1300 yyextra->snippetName += yytext;
1301 }
1302<SnippetDocTag>{CMD} {
1303 yyextra->snippetName += yytext;
1304 }
1305<SnippetDocTag>(\n|{CMD}"ilinebr") {
1306 for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]);
1307 yyextra->snippetName = yyextra->snippetName.stripWhiteSpace();
1308 QCString blockId =
"["+yyextra->snippetName+
"]";
1310 {
1311 BEGIN(IncludeFile);
1312 }
1313 else
1314 {
1315 BEGIN(yyextra->includeCtx);
1316 }
1317 }
1318
1319<IncludeDoc,SnippetDoc>\n {
1322
1323
1324 BEGIN(yyextra->includeCtx);
1325 }
1326<IncludeDoc,SnippetDoc>. { // invalid character
1328 BEGIN(yyextra->includeCtx);
1329 }
1330<CComment,ReadLine,IncludeFile>{CMD}"cond"/[^a-z_A-Z0-9] { // conditional section
1331 yyextra->condCtx = YY_START;
1332 BEGIN(CondLine);
1333 }
1334<CComment,ReadLine,IncludeFile>{CMD}"endcond"/[^a-z_A-Z0-9] { // end of conditional section
1335 bool oldSkip=yyextra->skip;
1337 if (YY_START==CComment && oldSkip && !yyextra->skip)
1338 {
1339
1340 if (yyextra->lang!=SrcLangExt::Python &&
1341 yyextra->lang!=SrcLangExt::VHDL &&
1342 yyextra->lang!=SrcLangExt::Markdown &&
1343 yyextra->lang!=SrcLangExt::Fortran)
1344 {
1345 yyextra->outBuf+='/';
1346 yyextra->outBuf+='*';
1347 yyextra->col+=2;
1348 if (yyextra->specialComment)
1349 {
1350 yyextra->outBuf+='*';
1351 yyextra->col++;
1352 }
1353 }
1354 }
1355 }
1356<CondLine>[!()&| \ta-z_A-Z0-9.\-]+ {
1358 }
1359<CComment,ReadLine,IncludeFile>{CMD}"cond"{WSopt}/\n {
1360 yyextra->condCtx=YY_START;
1362 }
1363<CondLine>\n |
1364<CondLine>. { // forgot section id?
1367 }
1368<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{CMD}[a-z_A-Z][a-z_A-Z0-9-]* { // expand alias without arguments
1369 bool inCppComment = YY_START==ReadLine && yyextra->readLineCtx==SComment;
1370 bool inCComment = YY_START==CComment && yyextra->blockHeadCol>0;
1372 }
1373<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{B}?{CMD}"ilinebr"{B}{CMD}"ialias{" { // expand alias with arguments
1374 yyextra->lastBlockContext=YY_START;
1375 yyextra->blockCount=1;
1376 int extraSpace = (yytext[0]==' '? 1:0);
1377 yyextra->aliasString=yytext+9+extraSpace;
1378 yyextra->aliasCmd=yytext+9+extraSpace;
1379 yyextra->lastEscaped=0;
1380 BEGIN( ReadAliasArgs );
1381 }
1382<CComment,ReadLine,IncludeFile,Verbatim,VerbatimCode>{CMD}[a-z_A-Z][a-z_A-Z0-9-]*"{" { // expand alias with arguments
1383 yyextra->lastBlockContext=YY_START;
1384 yyextra->blockCount=1;
1385 yyextra->aliasString=yytext;
1386 yyextra->aliasCmd=yytext;
1387 yyextra->lastEscaped=0;
1388 BEGIN( ReadAliasArgs );
1389 }
1390<ReadAliasArgs>^[ \t]*"*" {
1392 if (indent>yyextra->blockHeadCol)
1393 {
1394 yyextra->aliasString+=yytext;
1395 }
1396 else
1397 {
1398
1399 }
1400 }
1401<ReadAliasArgs>^[ \t]*{CPPC}[/!]/[^\n]* { // skip leading special comments (see bug 618079)
1402 }
1403<ReadAliasArgs>[^{}\n\\\*]+ {
1404 yyextra->aliasString+=yytext;
1405 yyextra->lastEscaped=
FALSE;
1406 }
1407<ReadAliasArgs>"\\" {
1408 if (yyextra->lastEscaped) yyextra->lastEscaped=
FALSE;
1409 else yyextra->lastEscaped=
TRUE;
1410 yyextra->aliasString+=yytext;
1411 }
1412<ReadAliasArgs>{CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}"|"f)") { /* end of verbatim block */
1413 yyextra->aliasString+=yytext;
1414 if (yyextra->inVerbatim && &yytext[1]==yyextra->blockName)
1415
1416
1417
1418
1419
1420
1421 {
1423 yyextra->inVerbatim=false;
1424 BEGIN(yyextra->lastCommentContext);
1425 }
1426 }
1427<ReadAliasArgs>\n {
1428 yyextra->aliasString+=yytext;
1429 yyextra->lastEscaped=
FALSE;
1430 if (yyextra->inVerbatim)
1431
1432 {
1434 BEGIN( yyextra->lastBlockContext );
1435 }
1436 }
1437<ReadAliasArgs>"{" {
1438 yyextra->aliasString+=yytext;
1439 if (!yyextra->lastEscaped) yyextra->blockCount++;
1440 yyextra->lastEscaped=
FALSE;
1441 }
1442<ReadAliasArgs>"}" {
1443 yyextra->aliasString+=yytext;
1444 if (!yyextra->lastEscaped) yyextra->blockCount--;
1445 if (yyextra->blockCount==0)
1446 {
1447 bool inCppComment = yyextra->lastBlockContext==ReadLine && yyextra->readLineCtx==SComment;
1448 bool inCComment = yyextra->lastBlockContext==CComment && yyextra->blockHeadCol>0;
1449 replaceAliases(yyscanner,yyextra->aliasString.view(),inCppComment,inCComment);
1450 BEGIN( yyextra->lastBlockContext );
1451 }
1452 yyextra->lastEscaped=
FALSE;
1453 }
1454<ReadAliasArgs>. {
1455 yyextra->aliasString+=yytext;
1456 yyextra->lastEscaped=
FALSE;
1457 }
1458<CopyLine>. {
1460 }
1461<CopyLine>\n {
1463 yyextra->insertCppCommentMarker=false;
1464 BEGIN(yyextra->readLineCtx);
1465 }
1466<ReadLine>{CMD}{CMD} |
1467<ReadLine>. {
1469 }
1470<IncludeFile>. {
1472 }
1473<IncludeFile>\n {
1476 }
1477<*>. {
1479 }
1480<<EOF>> {
1481 if (YY_START == ReadAliasArgs)
1482 {
1483 warn(yyextra->fileName,yyextra->lineNr,
1484 "Reached end of file while still searching closing '}}' of an alias argument (probable start: '{}')",
1485 yyextra->aliasCmd);
1486 }
1487 else if (YY_START==Verbatim || YY_START==VerbatimCode)
1488 {
1489 warn(yyextra->fileName,yyextra->lineNr,
1490 "Reached end of file while still searching closing '{}' of a verbatim block starting at line {}",
1491 yyextra->blockName,yyextra->verbatimLine);
1492 }
1493 if (yyextra->includeStack.empty())
1494 {
1495 yyextra->insertCppCommentMarker=false;
1497 }
1498 else
1499 {
1500 std::unique_ptr<commentcnv_FileState> &fs = yyextra->includeStack.back();
1501 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
1502 yy_switch_to_buffer(fs->bufState, yyscanner);
1503 yy_delete_buffer(oldBuf, yyscanner);
1504 BEGIN(fs->oldState);
1505 yyextra->fileName = fs->oldFileName;
1506 yyextra->lineNr = fs->oldLineNr;
1507 yyextra->inBuf = fs->oldFileBuf;
1508 yyextra->inBufPos = fs->oldFileBufPos;
1509 yyextra->includeCtx = fs->oldIncludeCtx;
1511 if (fs->oldRaiseLvl!=yyextra->raiseLevel)
1512 {
1513 lineStr+="\\iraise " + std::to_string(fs->oldRaiseLvl)+ " ";
1514 }
1515 if (fs->oldRaiseLbl!=yyextra->raiseLabel)
1516 {
1517 lineStr+="\\iprefix \"" + fs->oldRaiseLbl + "\" ";
1518 }
1519 lineStr+="\\ilinebr ";
1520 yyextra->raiseLevel = fs->oldRaiseLvl;
1521 yyextra->raiseLabel = fs->oldRaiseLbl;
1523 yyextra->includeStack.pop_back();
1524
1525
1526 }
1527 }
1528
1529<*>\n { fprintf(stderr,"Lex scanner %s (%s) default rule newline for state %s.\n", __FILE__, qPrint(yyextra->fileName),stateToString(YY_START));}
1530 */
1531%%