276 {
277
278 ^{B}"def"{BB} {
279 DBG_CTX((stderr,
"Found def at %d\n",yyextra->yyLineNr));
282 BEGIN( FunctionDec );
283 }
284 ^{B}"async"{BB}"def"{BB} {
285 DBG_CTX((stderr,
"Found async def at %d\n",yyextra->yyLineNr));
288 BEGIN( FunctionDec );
289 }
290 "def"{BB} {
292 BEGIN( FunctionDec );
293 }
294 "async"{BB}"def"{BB} {
296 BEGIN( FunctionDec );
297 }
static int computeIndent(const char *s)
static void searchFoundDef(yyscan_t yyscanner)
298
299 ^{B}"class"{BB} {
300 DBG_CTX((stderr,
"Found class at %d\n",yyextra->yyLineNr));
303 BEGIN( ClassDec ) ;
304 }
305 "class"{BB} {
307 BEGIN( ClassDec ) ;
308 }
309 ^{B}"from"{BB} |
310 "from"{BB} {
311 yyextra->packageCommentAllowed =
FALSE;
312 BEGIN( FromMod );
313 }
static void searchFoundClass(yyscan_t yyscanner)
314
315 ^{B}"import"{BB} |
316 "import"{BB} {
317 yyextra->packageCommentAllowed =
FALSE;
318 BEGIN( Import );
319 }
320 ^{B}{IDENTIFIER}/{B}"="{B}"property" {
321 yyextra->current->section = EntryType::makeVariable();
324 yyextra->current->fileName = yyextra->fileName;
325 yyextra->current->startLine = yyextra->yyLineNr;
326 yyextra->current->bodyLine = yyextra->yyLineNr;
327 yyextra->packageCommentAllowed =
FALSE;
328 BEGIN(VariableDec);
329 }
330 ^{B}{IDENTIFIER}/{B}"="[^=] {
331 if (yyextra->searchCount>0) REJECT;
333 yyextra->current->section = EntryType::makeVariable();
335 yyextra->current->fileName = yyextra->fileName;
336 yyextra->current->startLine = yyextra->yyLineNr;
337 yyextra->current->bodyLine = yyextra->yyLineNr;
338 yyextra->packageCommentAllowed =
FALSE;
339 BEGIN(VariableDec);
340 }
341 ^{B}{IDENTIFIER}/{B}":" {
342 if (yyextra->searchCount>0) REJECT;
344 if (id =="try" || id == "else" || id == "except" || id == "finally") REJECT;
346 yyextra->current->section = EntryType::makeVariable();
347 yyextra->current->name = id;
348 yyextra->current->fileName = yyextra->fileName;
349 yyextra->current->startLine = yyextra->yyLineNr;
350 yyextra->current->bodyLine = yyextra->yyLineNr;
351 yyextra->packageCommentAllowed =
FALSE;
352 BEGIN(VariableDec);
353 }
354 {B}{IDENTIFIER}/({B},{B}{IDENTIFIER})*{B}")"*{B}"="[^=] {
355
356
357
358 if (yyextra->searchCount>1) REJECT;
360 yyextra->current->section = EntryType::makeVariable();
362 yyextra->current->fileName = yyextra->fileName;
363 yyextra->current->startLine = yyextra->yyLineNr;
364 yyextra->current->bodyLine = yyextra->yyLineNr;
365 yyextra->packageCommentAllowed =
FALSE;
367 }
368 "'" {
369 yyextra->stringContext=YY_START;
370 yyextra->copyString=nullptr;
371 yyextra->packageCommentAllowed =
FALSE;
372 BEGIN( SingleQuoteString );
373 }
374 "\"" {
375 yyextra->stringContext=YY_START;
376 yyextra->copyString=nullptr;
377 yyextra->packageCommentAllowed =
FALSE;
378 BEGIN( DoubleQuoteString );
379 }
380 "@staticmethod" {
381 yyextra->isStatic=
TRUE;
382 }
383 "@"{SCOPE}"(" {
385 yyextra->decoratorRound = 1;
386 yyextra->copyString=nullptr;
387 BEGIN( Decorator );
388 }
389 "@"{SCOPE} {
391 }
392 {SCRIPTCOMMENT} {
393 if (yyextra->yyLineNr != 1) REJECT;
394 }
395 {POUNDCOMMENT} {
396
397
398 }
399 {IDENTIFIER} {
400 yyextra->packageCommentAllowed =
FALSE;
401 }
402 ^{BB} {
404 }
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
#define lineCount(s, len)
static void addVariable(yyscan_t yyscanner)
405
406 {NEWLINE}+ {
408 }
409
410 {TRIDOUBLEQUOTE} {
412 BEGIN(TripleComment);
413 }
static void initTriDoubleQuoteBlock(yyscan_t yyscanner)
414
415 {TRISINGLEQUOTE} {
417 BEGIN(TripleComment);
418 }
static void initTriSingleQuoteBlock(yyscan_t yyscanner)
419
420 {B}{STARTDOCSYMS}/[^#] {
422 yyextra->packageCommentAllowed =
FALSE;
424 BEGIN(SpecialComment);
425 }
426 [(] {
427 yyextra->searchCount++;
428 }
429 [)] {
430 if (yyextra->searchCount>0)
431 {
432 yyextra->searchCount--;
433 }
434 }
435 "=" {
436 yyextra->current->doc.clear();
437 yyextra->current->brief.clear();
438 }
439 {IDENTIFIER} {
440 }
441 [^\n] {
442
443
444
445 }
static void initSpecialBlock(yyscan_t yyscanner)
446}
447
448<FromMod>{
449 "." {
450 }
451 {IDENTIFIER}({B}"."{B}{IDENTIFIER})* {
452 yyextra->packageName=yytext;
453 }
454 "import"{B} {
455 BEGIN(FromModItem);
456 }
457 \n {
460 }
461 {B} {
462 }
463 . {
464 unput(*yytext);
466 }
static void incLineNr(yyscan_t yyscanner)
467}
468
469<FromModItem>{
470 "*" {
473 }
474 {IDENTIFIER}/{B}","{B} {
476 }
477 {IDENTIFIER}/{B}")" {
479 }
480 {IDENTIFIER} {
482 if (!yyextra->importTuple)
483 {
485 }
486 }
487 \n {
489 if (!yyextra->importTuple)
490 {
492 }
493 }
494 {B} {
495 }
496 "(" {
497 yyextra->importTuple=
TRUE;
498 }
499 ")" {
500 yyextra->importTuple=
FALSE;
502 }
503 "," {
504 }
505 "\\"{B}\n {
507 }
508 . {
509 unput(*yytext);
511 }
static void addFrom(yyscan_t yyscanner, bool all)
512}
513
514<Import>{
515 {IDENTIFIER}({B}"."{B}{IDENTIFIER})* {
517 yyextra->current->fileName = yyextra->fileName;
518
519 yyextra->current->section=EntryType::makeUsingDecl();
520 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
523 }
524 \n {
527 }
528 {B} {
529 }
530 . {
531 unput(*yytext);
533 }
534}
535
536<SearchMemVars>{
537 ("cls"|"self")"."{IDENTIFIER}/{B}[,)] {
538 const char *s = strchr(yytext,'.'); s++;
539 DBG_CTX((stderr,
"Found instance method variable %s in %s at %d\n",s,
qPrint(yyextra->current_root->name.data(),yyextra->yyLineNr)));
542 }
543 ("cls"|"self")"."{IDENTIFIER}/{B}"=" {
544 const char *s = strchr(yytext,'.'); s++;
545 DBG_CTX((stderr,
"Found instance method variable %s in %s at %d\n",s,
qPrint(yyextra->current_root->name.data(),yyextra->yyLineNr)));
547 BEGIN( SearchSkipValue );
548 }
549 ("cls"|"self")"."{IDENTIFIER}/{B}":" {
550 const char *s = strchr(yytext,'.'); s++;
551 DBG_CTX((stderr,
"Found instance method variable %s in %s at %d\n",s,
qPrint(yyextra->current_root->name.data(),yyextra->yyLineNr)));
553 BEGIN(TypeHint);
554 }
555 {TRIDOUBLEQUOTE} {
557 BEGIN(TripleComment);
558 }
static void docVariable(yyscan_t yyscanner, const char *s)
559
560 {TRISINGLEQUOTE} {
562 BEGIN(TripleComment);
563 }
564
565 {STARTDOCSYMS}/[^#] {
567 BEGIN(SpecialComment);
568 }
569 {POUNDCOMMENT} {
570 }
571 "'" {
572 yyextra->stringContext=YY_START;
573 yyextra->copyString=nullptr;
574 BEGIN( SingleQuoteString );
575 }
576 "\"" {
577 yyextra->stringContext=YY_START;
578 yyextra->copyString=nullptr;
579 BEGIN( DoubleQuoteString );
580 }
582 "=" {
583 yyextra->current->doc.clear();
584 yyextra->current->brief.clear();
585 unput(*yytext);
586 BEGIN( SearchSkipValue );
587 }
588 {IDENTIFIER}
589 [^'"\.#a-z_A-Z=\n]+ // other uninteresting stuff
590 . // anything else
591}
592
593<TypeHint>{
594 ":" {
595 yyextra->braceCount=0;
596 }
597 "("|"["|"{" {
598 yyextra->current->type+=*yytext;
599 yyextra->braceCount++;
600 }
601 ")"|"]"|"}" {
602 yyextra->current->type+=*yytext;
603 yyextra->braceCount--;
604 }
605 "'" {
606 yyextra->stringContext=YY_START;
607 yyextra->copyString=nullptr;
608 BEGIN( SingleQuoteString );
609 }
610 "\"" {
611 yyextra->stringContext=YY_START;
612 yyextra->copyString=nullptr;
613 BEGIN( DoubleQuoteString );
614 }
615 "=" {
616 if (yyextra->braceCount==0)
617 {
618 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
619 unput(*yytext);
620 BEGIN(SearchSkipValue);
621 }
622 else
623 {
624 yyextra->current->type+=*yytext;
625 }
626 }
627 \n {
628 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
631 BEGIN(SearchMemVars);
632 }
633 "\\\n" {
634 yyextra->current->type+=' ';
636 }
637 . {
638 yyextra->current->type+=*yytext;
639 }
640}
641
642<SearchSkipValue,VariableDec>{
643 "=" {
644
645 yyextra->startInit =
TRUE;
646 yyextra->current->initializer.str(yytext);
647 yyextra->current->initializer << " ";
648 }
649 {B} {
650 yyextra->current->initializer << yytext;
651 }
652
653 {INTNUMBER} {
654 if (yyextra->current->type.isEmpty()) yyextra->current->type = "int";
655 yyextra->current->initializer << yytext;
656 }
657 {FLOATNUMBER} {
658 if (yyextra->current->type.isEmpty()) yyextra->current->type = "float";
659 yyextra->current->initializer << yytext;
660 }
661 {BOOL} {
662 if (yyextra->current->type.isEmpty()) yyextra->current->type = "bool";
663 yyextra->current->initializer << yytext;
664 }
665 {STRINGPREFIX}?"'" {
666 if (yyextra->current->type.isEmpty()) yyextra->current->type = "str";
667 yyextra->current->initializer << yytext;
668 yyextra->copyString=&yyextra->current->initializer;
669 yyextra->stringContext=YY_START;
670 BEGIN( SingleQuoteString );
671 }
672 {STRINGPREFIX}?"\"" {
673 if (yyextra->current->type.isEmpty()) yyextra->current->type = "str";
674 yyextra->current->initializer << yytext;
675 yyextra->copyString=&yyextra->current->initializer;
676 yyextra->stringContext=YY_START;
677 BEGIN( DoubleQuoteString );
678 }
679 {TRIDOUBLEQUOTE} {
680 if (yyextra->current->type.isEmpty()) yyextra->current->type = "str";
681 yyextra->current->initializer << yytext;
682 yyextra->doubleQuote=
TRUE;
683 yyextra->copyString=&yyextra->current->initializer;
684 yyextra->stringContext=YY_START;
685 BEGIN(TripleString);
686 }
687
688 {TRISINGLEQUOTE} {
689 if (yyextra->current->type.isEmpty()) yyextra->current->type = "str";
690 yyextra->current->initializer << yytext;
691 yyextra->doubleQuote=
FALSE;
692 yyextra->copyString=&yyextra->current->initializer;
693 yyextra->stringContext=YY_START;
694 BEGIN(TripleString);
695 }
696 "(" {
698 {
699 yyextra->current->type = "tuple";
700 }
701 yyextra->current->initializer << *yytext;
702 yyextra->atomStart='(';
703 yyextra->atomEnd=')';
704 yyextra->atomCount=1;
705 yyextra->atomContext=YY_START;
706 BEGIN( VariableAtom );
707 }
708 "[" {
709 if (yyextra->startInit) yyextra->current->type = "list";
710 yyextra->current->initializer << *yytext;
711 yyextra->atomStart='[';
712 yyextra->atomEnd=']';
713 yyextra->atomCount=1;
714 yyextra->atomContext=YY_START;
715 BEGIN( VariableAtom );
716 }
717 "{" {
718 if (yyextra->startInit) yyextra->current->type = "dict";
719 yyextra->current->initializer << *yytext;
720 yyextra->atomStart='{';
721 yyextra->atomEnd='}';
722 yyextra->atomCount=1;
723 yyextra->atomContext=YY_START;
724 BEGIN( VariableAtom );
725 }
726 "\\\n" {
727 yyextra->current->initializer << yytext;
729 }
730 {IDENTIFIER} {
731
732 if (yyextra->current->type.isEmpty())
733 {
734 for (const auto &child : yyextra->current_root->children())
735 {
736 if (child->name ==
QCString(yytext))
737 {
738 yyextra->current->type = child->type;
739 break;
740 }
741 }
742 }
743 yyextra->startInit =
FALSE;
744 yyextra->current->initializer << yytext;
745 }
746 . {
747 yyextra->startInit =
FALSE;
748 yyextra->current->initializer << *yytext;
749 }
750}
751<SearchSkipValue>{
752 {STARTDOCSYMS}/[^#] {
754 BEGIN(SpecialComment);
755 }
756 {POUNDCOMMENT} {
757 }
760 BEGIN(SearchMemVars);
761 }
762}
763
764<FunctionBody>{
768 {
771
773 }
774 else
775 {
777 yyextra->current->program << yytext;
778 }
779 }
780 \n{B}/"##" {
782 {
785
787 }
788 else
789 {
791 yyextra->current->program << yytext;
792 }
793 }
794 <<EOF>> {
797 }
798 ^{BB}/\n {
799 yyextra->current->program << yytext;
800 }
801 ^{BB} {
802 yyextra->current->program << yytext;
804 if (yyextra->curIndent<=yyextra->indent)
805
806 {
809 }
810 }
811 "'" {
812 yyextra->current->program << yytext;
813 yyextra->stringContext=YY_START;
814 yyextra->specialBlock =
FALSE;
815 yyextra->copyString=&yyextra->current->program;
816 BEGIN( SingleQuoteString );
817 }
818 "\"" {
819 yyextra->current->program << yytext;
820 yyextra->stringContext=YY_START;
821 yyextra->specialBlock =
FALSE;
822 yyextra->copyString=&yyextra->current->program;
823 BEGIN( DoubleQuoteString );
824 }
825 [^ \t\n#'".]+ { // non-special stuff
826 yyextra->current->program << yytext;
827 yyextra->specialBlock = FALSE;
828 }
829 ^{POUNDCOMMENT} { // normal comment
830 yyextra->current->program << yytext;
831 }
832 "#".* { // comment half way
833 yyextra->current->program << yytext;
834 }
835 {NEWLINE} {
836 incLineNr(yyscanner);
837 yyextra->current->program << yytext;
838 }
839 . { // any character
840 yyextra->current->program << *yytext;
841 yyextra->specialBlock = FALSE;
842 }
const int DIGIT
RegularExpression Id.
const int LETTER
RegularExpression Id.
static void endOfDef(yyscan_t yyscanner, int correction=0)
#define unput_string(yytext, yyleng)
843
844 {TRIDOUBLEQUOTE} {
845 yyextra->current->program << yytext;
847 BEGIN(TripleComment);
848 }
849
850 {TRISINGLEQUOTE} {
851 yyextra->current->program << yytext;
853 BEGIN(TripleComment);
854 }
855
856}
857
858<FunctionDec>{
859 {IDENTIFIER} {
860
861 yyextra->current->name = yytext;
862 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
864 }
865 {B}":"{B} {
866 yyextra->specialBlock =
TRUE;
867 yyextra->bodyEntry = yyextra->current;
868 yyextra->current->bodyLine = yyextra->yyLineNr;
869 BEGIN(FunctionBody);
870 }
static void newFunction(yyscan_t yyscanner)
871
872 "->" {
873 yyextra->defVal.str(std::string());
874 yyextra->braceCount = 0;
875 BEGIN(FunctionTypeAnnotation);
876 }
877 {B}"(" {
878 yyextra->funcParamsEnd =
FALSE;
879 yyextra->current->bodyLine = yyextra->yyLineNr;
880 BEGIN(FunctionParams);
881 }
882 ")" {
883 if (yyextra->current->argList.empty())
884 {
885 yyextra->current->argList.setNoParameters(
TRUE);
886 }
888 yyextra->funcParamsEnd =
TRUE;
889 }
QCString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
890}
891
892<FunctionParams>{
893 {BB} {
894 }
895
896 "," {
897 if (!yyextra->argType.isEmpty())
898 {
901 a.
type = yyextra->argType;
902 yyextra->current->argList.push_back(a);
903 yyextra->argType = "";
904 }
905 }
This class contains the information about the argument of a function or template.
906
907 [\*]+ {
908 yyextra->argType = yytext;
909 }
910 {IDENTIFIER} {
914 a.
type = yyextra->argType;
915 yyextra->current->argList.push_back(a);
916 yyextra->argType = "";
917 }
918 "=" {
919
920
921 yyextra->defVal.str(std::string());
922 yyextra->braceCount = 0;
923 BEGIN(FunctionParamDefVal);
924 }
925 ")" {
926 if (!yyextra->argType.isEmpty())
927 {
930 a.
type = yyextra->argType;
931 yyextra->current->argList.push_back(a);
932 yyextra->argType = "";
933 }
934 unput(*yytext);
935 BEGIN(FunctionDec);
936 }
937 ":"{B} {
938 yyextra->defVal.str(std::string());
939 yyextra->braceCount = 0;
940 BEGIN(FunctionAnnotation);
941 }
942 {POUNDCOMMENT} {
943 }
944 {PARAMNONEMPTY} {
945 }
946
947}
948
949<FunctionTypeAnnotation>{
950 "{" |
951 "[" |
952 "(" {
953 ++yyextra->braceCount;
954 yyextra->defVal << *yytext;
955 }
956 "}" |
957 "]" |
958 ")" {
959 --yyextra->braceCount;
960 yyextra->defVal << *yytext;
961 }
962 ":" {
963 if (yyextra->braceCount == 0)
964 {
965 yyextra->current->type = yyextra->defVal.str();
966 unput(*yytext);
967 BEGIN(FunctionDec);
968 }
969 else
970 yyextra->defVal << *yytext;
971 }
972 "'" {
973 yyextra->defVal << *yytext;
974 yyextra->copyString=&yyextra->defVal;
975 yyextra->stringContext=FunctionTypeAnnotation;
976 BEGIN(SingleQuoteString);
977 }
978 "\"" {
979 yyextra->defVal << *yytext;
980 yyextra->copyString=&yyextra->defVal;
981 yyextra->stringContext=FunctionTypeAnnotation;
982 BEGIN(DoubleQuoteString);
983 }
984 \n {
985 yyextra->defVal << *yytext;
987 }
988 . {
989 yyextra->defVal << *yytext;
990 }
991}
992
993<FunctionAnnotation>{
994 "{" |
995 "[" |
996 "(" {
997 ++yyextra->braceCount;
998 yyextra->defVal << *yytext;
999 }
1000 "}" |
1001 "]" {
1002 --yyextra->braceCount;
1003 yyextra->defVal << *yytext;
1004 }
1005 ")" |
1006 "=" |
1007 "," {
1008 if (yyextra->braceCount == 0)
1009 {
1010 if (!yyextra->current->argList.empty())
1011 yyextra->current->argList.back().type += yyextra->defVal.str();
1012 if (*yytext != ',')
1013 unput(*yytext);
1014 BEGIN(FunctionParams);
1015 }
1016 else
1017 {
1018 if (*yytext == ')')
1019 --yyextra->braceCount;
1020 yyextra->defVal << *yytext;
1021 }
1022 }
1023 "'" {
1024 yyextra->defVal << *yytext;
1025 yyextra->copyString=&yyextra->defVal;
1026 yyextra->stringContext=FunctionAnnotation;
1027 BEGIN(SingleQuoteString);
1028 }
1029 "\"" {
1030 yyextra->defVal << *yytext;
1031 yyextra->copyString=&yyextra->defVal;
1032 yyextra->stringContext=FunctionAnnotation;
1033 BEGIN(DoubleQuoteString);
1034 }
1035 \n {
1036 yyextra->defVal << *yytext;
1038 }
1039 . {
1040 yyextra->defVal << *yytext;
1041 }
1042}
1043
1044<FunctionParamDefVal>{
1045 "{" |
1046 "[" |
1047 "(" {
1048 ++yyextra->braceCount;
1049 yyextra->defVal << *yytext;
1050 }
1051 "}" |
1052 "]" {
1053 --yyextra->braceCount;
1054 yyextra->defVal << *yytext;
1055 }
1056 ")" |
1057 "," {
1058 if (yyextra->braceCount == 0)
1059 {
1060 if (!yyextra->current->argList.empty())
1062 if (*yytext == ')')
1063 unput(*yytext);
1064 BEGIN(FunctionParams);
1065 }
1066 else
1067 {
1068 if (*yytext == ')')
1069 --yyextra->braceCount;
1070 yyextra->defVal << *yytext;
1071 }
1072 }
1073
1074 "'" {
1075 yyextra->defVal << *yytext;
1076 yyextra->copyString=&yyextra->defVal;
1077 yyextra->stringContext=FunctionParamDefVal;
1078 BEGIN( SingleQuoteString );
1079 }
1080 "\"" {
1081 yyextra->defVal << *yytext;
1082 yyextra->copyString=&yyextra->defVal;
1083 yyextra->stringContext=FunctionParamDefVal;
1084 BEGIN( DoubleQuoteString );
1085 }
1086 \n {
1087 yyextra->defVal << *yytext;
1089 }
1090 . {
1091 yyextra->defVal << *yytext;
1092 }
1093}
1094
1095
1096<ClassBody>{
1097 \n/{IDENTIFIER}{BB} {
1099 {
1100 int i;
1101 for (i=(int)yyleng-1;i>=0;i--)
1102 {
1103 unput(yytext[i]);
1104 }
1106
1108 }
1109 else
1110 {
1112 yyextra->current->program << yytext;
1113 }
1114 }
1115 \n/"##"[^#] {
1117 {
1118 int i;
1119 for (i=(int)yyleng-1;i>=0;i--)
1120 {
1121 unput(yytext[i]);
1122 }
1124
1126 }
1127 else
1128 {
1130 yyextra->current->program << yytext;
1131 }
1132 }
1133 ^{BB}/\n {
1134 yyextra->current->program << yytext;
1135 }
1136 <<EOF>> {
1139 }
1140 ^{BB} {
1142 DBG_CTX((stderr,
"yyextra->curIndent=%d yyextra->indent=%d\n",yyextra->curIndent,yyextra->indent));
1143 if (yyextra->curIndent<=yyextra->indent)
1144
1145 {
1147 yyextra->indent=yyextra->curIndent;
1148
1149
1150
1152 }
1153 else
1154 {
1155 yyextra->current->program << yytext;
1156 }
1157 }
1158 "'" {
1159 yyextra->current->program << *yytext;
1160 yyextra->stringContext=YY_START;
1161 yyextra->specialBlock =
FALSE;
1162 yyextra->copyString=&yyextra->current->program;
1163 BEGIN( SingleQuoteString );
1164 }
1165 "\"" {
1166 yyextra->current->program << *yytext;
1167 yyextra->stringContext=YY_START;
1168 yyextra->specialBlock =
FALSE;
1169 yyextra->copyString=&yyextra->current->program;
1170 BEGIN( DoubleQuoteString );
1171 }
1172 [^ \t\n#'"]+ { // non-special stuff
1173 yyextra->current->program << yytext;
1174 yyextra->specialBlock = FALSE;
1175 //yyextra->hideClassDocs = FALSE;
1176 }
1177 {NEWLINE} {
1178 yyextra->current->program << *yytext;
1179 incLineNr(yyscanner);
1180 }
1181 {POUNDCOMMENT} { // normal comment
1182 yyextra->current->program << yytext;
1183 }
1184 . { // any character
1185 yyextra->specialBlock = FALSE;
1186 yyextra->current->program << *yytext;
1187 }
1188 {TRIDOUBLEQUOTE} { // start of a comment block
1189 //if (!yyextra->hideClassDocs)
1190 yyextra->current->program << yytext;
1191 initTriDoubleQuoteBlock(yyscanner);
1192 BEGIN(TripleComment);
1193 }
1194
1195 {TRISINGLEQUOTE} {
1196
1197 yyextra->current->program << yytext;
1199 BEGIN(TripleComment);
1200 }
1201}
1202
1203<ClassDec>{IDENTIFIER} {
1204 if (yyextra->current->type.isEmpty())
1205 {
1206 yyextra->current->type = "class";
1207 }
1208
1209 yyextra->current->section = EntryType::makeClass();
1210 yyextra->current->name = yytext;
1211
1213
1214
1215 if (yyextra->current_root->section.isScope())
1216 {
1217
1218 yyextra->current->name.prepend(yyextra->current_root->name+"::");
1219 }
1220
1221 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
1222 yyextra->current->fileName = yyextra->fileName;
1223 yyextra->docBlockContext = YY_START;
1224 yyextra->docBlockInBody =
FALSE;
1225 yyextra->docBlockJavaStyle =
FALSE;
1226 yyextra->docBlock.clear();
1227
1228 BEGIN(ClassInheritance);
1229 }
1230
1231<ClassInheritance>{
1232 ({BB}|[\(,\)]) {
1233 }
1234
1235 ":" {
1236 yyextra->specialBlock =
TRUE;
1237 yyextra->current->bodyLine = yyextra->yyLineNr;
1238 yyextra->current->program.str(std::string());
1239 BEGIN(ClassCaptureIndent);
1240 }
1241
1242 {SCOPE} {
1243 yyextra->current->extends.emplace_back(
1245 );
1246
1247 }
1248 "'" {
1249 yyextra->stringContext=YY_START;
1250 BEGIN( SingleQuoteStringIgnore );
1251 }
1252 "\"" {
1253 yyextra->stringContext=YY_START;
1254 BEGIN( DoubleQuoteStringIgnore );
1255 }
1256}
1257
1258<SingleQuoteStringIgnore>{
1259 "'" {
1260 BEGIN(yyextra->stringContext);
1261 }
1262 . { }
1263}
1264<DoubleQuoteStringIgnore>{
1265 "\"" {
1266 BEGIN(yyextra->stringContext);
1267 }
1268 . { }
1269}
1270
1271<ClassCaptureIndent>{
1272 "\n"|({BB}"\n") {
1273
1275 yyextra->current->program << yytext;
1276 }
1277
1278 {TRIDOUBLEQUOTE} {
1280 yyextra->current->program << yytext;
1281 BEGIN(TripleComment);
1282 }
1283 {TRISINGLEQUOTE} {
1285 yyextra->current->program << yytext;
1286 BEGIN(TripleComment);
1287 }
1288 {STARTDOCSYMS}[#]* {
1290 BEGIN(SpecialComment);
1291 }
1292 {POUNDCOMMENT} {
1293 }
1294 ^{BB} {
1295 yyextra->current->program << yytext;
1296
1298 yyextra->bodyEntry = yyextra->current;
1299 DBG_CTX((stderr,
"setting indent %d\n",yyextra->curIndent));
1300
1301
1302 BEGIN(ClassBody);
1303 }
1304
1305 ""/({NONEMPTY}|{EXPCHAR}) {
1306
1307
1309 yyextra->current->program << yytext;
1310
1311
1313 }
1314}
1315
1316
1317<VariableDec>{
1318 ":"{B}{IDENTIFIER} {
1319 yyextra->startInit =
FALSE;
1320 yyextra->current->type =
substitute(yytext,
":",
"");
1321 }
1322 {STARTDOCSYMS}"<"/.* {
1324 yyextra->packageCommentAllowed =
FALSE;
1326 yyextra->docBlockContext = VariableEnd;
1327 BEGIN(SpecialComment);
1328 }
1329 "#".* {
1330 BEGIN( VariableEnd );
1331 }
1332 \n {
1333 unput('\n');
1334 BEGIN( VariableEnd );
1335 }
1336}
1337
1338<VariableAtom>{
1339 [\(\[\{] {
1340 yyextra->current->initializer << *yytext;
1341 if (yyextra->atomStart==*yytext)
1342 {
1343 yyextra->atomCount++;
1344 }
1345 }
1346 [\)\]\}] {
1347 yyextra->current->initializer << *yytext;
1348 if (yyextra->atomEnd==*yytext)
1349 {
1350 yyextra->atomCount--;
1351 }
1352 if (yyextra->atomCount==0)
1353 {
1354 yyextra->startInit =
FALSE;
1355 BEGIN(yyextra->atomContext);
1356 }
1357 }
1358 {TRIDOUBLEQUOTE} {
1359 yyextra->specialBlock =
FALSE;
1360 yyextra->current->program << yytext;
1362 BEGIN(TripleComment);
1363 }
1364
1365 {TRISINGLEQUOTE} {
1366 yyextra->specialBlock =
FALSE;
1367 yyextra->current->program << yytext;
1369 BEGIN(TripleComment);
1370 }
1371 "'" {
1372 yyextra->stringContext=YY_START;
1373 yyextra->current->initializer << "'";
1374 yyextra->copyString=&yyextra->current->initializer;
1375 BEGIN( SingleQuoteString );
1376 }
1377 "\"" {
1378 yyextra->stringContext=YY_START;
1379 yyextra->current->initializer << "\"";
1380 yyextra->copyString=&yyextra->current->initializer;
1381 BEGIN( DoubleQuoteString );
1382 }
1383 {IDENTIFIER} {
1384 yyextra->current->initializer << yytext;
1385 }
1386 . {
1387 yyextra->current->initializer << *yytext;
1388 }
1389 \n {
1390 yyextra->current->initializer << *yytext;
1392 }
1393
1394}
1395
1396<VariableEnd>{
1397 \n {
1400 {
1402 }
1404 }
1405 . {
1406 unput(*yytext);
1409 }
1411 }
static void newVariable(yyscan_t yyscanner)
std::string_view stripWhiteSpace(std::string_view s)
Given a string view s, returns a new, narrower view on that string, skipping over any leading or trai...
1412}
1413
1414<TripleComment>{
1415 {ENDTRIDOUBLEQUOTE} |
1416 {ENDTRISINGLEQUOTE} {
1417
1418 if (yyextra->doubleQuote==(yytext[0]=='"'))
1419 {
1420 if (yyextra->specialBlock)
1421 {
1422 QCString actualDoc=yyextra->docBlock;
1423 if (!yyextra->docBlockSpecial)
1424 {
1426 {
1428 actualDoc.
prepend(
"@iverbatim\n");
1429 actualDoc.
append(
"@endiverbatim ");
1430 }
1431 }
1432
1434 }
1435 else if (yyextra->packageCommentAllowed)
1436 {
1437 QCString actualDoc=yyextra->docBlock;
1438 if (!yyextra->docBlockSpecial)
1439 {
1441 {
1443 actualDoc.
prepend(
"@iverbatim\n");
1444 actualDoc.
append(
"@endiverbatim ");
1445 }
1446 }
1447 if (yyextra->moduleScope.startsWith("__") && yyextra->moduleScope.endsWith("__"))
1448 {
1449 actualDoc.
prepend(
"\\namespace \\"+yyextra->moduleScope+
" ");
1450 }
1451 else
1452 {
1453 actualDoc.
prepend(
"\\namespace "+yyextra->moduleScope+
" ");
1454 }
1456 }
1457 if ((yyextra->docBlockContext==ClassBody ) ||
1458 yyextra->docBlockContext==FunctionBody)
1459 {
1460 yyextra->current->program << yyextra->docBlock;
1461 yyextra->current->program << yytext;
1462 }
1463
1464
1465
1466
1467
1468 BEGIN(yyextra->docBlockContext);
1469 }
1470 else
1471 {
1472 yyextra->docBlock += yytext;
1473 }
1474 yyextra->packageCommentAllowed =
FALSE;
1475 }
QCString & prepend(const char *s)
QCString & append(char c)
static void handleCommentBlock(yyscan_t yyscanner, const QCString &doc, bool brief)
void stripIndentationVerbatim(QCString &doc, const int indentationLevel)
1476
1477
1478 ^{BB} {
1479 if (yyextra->docBlockSpecial && yyleng >= yyextra->curIndent)
1480 yyextra->docBlock += yytext + yyextra->curIndent;
1481 else
1482 yyextra->docBlock += yytext;
1483 }
1484 [^"'\n \t\\@]+ {
1485 yyextra->docBlock += yytext;
1486 }
1487 \n {
1488 incLineNr(yyscanner);
1489 yyextra->docBlock += yytext;
1490 }
1491 {CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
1492 yyextra->fileName = &yytext[6];
1493 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1494 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
1495 yyextra->docBlock+=yytext;
1496 }
1497 {CMD}"ifile"{B}+{FILEMASK} {
1498 yyextra->fileName = &yytext[6];
1499 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1500 yyextra->docBlock+=yytext;
1501 }
1502 {CMD}"iline"{LINENR}/[\n\.] |
1503 {CMD}"iline"{LINENR}{B} {
1504 bool ok = false;
1506 if (!ok)
1507 {
1508 warn(yyextra->fileName,yyextra->yyLineNr,
"Invalid line number '%s' for iline command",yytext);
1509 }
1510 else
1511 {
1512 yyextra->yyLineNr = nr;
1513 }
1514 yyextra->docBlock+=yytext;
1515 }
1516 ({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
1517 yyextra->docBlock+=yytext;
1518 }
1519 \\. {
1520 yyextra->docBlock += yytext;
1521 }
1522 . {
1523 yyextra->docBlock += yytext;
1524 }
int toInt(bool *ok=nullptr, int base=10) const
1525}
1526
1527<SpecialComment>{
1528 ^{B}"#"("#")* {
1529 }
1530 \n/{B}"#" {
1531 yyextra->docBlock+='\n';
1532 yyextra->docBrief =
FALSE;
1534 }
1535 {CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
1536 yyextra->fileName = &yytext[6];
1537 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1538 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
1539 yyextra->docBlock+=yytext;
1540 }
1541 {CMD}"ifile"{B}+{FILEMASK} {
1542 yyextra->fileName = &yytext[6];
1543 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1544 yyextra->docBlock+=yytext;
1545 }
1546 {CMD}"iline"{LINENR}/[\n\.] |
1547 {CMD}"iline"{LINENR}{B} {
1548 bool ok = false;
1550 if (!ok)
1551 {
1552 warn(yyextra->fileName,yyextra->yyLineNr,
"Invalid line number '%s' for iline command",yytext);
1553 }
1554 else
1555 {
1556 yyextra->yyLineNr = nr;
1557 }
1558 yyextra->docBlock+=yytext;
1559 }
1560 ({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
1561 yyextra->docBlock+=yytext;
1562 }
1563 "\\ilinebr "{B}* {
1565 int extraSpaces = std::max(0,static_cast<int>(yyleng-9-yyextra->curIndent-2));
1566 indent.
fill(
' ',extraSpaces);
1567
1568 yyextra->docBlock += "\\ilinebr ";
1569 yyextra->docBlock += indent;
1570 }
1571 [^#\\@\n]+ {
1572 yyextra->docBlock+=yytext;
1573 }
1574 \n {
1576 if (yyextra->docBlockContext == VariableEnd)
1577 {
1578 unput(*yytext);
1579 }
1580 else
1581 {
1583 }
1584 BEGIN(yyextra->docBlockContext);
1585 }
1586 . {
1587 yyextra->docBlock+=*yytext;
1588 }
void fill(char c, int len=-1)
Fills a string with a predefined character.
1589}
1590
1591<SingleQuoteString>{
1592 \\{B}\n {
1595 }
1596 \\. {
1598 }
1599 "\"\"\"" {
1601 }
1602 "'" {
1604 BEGIN(yyextra->stringContext);
1605 }
1606 [^"'\n\\]+ { // normal chars
1607 addToString(yyscanner,yytext);
1608 }
1609 . { // normal char
1610 addToString(yyscanner,yytext);
1611 }
static void addToString(yyscan_t yyscanner, const char *s)
1612}
1613
1614<DoubleQuoteString>{
1615 \\{B}\n {
1618 }
1619 \\. {
1621 }
1622 "'''" {
1624 }
1625 "\"" {
1627 BEGIN(yyextra->stringContext);
1628 }
1629 [^"'\n\\]+ { // normal chars
1630 addToString(yyscanner,yytext);
1631 }
1632 . { // normal char
1633 addToString(yyscanner,yytext);
1634 }
1635}
1636
1637<TripleString>{
1638 {ENDTRIDOUBLEQUOTE} |
1639 {ENDTRISINGLEQUOTE} {
1640 *yyextra->copyString << yytext;
1641 if (yyextra->doubleQuote==(yytext[0]=='"'))
1642 {
1643 BEGIN(yyextra->stringContext);
1644 }
1645 }
1646
1647
1648 ({LONGSTRINGBLOCK}) {
1650 *yyextra->copyString << yytext;
1651 }
1652 \n {
1654 *yyextra->copyString << yytext;
1655 }
1656 . {
1657 *yyextra->copyString << *yytext;
1658 }
1659}
1660
1661<Decorator>{
1662 {TRIDOUBLEQUOTE} {
1663 yyextra->doubleQuote=
TRUE;
1664 yyextra->decoratorCommentStr.str(std::string());
1665 yyextra->copyString=&yyextra->decoratorCommentStr;
1666 yyextra->stringContext=YY_START;
1667 BEGIN(TripleString);
1668 }
1669
1670 {TRISINGLEQUOTE} {
1671 yyextra->doubleQuote=
FALSE;
1672 yyextra->decoratorCommentStr.str(std::string());
1673 yyextra->copyString=&yyextra->decoratorCommentStr;
1674 yyextra->stringContext=YY_START;
1675 BEGIN(TripleString);
1676 }
1677 "'" {
1678 yyextra->stringContext=YY_START;
1679 yyextra->decoratorCommentStr.str(std::string());
1680 yyextra->copyString=&yyextra->decoratorCommentStr;
1681 BEGIN( SingleQuoteString );
1682 }
1683 "\"" {
1684 yyextra->stringContext=YY_START;
1685 yyextra->decoratorCommentStr.str(std::string());
1686 yyextra->copyString=&yyextra->decoratorCommentStr;
1687 BEGIN( DoubleQuoteString );
1688 }
1689 "(" {
1690 yyextra->decoratorRound++;
1691 }
1692 ")" {
1693 yyextra->decoratorRound--;
1694 if (!yyextra->decoratorRound) BEGIN(
Search );
1695 }
1696 \n {
1698 }
1699 . { }
1700}
1701
1702
1703
1704
1705<*>({NONEMPTY}|{EXPCHAR}|{BB}) { // This should go one character at a time.
1706
1707
1708
1709 }
1710 */
1711
1712<*>{NEWLINE} {
1713
1714
1715
1717 }
1718
1719<*>"'" {
1720
1721 }
1722
1723<*>. {
1724
1725
1726
1727 }
1728
1729
1730%%