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