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)
const char * qPrint(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 }
764 BEGIN(SearchMemVars);
765 }
766}
767
768<FunctionBody>{
772 {
775
777 }
778 else
779 {
781 yyextra->current->program << yytext;
782 }
783 }
784 \n{B}/"##" {
786 {
789
791 }
792 else
793 {
795 yyextra->current->program << yytext;
796 }
797 }
798 <<EOF>> {
801 }
802 ^{BB}/\n {
803 yyextra->current->program << yytext;
804 }
805 ^{BB} {
806 yyextra->current->program << yytext;
808 if (yyextra->curIndent<=yyextra->indent)
809
810 {
813 }
814 }
815 "'" {
816 yyextra->current->program << yytext;
817 yyextra->stringContext=YY_START;
818 yyextra->specialBlock =
FALSE;
819 yyextra->copyString=&yyextra->current->program;
820 BEGIN( SingleQuoteString );
821 }
822 "\"" {
823 yyextra->current->program << yytext;
824 yyextra->stringContext=YY_START;
825 yyextra->specialBlock =
FALSE;
826 yyextra->copyString=&yyextra->current->program;
827 BEGIN( DoubleQuoteString );
828 }
829 [^ \t\n#'".]+ { // non-special stuff
830 yyextra->current->program << yytext;
831 yyextra->specialBlock = FALSE;
832 }
833 ^{POUNDCOMMENT} { // normal comment
834 yyextra->current->program << yytext;
835 }
836 "#".* { // comment half way
837 yyextra->current->program << yytext;
838 }
839 {NEWLINE} {
840 incLineNr(yyscanner);
841 yyextra->current->program << yytext;
842 }
843 . { // any character
844 yyextra->current->program << *yytext;
845 yyextra->specialBlock = FALSE;
846 }
const int DIGIT
RegularExpression Id.
const int LETTER
RegularExpression Id.
static void endOfDef(yyscan_t yyscanner, int correction=0)
#define unput_string(yytext, yyleng)
847
848 {TRIDOUBLEQUOTE} {
849 yyextra->current->program << yytext;
851 BEGIN(TripleComment);
852 }
853
854 {TRISINGLEQUOTE} {
855 yyextra->current->program << yytext;
857 BEGIN(TripleComment);
858 }
859
860}
861
862<FunctionDec>{
863 {IDENTIFIER} {
864
865 yyextra->current->name = yytext;
866 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
868 }
869 {B}":"{B} {
870 yyextra->specialBlock =
TRUE;
871 yyextra->bodyEntry = yyextra->current;
872 yyextra->current->bodyLine = yyextra->yyLineNr;
873 BEGIN(FunctionBody);
874 }
static void newFunction(yyscan_t yyscanner)
875
876 "->" {
877 yyextra->defVal.str(std::string());
878 yyextra->braceCount = 0;
879 BEGIN(FunctionTypeAnnotation);
880 }
881 {B}"(" {
882 yyextra->funcParamsEnd =
FALSE;
883 yyextra->current->bodyLine = yyextra->yyLineNr;
884 BEGIN(FunctionParams);
885 }
886 ")" {
887 if (yyextra->current->argList.empty())
888 {
889 yyextra->current->argList.setNoParameters(
TRUE);
890 }
892 yyextra->funcParamsEnd =
TRUE;
893 }
QCString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
894}
895
896<FunctionParams>{
897 {BB} {
898 }
899
900 "," {
901 if (!yyextra->argType.isEmpty())
902 {
905 a.
type = yyextra->argType;
906 yyextra->current->argList.push_back(a);
907 yyextra->argType = "";
908 }
909 }
This class contains the information about the argument of a function or template.
910
911 [\*]+ {
912 yyextra->argType = yytext;
913 }
914 {IDENTIFIER} {
918 a.
type = yyextra->argType;
919 yyextra->current->argList.push_back(a);
920 yyextra->argType = "";
921 }
922 "=" {
923
924
925 yyextra->defVal.str(std::string());
926 yyextra->braceCount = 0;
927 BEGIN(FunctionParamDefVal);
928 }
929 ")" {
930 if (!yyextra->argType.isEmpty())
931 {
934 a.
type = yyextra->argType;
935 yyextra->current->argList.push_back(a);
936 yyextra->argType = "";
937 }
938 unput(*yytext);
939 BEGIN(FunctionDec);
940 }
941 ":"{B} {
942 yyextra->defVal.str(std::string());
943 yyextra->braceCount = 0;
944 BEGIN(FunctionAnnotation);
945 }
946 {POUNDCOMMENT} {
947 }
948 {PARAMNONEMPTY} {
949 }
950
951}
952
953<FunctionTypeAnnotation>{
954 "{" |
955 "[" |
956 "(" {
957 ++yyextra->braceCount;
958 yyextra->defVal << *yytext;
959 }
960 "}" |
961 "]" |
962 ")" {
963 --yyextra->braceCount;
964 yyextra->defVal << *yytext;
965 }
966 ":" {
967 if (yyextra->braceCount == 0)
968 {
969 yyextra->current->type = yyextra->defVal.str();
970 unput(*yytext);
971 BEGIN(FunctionDec);
972 }
973 else
974 yyextra->defVal << *yytext;
975 }
976 "'" {
977 yyextra->defVal << *yytext;
978 yyextra->copyString=&yyextra->defVal;
979 yyextra->stringContext=FunctionTypeAnnotation;
980 BEGIN(SingleQuoteString);
981 }
982 "\"" {
983 yyextra->defVal << *yytext;
984 yyextra->copyString=&yyextra->defVal;
985 yyextra->stringContext=FunctionTypeAnnotation;
986 BEGIN(DoubleQuoteString);
987 }
988 \n {
989 yyextra->defVal << *yytext;
991 }
992 . {
993 yyextra->defVal << *yytext;
994 }
995}
996
997<FunctionAnnotation>{
998 "{" |
999 "[" |
1000 "(" {
1001 ++yyextra->braceCount;
1002 yyextra->defVal << *yytext;
1003 }
1004 "}" |
1005 "]" {
1006 --yyextra->braceCount;
1007 yyextra->defVal << *yytext;
1008 }
1009 ")" |
1010 "=" |
1011 "," {
1012 if (yyextra->braceCount == 0)
1013 {
1014 if (!yyextra->current->argList.empty())
1015 yyextra->current->argList.back().type += yyextra->defVal.str();
1016 if (*yytext != ',')
1017 unput(*yytext);
1018 BEGIN(FunctionParams);
1019 }
1020 else
1021 {
1022 if (*yytext == ')')
1023 --yyextra->braceCount;
1024 yyextra->defVal << *yytext;
1025 }
1026 }
1027 "'" {
1028 yyextra->defVal << *yytext;
1029 yyextra->copyString=&yyextra->defVal;
1030 yyextra->stringContext=FunctionAnnotation;
1031 BEGIN(SingleQuoteString);
1032 }
1033 "\"" {
1034 yyextra->defVal << *yytext;
1035 yyextra->copyString=&yyextra->defVal;
1036 yyextra->stringContext=FunctionAnnotation;
1037 BEGIN(DoubleQuoteString);
1038 }
1039 \n {
1040 yyextra->defVal << *yytext;
1042 }
1043 . {
1044 yyextra->defVal << *yytext;
1045 }
1046}
1047
1048<FunctionParamDefVal>{
1049 "{" |
1050 "[" |
1051 "(" {
1052 ++yyextra->braceCount;
1053 yyextra->defVal << *yytext;
1054 }
1055 "}" |
1056 "]" {
1057 --yyextra->braceCount;
1058 yyextra->defVal << *yytext;
1059 }
1060 ")" |
1061 "," {
1062 if (yyextra->braceCount == 0)
1063 {
1064 if (!yyextra->current->argList.empty())
1066 if (*yytext == ')')
1067 unput(*yytext);
1068 BEGIN(FunctionParams);
1069 }
1070 else
1071 {
1072 if (*yytext == ')')
1073 --yyextra->braceCount;
1074 yyextra->defVal << *yytext;
1075 }
1076 }
1077
1078 "'" {
1079 yyextra->defVal << *yytext;
1080 yyextra->copyString=&yyextra->defVal;
1081 yyextra->stringContext=FunctionParamDefVal;
1082 BEGIN( SingleQuoteString );
1083 }
1084 "\"" {
1085 yyextra->defVal << *yytext;
1086 yyextra->copyString=&yyextra->defVal;
1087 yyextra->stringContext=FunctionParamDefVal;
1088 BEGIN( DoubleQuoteString );
1089 }
1090 \n {
1091 yyextra->defVal << *yytext;
1093 }
1094 . {
1095 yyextra->defVal << *yytext;
1096 }
1097}
1098
1099
1100<ClassBody>{
1101 \n/{IDENTIFIER}{BB} {
1103 {
1104 int i;
1105 for (i=(int)yyleng-1;i>=0;i--)
1106 {
1107 unput(yytext[i]);
1108 }
1110
1112 }
1113 else
1114 {
1116 yyextra->current->program << yytext;
1117 }
1118 }
1119 \n/"##"[^#] {
1121 {
1122 int i;
1123 for (i=(int)yyleng-1;i>=0;i--)
1124 {
1125 unput(yytext[i]);
1126 }
1128
1130 }
1131 else
1132 {
1134 yyextra->current->program << yytext;
1135 }
1136 }
1137 ^{BB}/\n {
1138 yyextra->current->program << yytext;
1139 }
1140 <<EOF>> {
1143 }
1144 ^{BB} {
1146 DBG_CTX((stderr,
"yyextra->curIndent=%d yyextra->indent=%d\n",yyextra->curIndent,yyextra->indent));
1147 if (yyextra->curIndent<=yyextra->indent)
1148
1149 {
1151 yyextra->indent=yyextra->curIndent;
1152
1153
1154
1156 }
1157 else
1158 {
1159 yyextra->current->program << yytext;
1160 }
1161 }
1162 "'" {
1163 yyextra->current->program << *yytext;
1164 yyextra->stringContext=YY_START;
1165 yyextra->specialBlock =
FALSE;
1166 yyextra->copyString=&yyextra->current->program;
1167 BEGIN( SingleQuoteString );
1168 }
1169 "\"" {
1170 yyextra->current->program << *yytext;
1171 yyextra->stringContext=YY_START;
1172 yyextra->specialBlock =
FALSE;
1173 yyextra->copyString=&yyextra->current->program;
1174 BEGIN( DoubleQuoteString );
1175 }
1176 [^ \t\n#'"]+ { // non-special stuff
1177 yyextra->current->program << yytext;
1178 yyextra->specialBlock = FALSE;
1179 //yyextra->hideClassDocs = FALSE;
1180 }
1181 {NEWLINE} {
1182 yyextra->current->program << *yytext;
1183 incLineNr(yyscanner);
1184 }
1185 {POUNDCOMMENT} { // normal comment
1186 yyextra->current->program << yytext;
1187 }
1188 . { // any character
1189 yyextra->specialBlock = FALSE;
1190 yyextra->current->program << *yytext;
1191 }
1192 {TRIDOUBLEQUOTE} { // start of a comment block
1193 //if (!yyextra->hideClassDocs)
1194 yyextra->current->program << yytext;
1195 initTriDoubleQuoteBlock(yyscanner);
1196 BEGIN(TripleComment);
1197 }
1198
1199 {TRISINGLEQUOTE} {
1200
1201 yyextra->current->program << yytext;
1203 BEGIN(TripleComment);
1204 }
1205}
1206
1207<ClassDec>{IDENTIFIER} {
1208 if (yyextra->current->type.isEmpty())
1209 {
1210 yyextra->current->type = "class";
1211 }
1212
1213 yyextra->current->section = EntryType::makeClass();
1214 yyextra->current->name = yytext;
1215
1217
1218
1219 if (yyextra->current_root->section.isScope())
1220 {
1221
1222 yyextra->current->name.prepend(yyextra->current_root->name+"::");
1223 }
1224
1225 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
1226 yyextra->current->fileName = yyextra->fileName;
1227 yyextra->docBlockContext = YY_START;
1228 yyextra->docBlockInBody =
FALSE;
1229 yyextra->docBlockJavaStyle =
FALSE;
1230 yyextra->docBlock.clear();
1231
1232 BEGIN(ClassInheritance);
1233 }
1234
1235<ClassInheritance>{
1236 ({BB}|[\(,\)]) {
1237 }
1238
1239 ":" {
1240 yyextra->specialBlock =
TRUE;
1241 yyextra->current->bodyLine = yyextra->yyLineNr;
1242 yyextra->current->program.str(std::string());
1243 BEGIN(ClassCaptureIndent);
1244 }
1245
1246 {SCOPE} {
1247 yyextra->current->extends.emplace_back(
1249 );
1250
1251 }
1252 "'" {
1253 yyextra->stringContext=YY_START;
1254 BEGIN( SingleQuoteStringIgnore );
1255 }
1256 "\"" {
1257 yyextra->stringContext=YY_START;
1258 BEGIN( DoubleQuoteStringIgnore );
1259 }
1260}
1261
1262<SingleQuoteStringIgnore>{
1263 "'" {
1264 BEGIN(yyextra->stringContext);
1265 }
1266 . { }
1267}
1268<DoubleQuoteStringIgnore>{
1269 "\"" {
1270 BEGIN(yyextra->stringContext);
1271 }
1272 . { }
1273}
1274
1275<ClassCaptureIndent>{
1276 "\n"|({BB}"\n") {
1277
1279 yyextra->current->program << yytext;
1280 }
1281
1282 {TRIDOUBLEQUOTE} {
1284 yyextra->current->program << yytext;
1285 BEGIN(TripleComment);
1286 }
1287 {TRISINGLEQUOTE} {
1289 yyextra->current->program << yytext;
1290 BEGIN(TripleComment);
1291 }
1292 {STARTDOCSYMS}[#]* {
1294 BEGIN(SpecialComment);
1295 }
1296 {POUNDCOMMENT} {
1297 }
1298 ^{BB} {
1299 yyextra->current->program << yytext;
1300
1302 yyextra->bodyEntry = yyextra->current;
1303 DBG_CTX((stderr,
"setting indent %d\n",yyextra->curIndent));
1304
1305
1306 BEGIN(ClassBody);
1307 }
1308
1309 ""/({NONEMPTY}|{EXPCHAR}) {
1310
1311
1313 yyextra->current->program << yytext;
1314
1315
1317 }
1318}
1319
1320
1321<VariableDec>{
1322 ":"{B}{IDENTIFIER} {
1323 yyextra->startInit =
FALSE;
1324 yyextra->current->type =
substitute(yytext,
":",
"");
1325 }
1326 {STARTDOCSYMS}"<"/.* {
1328 yyextra->packageCommentAllowed =
FALSE;
1330 yyextra->docBlockContext = VariableEnd;
1331 BEGIN(SpecialComment);
1332 }
1333 "#".* {
1334 BEGIN( VariableEnd );
1335 }
1336 \n {
1337 unput('\n');
1338 BEGIN( VariableEnd );
1339 }
1340}
1341
1342<VariableAtom>{
1343 [\(\[\{] {
1344 yyextra->current->initializer << *yytext;
1345 if (yyextra->atomStart==*yytext)
1346 {
1347 yyextra->atomCount++;
1348 }
1349 }
1350 [\)\]\}] {
1351 yyextra->current->initializer << *yytext;
1352 if (yyextra->atomEnd==*yytext)
1353 {
1354 yyextra->atomCount--;
1355 }
1356 if (yyextra->atomCount==0)
1357 {
1358 yyextra->startInit =
FALSE;
1359 BEGIN(yyextra->atomContext);
1360 }
1361 }
1362 {TRIDOUBLEQUOTE} {
1363 yyextra->specialBlock =
FALSE;
1364 yyextra->current->program << yytext;
1366 BEGIN(TripleComment);
1367 }
1368
1369 {TRISINGLEQUOTE} {
1370 yyextra->specialBlock =
FALSE;
1371 yyextra->current->program << yytext;
1373 BEGIN(TripleComment);
1374 }
1375 "'" {
1376 yyextra->stringContext=YY_START;
1377 yyextra->current->initializer << "'";
1378 yyextra->copyString=&yyextra->current->initializer;
1379 BEGIN( SingleQuoteString );
1380 }
1381 "\"" {
1382 yyextra->stringContext=YY_START;
1383 yyextra->current->initializer << "\"";
1384 yyextra->copyString=&yyextra->current->initializer;
1385 BEGIN( DoubleQuoteString );
1386 }
1387 {IDENTIFIER} {
1388 yyextra->current->initializer << yytext;
1389 }
1390 . {
1391 yyextra->current->initializer << *yytext;
1392 }
1393 \n {
1394 yyextra->current->initializer << *yytext;
1396 }
1397
1398}
1399
1400<VariableEnd>{
1401 \n {
1404 {
1406 }
1408 }
1409 . {
1410 unput(*yytext);
1413 }
1415 }
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...
1416}
1417
1418<TripleComment>{
1419 {ENDTRIDOUBLEQUOTE} |
1420 {ENDTRISINGLEQUOTE} {
1421
1422 if (yyextra->doubleQuote==(yytext[0]=='"'))
1423 {
1424 if (yyextra->specialBlock)
1425 {
1426 QCString actualDoc=yyextra->docBlock;
1427 if (!yyextra->docBlockSpecial)
1428 {
1430 {
1432 actualDoc.
prepend(
"@iverbatim\n");
1433 actualDoc.
append(
"@endiverbatim ");
1434 }
1435 }
1436
1438 }
1439 else if (yyextra->packageCommentAllowed)
1440 {
1441 QCString actualDoc=yyextra->docBlock;
1442 if (!yyextra->docBlockSpecial)
1443 {
1445 {
1447 actualDoc.
prepend(
"@iverbatim\n");
1448 actualDoc.
append(
"@endiverbatim ");
1449 }
1450 }
1451 if (yyextra->moduleScope.startsWith("__") && yyextra->moduleScope.endsWith("__"))
1452 {
1453 actualDoc.
prepend(
"\\namespace \\"+yyextra->moduleScope+
" ");
1454 }
1455 else
1456 {
1457 actualDoc.
prepend(
"\\namespace "+yyextra->moduleScope+
" ");
1458 }
1460 }
1461 if ((yyextra->docBlockContext==ClassBody ) ||
1462 yyextra->docBlockContext==FunctionBody)
1463 {
1464 yyextra->current->program << yyextra->docBlock;
1465 yyextra->current->program << yytext;
1466 }
1467
1468
1469
1470
1471
1472 BEGIN(yyextra->docBlockContext);
1473 }
1474 else
1475 {
1476 yyextra->docBlock += yytext;
1477 }
1478 yyextra->packageCommentAllowed =
FALSE;
1479 }
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)
1480
1481
1482 ^{BB} {
1483 if (yyextra->docBlockSpecial && yyleng >= yyextra->curIndent)
1484 yyextra->docBlock += yytext + yyextra->curIndent;
1485 else
1486 yyextra->docBlock += yytext;
1487 }
1488 [^"'\n \t\\@]+ {
1489 yyextra->docBlock += yytext;
1490 }
1491 \n {
1492 incLineNr(yyscanner);
1493 yyextra->docBlock += yytext;
1494 }
1495 {CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
1496 yyextra->fileName = &yytext[6];
1497 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1498 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
1499 yyextra->docBlock+=yytext;
1500 }
1501 {CMD}"ifile"{B}+{FILEMASK} {
1502 yyextra->fileName = &yytext[6];
1503 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1504 yyextra->docBlock+=yytext;
1505 }
1506 {CMD}"iline"{LINENR}/[\n\.] |
1507 {CMD}"iline"{LINENR}{B} {
1508 bool ok = false;
1510 if (!ok)
1511 {
1512 warn(yyextra->fileName,yyextra->yyLineNr,
"Invalid line number '{}' for iline command",yytext);
1513 }
1514 else
1515 {
1516 yyextra->yyLineNr = nr;
1517 }
1518 yyextra->docBlock+=yytext;
1519 }
1520 ({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
1521 yyextra->docBlock+=yytext;
1522 }
1523 \\. {
1524 yyextra->docBlock += yytext;
1525 }
1526 . {
1527 yyextra->docBlock += yytext;
1528 }
int toInt(bool *ok=nullptr, int base=10) const
1529}
1530
1531<SpecialComment>{
1532 ^{B}"#"("#")* {
1533 }
1534 \n/{B}"#" {
1535 yyextra->docBlock+='\n';
1536 yyextra->docBrief =
FALSE;
1538 }
1539 {CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
1540 yyextra->fileName = &yytext[6];
1541 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1542 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
1543 yyextra->docBlock+=yytext;
1544 }
1545 {CMD}"ifile"{B}+{FILEMASK} {
1546 yyextra->fileName = &yytext[6];
1547 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1548 yyextra->docBlock+=yytext;
1549 }
1550 {CMD}"iline"{LINENR}/[\n\.] |
1551 {CMD}"iline"{LINENR}{B} {
1552 bool ok = false;
1554 if (!ok)
1555 {
1556 warn(yyextra->fileName,yyextra->yyLineNr,
"Invalid line number '{}' for iline command",yytext);
1557 }
1558 else
1559 {
1560 yyextra->yyLineNr = nr;
1561 }
1562 yyextra->docBlock+=yytext;
1563 }
1564 ({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
1565 yyextra->docBlock+=yytext;
1566 }
1567 "\\ilinebr "{B}* {
1569 int extraSpaces = std::max(0,static_cast<int>(yyleng-9-yyextra->curIndent-2));
1570 indent.
fill(
' ',extraSpaces);
1571
1572 yyextra->docBlock += "\\ilinebr ";
1573 yyextra->docBlock += indent;
1574 }
1575 [^#\\@\n]+ {
1576 yyextra->docBlock+=yytext;
1577 }
1578 \n {
1580 if (yyextra->docBlockContext == VariableEnd)
1581 {
1582 unput(*yytext);
1583 }
1584 else
1585 {
1587 }
1588 BEGIN(yyextra->docBlockContext);
1589 }
1590 . {
1591 yyextra->docBlock+=*yytext;
1592 }
void fill(char c, int len=-1)
Fills a string with a predefined character.
1593}
1594
1595<SingleQuoteString>{
1596 \\{B}\n {
1599 }
1600 \\. {
1602 }
1603 "\"\"\"" {
1605 }
1606 "'" {
1608 BEGIN(yyextra->stringContext);
1609 }
1610 [^"'\n\\]+ { // normal chars
1611 addToString(yyscanner,yytext);
1612 }
1613 . { // normal char
1614 addToString(yyscanner,yytext);
1615 }
static void addToString(yyscan_t yyscanner, const char *s)
1616}
1617
1618<DoubleQuoteString>{
1619 \\{B}\n {
1622 }
1623 \\. {
1625 }
1626 "'''" {
1628 }
1629 "\"" {
1631 BEGIN(yyextra->stringContext);
1632 }
1633 [^"'\n\\]+ { // normal chars
1634 addToString(yyscanner,yytext);
1635 }
1636 . { // normal char
1637 addToString(yyscanner,yytext);
1638 }
1639}
1640
1641<TripleString>{
1642 {ENDTRIDOUBLEQUOTE} |
1643 {ENDTRISINGLEQUOTE} {
1644 *yyextra->copyString << yytext;
1645 if (yyextra->doubleQuote==(yytext[0]=='"'))
1646 {
1647 BEGIN(yyextra->stringContext);
1648 }
1649 }
1650
1651
1652 ({LONGSTRINGBLOCK}) {
1654 *yyextra->copyString << yytext;
1655 }
1656 \n {
1658 *yyextra->copyString << yytext;
1659 }
1660 . {
1661 *yyextra->copyString << *yytext;
1662 }
1663}
1664
1665<Decorator>{
1666 {TRIDOUBLEQUOTE} {
1667 yyextra->doubleQuote=
TRUE;
1668 yyextra->decoratorCommentStr.str(std::string());
1669 yyextra->copyString=&yyextra->decoratorCommentStr;
1670 yyextra->stringContext=YY_START;
1671 BEGIN(TripleString);
1672 }
1673
1674 {TRISINGLEQUOTE} {
1675 yyextra->doubleQuote=
FALSE;
1676 yyextra->decoratorCommentStr.str(std::string());
1677 yyextra->copyString=&yyextra->decoratorCommentStr;
1678 yyextra->stringContext=YY_START;
1679 BEGIN(TripleString);
1680 }
1681 "'" {
1682 yyextra->stringContext=YY_START;
1683 yyextra->decoratorCommentStr.str(std::string());
1684 yyextra->copyString=&yyextra->decoratorCommentStr;
1685 BEGIN( SingleQuoteString );
1686 }
1687 "\"" {
1688 yyextra->stringContext=YY_START;
1689 yyextra->decoratorCommentStr.str(std::string());
1690 yyextra->copyString=&yyextra->decoratorCommentStr;
1691 BEGIN( DoubleQuoteString );
1692 }
1693 "(" {
1694 yyextra->decoratorRound++;
1695 }
1696 ")" {
1697 yyextra->decoratorRound--;
1698 if (!yyextra->decoratorRound) BEGIN(
Search );
1699 }
1700 \n {
1702 }
1703 . { }
1704}
1705
1706
1707
1708
1709<*>({NONEMPTY}|{EXPCHAR}|{BB}) { // This should go one character at a time.
1710
1711
1712
1713 }
1714 */
1715
1716<*>{NEWLINE} {
1717
1718
1719
1721 }
1722
1723<*>"'" {
1724
1725 }
1726
1727<*>. {
1728
1729
1730
1731 }
1732
1733
1734%%