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