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