381 {
383 yyextra->code->codify(yytext);
384 BEGIN( ReadInclude );
385 }
386<Body>("@interface"|"@implementation"|"@protocol")[ \t\n]+ {
387 yyextra->insideObjC=
TRUE;
391 if (!yyextra->insideTemplate)
392 BEGIN( ClassName );
393 }
394<Body>(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") {
395 if (yyextra->insideTemplate) REJECT;
399 BEGIN( ClassName );
400 }
401<Body>"property"|"event"/{BN}* {
402 if (yyextra->insideTemplate) REJECT;
406 }
407<Body>("partial"{B}+)?("class"|"struct"|"union"|"namespace"|"interface"){B}+ {
411 if (!yyextra->insideTemplate)
412 BEGIN( ClassName );
413 }
414<Body>("package")[ \t\n]+ {
418 BEGIN( PackageName );
419 }
420<ClassVar>\n {
421 if (!yyextra->insideObjC) REJECT;
423 BEGIN(Body);
424 }
425<Body,ClassVar,Bases>"-"|"+" {
426 if (!yyextra->insideObjC || yyextra->insideBody)
427 {
428 yyextra->code->codify(yytext);
429 }
430 else
431 {
432 DBG_CTX((stderr,
"Start of Objective-C method!\n"));
433 yyextra->code->codify(yytext);
434 BEGIN(ObjCMethod);
435 }
436 }
437<ObjCMethod>":" {
438 yyextra->code->codify(yytext);
439 BEGIN(ObjCParams);
440 }
441<ObjCParams>"(" {
442 yyextra->code->codify(yytext);
443 BEGIN(ObjCParamType);
444 }
445<ObjCParams,ObjCMethod>";"|"{" {
446 yyextra->code->codify(yytext);
447 if (*yytext=='{')
448 {
449 if (yyextra->searchingForBody)
450 {
451 yyextra->searchingForBody=
FALSE;
452 yyextra->insideBody=
TRUE;
453 }
454 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
455 if (!yyextra->curClassName.isEmpty())
456 {
457 pushScope(yyscanner,yyextra->curClassName);
458 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
460 }
461 }
462 yyextra->type.clear();
463 yyextra->name.clear();
464 BEGIN(Body);
465 }
466<ObjCParams>{ID}{B}*":" {
467 yyextra->code->codify(yytext);
468 }
469<ObjCParamType>{TYPEKW} {
471 yyextra->code->codify(yytext);
473 yyextra->parmType=yytext;
474 }
475<ObjCParamType>{ID} {
477 yyextra->parmType=yytext;
478 }
479<ObjCParamType>")" {
480 yyextra->code->codify(yytext);
481 BEGIN(ObjCParams);
482 }
483<ObjCParams>{ID} {
484 yyextra->code->codify(yytext);
485 yyextra->parmName=yytext;
486 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
487 yyextra->parmType.clear();yyextra->parmName.clear();
488 }
489<ObjCMethod,ObjCParams,ObjCParamType>{ID} {
491 }
492<ObjCMethod,ObjCParams,ObjCParamType>. {
493 yyextra->code->codify(yytext);
494 }
495<ObjCMethod,ObjCParams,ObjCParamType>\n {
497 }
498<ReadInclude>[^\n\">]+/(">"|"\"") {
499
500 bool found = false;
501 bool ambig = false;
504
506 {
507 if (ambig)
508 {
509 DBG_CTX((stderr,
"===== yes %s is ambiguous\n",yytext));
511 if (!name.isEmpty() && yyextra->sourceFileDef)
512 {
514 if (fn)
515 {
516
517 auto it = std::find_if(fn->begin(),
518 fn->end(),
519 [&sfd=yyextra->sourceFileDef]
520 (const auto &lfd)
521 { return sfd->isIncluded(lfd->absFilePath()); });
522 found = it!=fn->end();
523 }
524 }
525 }
526 else
527 {
529 }
530 }
532 if (found)
533 {
535 }
536 else
537 {
538 yyextra->code->codify(yytext);
539 }
540 char c=(char)yyinput(yyscanner);
542 text+=c;
543 yyextra->code->codify(text);
545 BEGIN( Body );
546 }
static std::string cleanDirPath(const std::string &path)
static FileNameLinkedMap * inputNameLinkedMap
virtual QCString absFilePath() const =0
Class representing all files with a certain base name.
QCString determineAbsoluteIncludeName(const QCString &curFile, const QCString &incFileName)
FileDef * findFileDef(const FileNameLinkedMap *fnMap, const QCString &n, bool &ambig)
547<Body,Bases>^[ \t]*"#" {
549 yyextra->lastSkipCppContext = YY_START;
550 yyextra->code->codify(yytext);
551 BEGIN( SkipCPP ) ;
552 }
553<SkipCPP>\" {
554 yyextra->code->codify(yytext);
555 yyextra->lastStringContext=YY_START;
556 BEGIN( SkipString ) ;
557 }
558<SkipCPP>. {
559 yyextra->code->codify(yytext);
560 }
561<SkipCPP>[^\n\/\\\"]+ {
562 yyextra->code->codify(yytext);
563 }
564<SkipCPP>\\[\r]?\n {
566 }
567<SkipCPP>{CPPC}/[^/!] {
568 REJECT;
569 }
570<Body,FuncCall,MemberCall,MemberCall2>"}" {
571 yyextra->theVarContext.popScope();
572 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
573 yyextra->type.clear();
574 yyextra->name.clear();
575
576 if (!yyextra->scopeStack.empty())
577 {
578 int scope = yyextra->scopeStack.top();
579 yyextra->scopeStack.pop();
582 {
584 }
585 }
586
587 yyextra->code->codify(yytext);
588
589 DBG_CTX((stderr,
"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount));
590 if (--yyextra->bodyCurlyCount<=0)
591 {
592 yyextra->insideBody=
FALSE;
593 yyextra->currentMemberDef=nullptr;
594 if (yyextra->currentDefinition)
595 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
596 }
597 BEGIN(Body);
598 }
599<Body,ClassVar>"@end" {
600 DBG_CTX((stderr,
"End of objc scope fd=%s\n",
qPrint(yyextra->sourceFileDef->name())));
601 if (yyextra->sourceFileDef)
602 {
603 const FileDef *fd=yyextra->sourceFileDef;
606 DBG_CTX((stderr,
"insideObjC=%d\n",yyextra->insideObjC));
607 }
608 else
609 {
610 yyextra->insideObjC =
FALSE;
611 }
612 if (yyextra->insideBody)
613 {
614 yyextra->theVarContext.popScope();
bool endsWith(const char *s) const
615
616 if (!yyextra->scopeStack.empty())
617 {
618 int scope = yyextra->scopeStack.top();
619 yyextra->scopeStack.pop();
622 {
624 }
625 }
626 yyextra->insideBody=
FALSE;
627 }
628
630 yyextra->code->codify(yytext);
632
633 yyextra->currentMemberDef=nullptr;
634 if (yyextra->currentDefinition)
635 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
636 BEGIN(Body);
637 }
638<ClassName,ClassVar>";" {
639 if (yyextra->lang==SrcLangExt::CSharp)
640 {
641 yyextra->code->codify(yytext);
642 yyextra->skipCodify = true;
643 unput('{');
644 }
645 else
646 {
647 yyextra->code->codify(yytext);
648 yyextra->searchingForBody=
FALSE;
649 BEGIN( Body );
650 }
651 }
652<ClassName,ClassVar>[*&^%]+ {
653 yyextra->type=yyextra->curClassName;
654 yyextra->name.clear();
655 yyextra->code->codify(yytext);
656 BEGIN( Body );
657 }
658<ClassName>"__declspec"{B}*"("{B}*{ID}{B}*")" {
660 yyextra->code->codify(yytext);
662 }
663<ClassName>{ID}("."{ID})* |
664<ClassName>{ID}("::"{ID})* {
665 if (yyextra->lang==SrcLangExt::CSharp)
666 yyextra->curClassName=
substitute(yytext,
".",
"::");
667 else
668 yyextra->curClassName=yytext;
670 if (yyextra->curClassName=="alignas")
671 {
673 yyextra->code->codify(yytext);
675 BEGIN( AlignAs );
676 }
677 else
678 {
680 BEGIN( ClassVar );
681 }
682 }
static void addType(yyscan_t yyscanner)
683<AlignAs>"(" {
684 yyextra->bracketCount=1;
685 yyextra->code->codify(yytext);
686 BEGIN( AlignAsEnd );
687 }
688<AlignAs>\n { yyextra->yyLineNr++;
690 }
691<AlignAs>. { yyextra->code->codify(yytext); }
692<AlignAsEnd>"(" { yyextra->code->codify(yytext);
693 yyextra->bracketCount++;
694 }
695<AlignAsEnd>")" {
696 yyextra->code->codify(yytext);
697 if (--yyextra->bracketCount<=0)
698 {
699 BEGIN(ClassName);
700 }
701 }
702<AlignAsEnd>\n { yyextra->yyLineNr++;
704 }
705<AlignAsEnd>. { yyextra->code->codify(yytext); }
706<ClassName>{ID}("\\"{ID})* { // PHP namespace
707 yyextra->curClassName=
substitute(yytext,
"\\",
"::");
709 pushScope(yyscanner,yyextra->curClassName);
712 BEGIN( ClassVar );
713 }
714<ClassName>{ID}{B}*"("{ID}")" { // Obj-C category
717 pushScope(yyscanner,yyextra->curClassName);
720 BEGIN( ClassVar );
721 }
722<PackageName>{ID}("."{ID})* {
723 yyextra->curClassName=
substitute(yytext,
".",
"::");
724 DBG_CTX((stderr,
"found package: %s\n",
qPrint(yyextra->curClassName)));
727 }
728<ClassVar>"=" {
729 unput(*yytext);
730 BEGIN( Body );
731 }
732<ClassVar>("extends"|"implements") { // Java, Slice
736 yyextra->curClassBases.clear();
737 BEGIN( Bases );
738 }
739<ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") {
740 DBG_CTX((stderr,
"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,
qPrint(yyextra->curClassName)));
744 BEGIN( CppCliTypeModifierFollowup );
745 }
746<ClassVar>{ID} {
747 yyextra->type = yyextra->curClassName;
748 yyextra->name = yytext;
749 if (yyextra->insideBody)
750 {
751 addVariable(yyscanner,yyextra->type,yyextra->name);
752 }
754 }
755<ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*":"{B}* {
757 yyextra->curClassBases.clear();
758 BEGIN( Bases );
759 }
760<PackageName>[ \t]*";" |
761<Bases>^{Bopt}/"@"{ID} | // Objective-C interface
762<Bases,ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*"{"{B}* {
763 yyextra->theVarContext.pushScope();
764 if (!yyextra->skipCodify) yyextra->code->codify(yytext);
765 yyextra->skipCodify = false;
766 if (YY_START==ClassVar && yyextra->curClassName.isEmpty())
767 {
768 yyextra->curClassName = yyextra->name;
769 }
770 if (yyextra->searchingForBody)
771 {
772 yyextra->searchingForBody=
FALSE;
773 yyextra->insideBody=
TRUE;
774 }
775 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
776 if (!yyextra->curClassName.isEmpty())
777 {
778 DBG_CTX((stderr,
"** scope stack push CLASSBLOCK\n"));
780 pushScope(yyscanner,yyextra->curClassName);
781 DBG_CTX((stderr,
"***** yyextra->curClassName=%s\n",
qPrint(yyextra->curClassName)));
782 if (yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->curClassName,true)==nullptr)
783 {
784 DBG_CTX((stderr,
"Adding new class %s\n",
qPrint(yyextra->curClassName)));
786
787 for (const auto &s : yyextra->curClassBases)
788 {
790 auto it = yyextra->codeClassMap.find(s);
791 if (it!=yyextra->codeClassMap.end())
792 {
794 }
795 if (bcd==nullptr) bcd=yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,s,true);
796 if (bcd && bcd->
name()!=yyextra->curClassName)
797 {
798 var.localDef()->insertBaseClass(bcd->
name());
799 }
800 }
801 yyextra->codeClassMap.emplace(yyextra->curClassName.str(),std::move(var));
802 }
803
804 }
805 else
806 {
807 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
809 }
810 yyextra->curClassName.clear();
811 yyextra->curClassBases.clear();
812 BEGIN( Body );
813 }
814<Bases>"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" {
816 yyextra->code->codify(yytext);
818 }
819<Bases>{SEP}?({ID}{SEP})*{ID} {
820 DBG_CTX((stderr,
"%s:addBase(%s)\n",
qPrint(yyextra->curClassName),yytext));
821 yyextra->curClassBases.emplace_back(yytext);
823 }
824<Bases>"<" {
825 yyextra->code->codify(yytext);
826 if (!yyextra->insideObjC)
827 {
828 yyextra->sharpCount=1;
829 BEGIN ( SkipSharp );
830 }
831 else
832 {
833 yyextra->insideProtocolList=
TRUE;
834 }
835 }
836<Bases>">" {
837 yyextra->code->codify(yytext);
838 yyextra->insideProtocolList=
FALSE;
839 }
840<SkipSharp>"<" {
841 yyextra->code->codify(yytext);
842 ++yyextra->sharpCount;
843 }
844<SkipSharp>">" {
845 yyextra->code->codify(yytext);
846 if (--yyextra->sharpCount<=0)
847 BEGIN ( Bases );
848 }
849<SkipSharp>"\"" {
850 yyextra->code->codify(yytext);
851 yyextra->lastStringContext=YY_START;
852 BEGIN(SkipString);
853 }
854<SkipSharp>"\'" {
855 yyextra->code->codify(yytext);
856 yyextra->lastStringContext=YY_START;
857 BEGIN(SkipStringS);
858 }
859<Bases>"(" {
860 yyextra->code->codify(yytext);
861 yyextra->sharpCount=1;
862 BEGIN ( SkipSharp );
863 }
864<SkipSharp>"(" {
865 yyextra->code->codify(yytext);
866 ++yyextra->sharpCount;
867 }
868<SkipSharp>")" {
869 yyextra->code->codify(yytext);
870 if (--yyextra->sharpCount<=0)
871 BEGIN ( Bases );
872 }
873
874
875<Bases>"," {
876 yyextra->code->codify(yytext);
877 }
878
879
880<Body>{SCOPEPREFIX}?"operator"{B}*"()"{Bopt}/"(" {
883 yyextra->bracketCount=0;
884 yyextra->args.clear();
885 yyextra->name+=yytext;
886 BEGIN( FuncCall );
887 }
static void generateFunctionLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &funcName)
888<Body>{SCOPEPREFIX}?"operator"/"(" {
891 yyextra->bracketCount=0;
892 yyextra->args.clear();
893 yyextra->name+=yytext;
894 BEGIN( FuncCall );
895 }
896<Body>{SCOPEPREFIX}?"operator"[^a-z_A-Z0-9\(\n]+/"(" {
899 yyextra->bracketCount=0;
900 yyextra->args.clear();
901 yyextra->name+=yytext;
902 BEGIN( FuncCall );
903 }
904<Body,TemplDecl>("template"|"generic")/([^a-zA-Z0-9]) {
908 yyextra->insideTemplate=
TRUE;
909 yyextra->sharpCount=0;
910 }
911<Body>"concept"{BN}+ {
915 BEGIN(ConceptName);
916 }
917<Body>"using"{BN}+"namespace"{BN}+ {
921 BEGIN(UsingName);
922 }
923<Body>"using"{BN}+ {
927 BEGIN(UsingName);
928 }
929<Body>"module"/{B}*[:;]? { // 'module X' or 'module : private' or 'module;'
930 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
931 if (!yyextra->type.isEmpty() || !yyextra->name.isEmpty()) REJECT;
935 BEGIN(ModuleName);
936 }
937<Body>"import"/{B}*[<":]? {
938 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
942 BEGIN(ModuleImport);
943 }
944<ConceptName>{ID}("::"{ID})* {
946 }
947<ConceptName>"=" { codifyLines(yyscanner,yytext); BEGIN(Body); }
948<UsingName>{ID}(("::"|"."){ID})* {
951 BEGIN(Body);
952 }
static void addUsingDirective(yyscan_t yyscanner, const QCString &name)
953<UsingName>\n { codifyLines(yyscanner,yytext); BEGIN(Body); }
954<UsingName>. { codifyLines(yyscanner,yytext); BEGIN(Body); }
955<Body,FuncCall>"$"?"this"("->"|".") { yyextra->code->codify(yytext); // this-> for C++, this. for C#
956 yyextra->isPrefixedWithThis =
TRUE;
957 }
958<Body>{KEYWORD}/([^a-z_A-Z0-9]) {
959 if (yyextra->lang==SrcLangExt::Java &&
qstrcmp(
"internal",yytext) ==0) REJECT;
964 if (text==
"typedef" || text.
find(
"enum ")!=-1)
965 {
967 yyextra->name+=yytext;
968 }
970 }
static bool skipLanguageSpecificKeyword(yyscan_t yyscanner, const char *kw)
int qstrcmp(const char *str1, const char *str2)
971<Body>{KEYWORD}/{B}* {
976 }
977<Body>{KEYWORD}/{BN}*"(" {
982 yyextra->name.clear();yyextra->type.clear();
983 }
984<FuncCall>"in"/{BN}* {
985 if (!yyextra->inForEachExpression) REJECT;
989
990 yyextra->theVarContext.popScope();
991 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
992 yyextra->theVarContext.pushScope();
993 yyextra->name.clear();yyextra->type.clear();
994 }
995<Body>{FLOWKW}/{BN}*"(" {
999 yyextra->name.clear();yyextra->type.clear();
1000 yyextra->inForEachExpression = (
qstrcmp(yytext,
"for each")==0 ||
qstrcmp(yytext,
"foreach")==0);
1001 BEGIN(FuncCall);
1002 }
1003<Body>{FLOWCONDITION}/{BN}*"(" {
1008 yyextra->name.clear();yyextra->type.clear();
1009 yyextra->inForEachExpression = (strcmp(yytext,"for each")==0 || strcmp(yytext, "foreach")==0);
1010 BEGIN(FuncCall);
1011 }
static void incrementFlowKeyWordCount(yyscan_t yyscanner)
1012<Body>{FLOWKW}/([^a-z_A-Z0-9]) {
1016 if (yyextra->inFunctionTryBlock && (
qstrcmp(yytext,
"catch")==0 ||
qstrcmp(yytext,
"finally")==0))
1017 {
1018 yyextra->inFunctionTryBlock=
FALSE;
1019 }
1020 }
1021<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1026 if (yyextra->inFunctionTryBlock && (strcmp(yytext,"catch")==0 || strcmp(yytext,"finally")==0))
1027 {
1028 yyextra->inFunctionTryBlock=
FALSE;
1029 }
1030 }
1031<Body>{FLOWKW}/{B}* {
1035 }
1036<Body>{FLOWCONDITION}/{B}* {
1041 }
1042<Body>"*"{B}*")" { // end of cast?
1043 yyextra->code->codify(yytext);
1044 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1045 yyextra->bracketCount--;
1046 yyextra->parmType = yyextra->name;
1047 BEGIN(FuncCall);
1048 }
1049<Body>"\\)"|"\\(" {
1050 yyextra->code->codify(yytext);
1051 }
1052<Body>[\\|\)\+\-\/\%\~\!] {
1053 yyextra->code->codify(yytext);
1054 yyextra->name.clear();yyextra->type.clear();
1055 if (*yytext==')')
1056 {
1057 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1058 yyextra->bracketCount--;
1059 if (yyextra->bracketCount<=0)
1060 {
1061 BEGIN(FuncCall);
1062 }
1063 }
1064 }
1065<Body,TemplDecl,ObjCMethod>{TYPEKW}/{B}* {
1067 yyextra->code->codify(yytext);
1070 yyextra->name+=yytext;
1071 }
1072<Body,TemplDecl,ObjCMethod>{TYPEKWSL}/{B}* {
1073 if (yyextra->lang!=SrcLangExt::Slice)
1074 {
1075 REJECT;
1076 }
1077 else
1078 {
1080 yyextra->code->codify(yytext);
1083 yyextra->name+=yytext;
1084 }
1085 }
1086<Body>"generic"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1088 yyextra->code->codify(yytext);
1090 yyextra->sharpCount=0;
1091 BEGIN(TemplDecl);
1092 }
1093<Body>"template"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* { // template<...>
1095 yyextra->code->codify(yytext);
1097 yyextra->sharpCount=0;
1098 BEGIN(TemplDecl);
1099 }
1100<TemplDecl>"class"|"typename" {
1104 }
1105<TemplDecl>"<" {
1106 yyextra->code->codify(yytext);
1107 yyextra->sharpCount++;
1108 }
1109<TemplDecl>">" {
1110 yyextra->code->codify(yytext);
1111 yyextra->sharpCount--;
1112 if (yyextra->sharpCount<=0)
1113 {
1114 BEGIN(Body);
1115 }
1116 }
1117<TemplCast>">" {
1121 BEGIN( yyextra->lastTemplCastContext );
1122 }
1123<TemplCast>{ID}("::"{ID})* {
1125 }
1126<TemplCast>("const"|"volatile"){B}* {
1130 }
1131<TemplCast>[*^]* {
1133 }
1134<Body,MemberCall2,FuncCall>{CASTKW}{B}*"<" { // static_cast<T>(
1138 yyextra->lastTemplCastContext = YY_START;
1139 BEGIN(TemplCast);
1140 }
1141<Body>"$this->"{SCOPENAME}/{BN}*[;,)\]] { // PHP member variable
1144 yyextra->name+=yytext+7;
1145 }
static void generatePHPVariableLink(yyscan_t yyscanner, OutputCodeList &ol, const char *varName)
1146<Body,TemplCast>{SCOPENAME}{B}*"<"[^\n\/\-\.\{\">\(']*">"{ENDIDopt}/{B}* { // A<T> *pt;
1148 {
1149 REJECT;
1150 }
1153 yyextra->name+=yytext;
1154 }
static bool isCastKeyword(const char *s)
1155<ModuleName,ModuleImport>{MODULE_ID}({BN}*":"{BN}*{MODULE_ID})? {
1157 int i = name.
find(
':');
1159 if (i!=-1)
1160 {
1163 }
1165 if (mod)
1166 {
1168 }
1169 else
1170 {
1172 }
1173 }
static ModuleManager & instance()
ModuleDef * getPrimaryInterface(const QCString &moduleName) const
1174<ModuleName>":"{BN}+"private" {
1176 int i=text.
find(
'p');
1181 }
1182<ModuleName>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1183<ModuleName>. { yyextra->code->codify(yytext); }
1184<ModuleName>\n { codifyLines(yyscanner,yytext); }
1185<ModuleImport>["<] { yyextra->code->codify(yytext); BEGIN(ReadInclude); }
1186<ModuleImport>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1187<ModuleImport>. { yyextra->code->codify(yytext); }
1188<ModuleImport>\n { codifyLines(yyscanner,yytext); }
1189
1190<Body>{SCOPENAME}/{BN}*[:;,)\]] { // "int var;" or "var, var2" or "debug(f) macro" , or int var : 5;
1192 {
1193 REJECT;
1194 }
1197 yyextra->name+=yytext;
1198 }
static bool startsWithKeyword(const QCString &str, const QCString &kw)
1199<Body>{ID}("."{ID})+/{BN}+ { // CSharp/Java scope
1200 if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
1201 {
1204 yyextra->name+=yytext;
1205 }
1206 else
1207 {
1208 REJECT;
1209 }
1210 }
1211<Body>"export"/{B}* {
1212 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1216 }
1217<Body>{SCOPENAME}/{B}* { // p->func()
1219 {
1220 REJECT;
1221 }
1224 yyextra->name+=yytext;
1225 }
1226<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* { // (*p)->func() but not "if (p) ..."
1227 yyextra->code->codify(yytext);
1228 uint32_t s=0;
while (s<(uint32_t)yyleng && !
isId(yytext[s])) s++;
1229 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1232 yyextra->name=std::move(varname);
1233 }
1234<Body>{SCOPETNAME}{B}*"<"[^\n\/\-\.\{\">]*">"/{BN}*"(" |
1235<Body>{SCOPETNAME}/{BN}*"(" { // a() or c::a() or t<A,B>::a() or A\B\foo()
1237 {
1238 REJECT;
1239 }
1242 yyextra->bracketCount=0;
1243 yyextra->args.clear();
1244 yyextra->name+=yytext;
1245 BEGIN( FuncCall );
1246 }
1247<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} {
1249 uint32_t i=(uint32_t)text.
find(
'R');
1250 yyextra->code->codify(text.
left(i+1));
1252 yyextra->code->codify(yytext+i+1);
1253 yyextra->lastStringContext=YY_START;
1254 yyextra->inForEachExpression =
FALSE;
1256 BEGIN( RawString );
1257 }
QCString extractBeginRawStringDelimiter(const char *rawStart)
1258<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit,ClassVar,OldStyleArgs>\" {
1260 yyextra->code->codify(yytext);
1261 yyextra->lastStringContext=YY_START;
1262 yyextra->inForEachExpression =
FALSE;
1263 BEGIN( SkipString );
1264 }
1265<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{NUMBER} { //Note similar code in commentcnv.l
1266 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1267 yyextra->code->codify(yytext);
1268 }
1269<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
1271 yyextra->code->codify(yytext);
1272 yyextra->lastStringContext=YY_START;
1273 yyextra->inForEachExpression =
FALSE;
1274 BEGIN( SkipStringS );
1275 }
1276<SkipString>[^\"\\\r\n]{1,100} {
1277 yyextra->code->codify(yytext);
1278 }
1279<SkipStringS>[^\'\\\r\n]{1,100} {
1280 yyextra->code->codify(yytext);
1281 }
1282<SkipString,SkipStringS>{CPPC}|{CCS} {
1283 yyextra->code->codify(yytext);
1284 }
1285<SkipString>@?\" {
1286 yyextra->code->codify(yytext);
1287 if (yyextra->lastStringContext!=SkipCPP)
1288 {
1290 }
1291 BEGIN( yyextra->lastStringContext );
1292 }
1293<SkipStringS>\' {
1294 yyextra->code->codify(yytext);
1296 BEGIN( yyextra->lastStringContext );
1297 }
1298<SkipString,SkipStringS>\\. {
1299 yyextra->code->codify(yytext);
1300 }
1301<RawString>{RAWEND} {
1302 yyextra->code->codify(yytext);
1304 {
1305 BEGIN( yyextra->lastStringContext );
1306 }
1307 }
QCString extractEndRawStringDelimiter(const char *rawEnd)
1308<RawString>[^)\n]+ { yyextra->code->codify(yytext); }
1309<RawString>. { yyextra->code->codify(yytext); }
1310<RawString>\n { codifyLines(yyscanner,yytext); }
1311<SkipVerbString>[^"\n]+ {
1312 yyextra->code->codify(yytext);
1313 }
1314<SkipVerbString>\"\" { // escaped quote
1315 yyextra->code->codify(yytext);
1316 }
1317<SkipVerbString>\" { // end of string
1318 yyextra->code->codify(yytext);
1320 BEGIN( yyextra->lastVerbStringContext );
1321 }
1322<SkipVerbString>. {
1323 yyextra->code->codify(yytext);
1324 }
1325<SkipVerbString>\n {
1327 }
1328<Body>":" {
1329 yyextra->code->codify(yytext);
1330 yyextra->name.clear();yyextra->type.clear();
1331 }
1332<Body>"<" {
1333 if (yyextra->insideTemplate)
1334 {
1335 yyextra->sharpCount++;
1336 }
1337 yyextra->code->codify(yytext);
1338 }
1339<Body>">" {
1340 if (yyextra->insideTemplate)
1341 {
1342 if (--yyextra->sharpCount<=0)
1343 {
1344 yyextra->insideTemplate=
FALSE;
1345 }
1346 }
1347 yyextra->code->codify(yytext);
1348 }
1349<Body,MemberCall,MemberCall2,FuncCall,OldStyleArgs>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
1351 yyextra->code->codify(yytext);
1353 }
1354<Body>"."|"->" {
1355 if (yytext[0]=='-')
1356 {
1358 }
1359 yyextra->code->codify(yytext);
1360 yyextra->memCallContext = YY_START;
1361 BEGIN( MemberCall );
1362 }
static void updateCallContextForSmartPointer(yyscan_t yyscanner)
1363<MemberCall>{SCOPETNAME}/{BN}*"(" {
1364 if (yyextra->theCallContext.getScope().globalDef())
1365 {
1367 {
1370 }
1371 yyextra->name.clear();
1372 }
1373 else
1374 {
1377 yyextra->name.clear();
1378 }
1379 yyextra->type.clear();
1380 if (yyextra->memCallContext==Body)
1381 {
1382 BEGIN(FuncCall);
1383 }
1384 else
1385 {
1386 BEGIN(yyextra->memCallContext);
1387 }
1388 }
1389<MemberCall>{SCOPENAME}/{B}* {
1390 if (yyextra->theCallContext.getScope().globalDef())
1391 {
1392 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1394 {
1397 }
1398 yyextra->name.clear();
1399 }
1400 else
1401 {
1402 DBG_CTX((stderr,
"no class context!\n"));
1405 yyextra->name.clear();
1406 }
1407 yyextra->type.clear();
1408 BEGIN(yyextra->memCallContext);
1409 }
1410<Body>[,=;\[{] {
1411 if (yyextra->insideObjC && *yytext=='[')
1412 {
1413 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
1414
1415 yyextra->contextMap.clear();
1416 yyextra->nameMap.clear();
1417 yyextra->objectMap.clear();
1418 yyextra->wordMap.clear();
1419 yyextra->commentMap.clear();
1420 yyextra->currentCtxId = 0;
1421 yyextra->currentNameId = 0;
1422 yyextra->currentObjId = 0;
1423 yyextra->currentCtx = nullptr;
1424 yyextra->braceCount = 0;
1425 unput('[');
1426 BEGIN(ObjCCall);
1427 }
1428 else
1429 {
1430 if (*yytext!='{') yyextra->code->codify(yytext);
1431 yyextra->saveName = yyextra->name;
1432 yyextra->saveType = yyextra->type;
1433 if (*yytext!='[' && !yyextra->type.isEmpty())
1434 {
1435
1436
1437 {
1438
1439
1440 addVariable(yyscanner,yyextra->type,yyextra->name);
1441 }
1442 yyextra->name.clear();
1443 }
1444 if (*yytext==';' || *yytext=='=' || *yytext=='{')
1445 {
1446 yyextra->type.clear();
1447 yyextra->name.clear();
1448 }
1449 else if (*yytext=='[')
1450 {
1451 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1452 }
1453 yyextra->args.clear();
1454 yyextra->parmType.clear();
1455 yyextra->parmName.clear();
1456 if (*yytext=='{')
1457 {
1458 BEGIN( BodyVar );
1459 unput('{');
1460 }
1461 }
1462 }
1463<Body,FuncCall,BodyVar>"{" {
1464 yyextra->theVarContext.pushScope();
1465 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1466 yyextra->bracketCount = 0;
1467
1469 if (yyextra->type.find("enum ")!=-1)
1470 {
1471 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1474 }
1475 else
1476 {
1477 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1479 }
1480
1481 if (yyextra->searchingForBody)
1482 {
1483 yyextra->searchingForBody=
FALSE;
1484 yyextra->insideBody=
TRUE;
1485 }
1486 yyextra->code->codify(yytext);
1487 if (yyextra->insideBody)
1488 {
1489 yyextra->bodyCurlyCount++;
1490 }
1491 yyextra->type.clear();
1492 yyextra->name.clear();
1493 BEGIN( Body );
1494 }
1495<ObjCCall,ObjCMName>"["|"{" {
1497 yyextra->currentCtx->format+=*yytext;
1498 BEGIN(ObjCCall);
1500 }
static void saveObjCContext(yyscan_t yyscanner)
1501<ObjCCall,ObjCMName>"]"|"}" {
1502 yyextra->currentCtx->format+=*yytext;
1504 BEGIN(ObjCMName);
1505 if (yyextra->currentCtx==nullptr)
1506 {
1507
1509 auto it = yyextra->contextMap.find(0);
1510 if (it!=yyextra->contextMap.end())
1511 {
1512 ctx = it->second.get();
1513 }
1515 BEGIN(Body);
1516 }
1518 }
static void restoreObjCContext(yyscan_t yyscanner)
1519<ObjCCall,ObjCMName>{CPPC}.* {
1520 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1521 }
static QCString escapeComment(yyscan_t yyscanner, const QCString &s)
1522<ObjCCall,ObjCMName>{CCS} {
1523 yyextra->lastObjCCallContext = YY_START;
1524 yyextra->currentCtx->comment.str(yytext);
1525 BEGIN(ObjCCallComment);
1526 }
1527<ObjCCallComment>{CCE} {
1528 yyextra->currentCtx->comment << yytext;
1529 yyextra->currentCtx->format+=
escapeComment(yyscanner,yyextra->currentCtx->comment.str());
1530 BEGIN(yyextra->lastObjCCallContext);
1531 }
1532<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
1533<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
1534<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
1535<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
1536<ObjCCall>{ID}({B}*"."{B}*{ID})* {
1537 yyextra->currentCtx->format+=
escapeObject(yyscanner,yytext);
1538 if (yyextra->braceCount==0)
1539 {
1540 yyextra->currentCtx->objectTypeOrName=yytext;
1541 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1542 BEGIN(ObjCMName);
1543 }
1544 }
static QCString escapeObject(yyscan_t yyscanner, const QCString &s)
1545<ObjCMName>{ID}/{BN}*"]" {
1546 if (yyextra->braceCount==0 &&
1547 yyextra->currentCtx->methodName.isEmpty())
1548 {
1549 yyextra->currentCtx->methodName=yytext;
1550 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1551 }
1552 else
1553 {
1554 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1555 }
1556 }
static QCString escapeWord(yyscan_t yyscanner, const QCString &s)
static QCString escapeName(yyscan_t yyscanner, const QCString &s)
1557<ObjCMName>{ID}/{BN}*":" {
1558 if (yyextra->braceCount==0)
1559 {
1560 yyextra->currentCtx->methodName+=yytext;
1561 yyextra->currentCtx->methodName+=":";
1562 }
1563 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1564 }
1565<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1566<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1567<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1568 BEGIN(yyextra->lastStringContext);
1569 }
1570<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1571<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1572 yyextra->lastStringContext=YY_START;
1573 BEGIN(ObjCSkipStr);
1574 }
1575<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+="$$"; }
1576<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
1577<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
1578<ObjCSkipStr>"@"/"\"" { // needed to prevent matching the global rule (for C#)
1579 yyextra->currentCtx->format+=yytext;
1580 }
1581<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=escapeWord(yyscanner,yytext); }
1582<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
1583<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
1584
1585<Body>"]" {
1586 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1587 yyextra->code->codify(yytext);
1588
1589 yyextra->name = yyextra->saveName;
1590 yyextra->type = yyextra->saveType;
1591 }
1592<Body>[0-9]+ {
1593 yyextra->code->codify(yytext);
1594 }
1595<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1596 yyextra->code->codify(yytext);
1597 }
1598<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1599
1600
1603 yyextra->code->codify(yytext);
1605 }
1606<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1608 yyextra->parmName=yytext;
1610 yyextra->code->codify(yytext);
1612 }
static void addParmType(yyscan_t yyscanner)
1613<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1614 if (yyextra->lang!=SrcLangExt::Slice)
1615 {
1616 REJECT;
1617 }
1618 else
1619 {
1621 yyextra->parmName=yytext;
1623 yyextra->code->codify(yytext);
1625 }
1626 }
1627<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1629 yyextra->parmName=yytext;
1631 yyextra->code->codify(yytext);
1633 }
1634<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1637 yyextra->parmName=yytext;
1639 yyextra->code->codify(yytext);
1641 }
1642<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1644 {
1645 REJECT;
1646 }
1648 yyextra->parmName=yytext;
1650 }
1651<FuncCall>";" { // probably a cast, not a function call
1652 yyextra->code->codify(yytext);
1653 yyextra->inForEachExpression =
FALSE;
1654 BEGIN( Body );
1655 }
1656<MemberCall2,FuncCall>, {
1657 yyextra->code->codify(yytext);
1658 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1659 yyextra->parmType.clear();yyextra->parmName.clear();
1660 }
1661<MemberCall2,FuncCall>"{" {
1662 if (yyextra->bracketCount>0)
1663 {
1664 yyextra->code->codify(yytext);
1665 yyextra->skipInlineInitContext=YY_START;
1666 yyextra->curlyCount=0;
1667 BEGIN(InlineInit);
1668 }
1669 else
1670 {
1671 REJECT;
1672 }
1673 }
1674<InlineInit>"{" { yyextra->curlyCount++;
1675 yyextra->code->codify(yytext);
1676 }
1677<InlineInit>"}" {
1678 yyextra->code->codify(yytext);
1679 if (--yyextra->curlyCount<=0)
1680 {
1681 BEGIN(yyextra->skipInlineInitContext);
1682 }
1683 }
1684<InlineInit>\n {
1686 }
1687<InlineInit>. {
1688 yyextra->code->codify(yytext);
1689 }
1690<MemberCall2,FuncCall>"(" {
1691 yyextra->parmType.clear();yyextra->parmName.clear();
1692 yyextra->code->codify(yytext);
1693 yyextra->bracketCount++;
1694 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1695 if (YY_START==FuncCall && !yyextra->insideBody)
1696 {
1697 yyextra->theVarContext.pushScope();
1698 }
1699 }
1700<MemberCall2,FuncCall>{OPERATOR} { // operator
1705 {
1706
1707 yyextra->parmType.clear();yyextra->parmName.clear();
1708 }
1709 yyextra->code->codify(yytext);
1710 }
1711<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1712 if (yytext[0]==')')
1713 {
1714 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1715 if (yyextra->parmType.isEmpty())
1716 {
1717 yyextra->parmType=yyextra->parmName;
1718 yyextra->parmName.clear();
1719 }
1720 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1721 }
1722 else
1723 {
1724 yyextra->parmType = yyextra->parmName;
1725 yyextra->parmName.clear();
1726 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1727 }
1728 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1729 yyextra->inForEachExpression =
FALSE;
1730
1731 yyextra->code->codify(yytext);
1732 if (--yyextra->bracketCount<=0)
1733 {
1734 if (yyextra->name.isEmpty())
1735 {
1736 BEGIN( Body );
1737 }
1738 else
1739 {
1740 BEGIN( CallEnd );
1741 }
1742 }
1743 }
1744<MemberCall,MemberCall2,FuncCall>[;:] { // recover from unexpected end of call
1745
1746 if (yyextra->bracketCount<=0)
1747 {
1748 unput(*yytext);
1749 BEGIN(CallEnd);
1750 }
1751 else
1752 {
1753 yyextra->code->codify(yytext);
1754 }
1755 }
1756<CallEnd>[ \t\n]* { codifyLines(yyscanner,yytext); }
1757<CallEnd>[;:] {
1759 yyextra->bracketCount=0;
1760 if (*yytext==
';') yyextra->searchingForBody=
FALSE;
1761 if (!yyextra->type.isEmpty())
1762 {
1763 DBG_CTX((stderr,
"add variable yyextra->type=%s yyextra->name=%s)\n",
qPrint(yyextra->type),
qPrint(yyextra->name)));
1764 addVariable(yyscanner,yyextra->type,yyextra->name);
1765 }
1766 yyextra->parmType.clear();yyextra->parmName.clear();
1768 if (*yytext==';' || yyextra->insideBody)
1769 {
1770 if (!yyextra->insideBody)
1771 {
1772 yyextra->theVarContext.popScope();
1773 }
1774 yyextra->name.clear();yyextra->type.clear();
1775 BEGIN( Body );
1776 }
1777 else
1778 {
1779 yyextra->bracketCount=0;
1780 BEGIN( SkipInits );
1781 }
1782 }
1783<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1787 }
1788<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1789 if (yyextra->insideBody)
1790 {
1791 yyextra->theVarContext.pushScope();
1792 }
1793 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1794
1795 yyextra->parmType.clear();yyextra->parmName.clear();
1796 int index = yyextra->name.findRev("::");
1797 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1798 if (index!=-1)
1799 {
1801 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1803 if (cd)
1804 {
1807 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1808 }
1809 else
1810 {
1811
1813 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1814 }
1815 }
1816 else
1817 {
1818 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1820 }
1821 yytext[yyleng-1]='\0';
1823 if (!cv.stripWhiteSpace().isEmpty())
1824 {
1828 }
1829 else
1830 {
1832 }
1833 yyextra->code->codify("{");
1834 if (yyextra->searchingForBody)
1835 {
1836 yyextra->searchingForBody=
FALSE;
1837 yyextra->insideBody=
TRUE;
1838 }
1839 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1840 yyextra->type.clear(); yyextra->name.clear();
1841 BEGIN( Body );
1842 }
static void setClassScope(yyscan_t yyscanner, const QCString &name)
1843<CallEnd>"try" { // function-try-block
1845 yyextra->code->codify(yytext);
1847 yyextra->inFunctionTryBlock=
TRUE;
1848 }
1849<CallEnd>"requires" { // function-try-block
1851 yyextra->code->codify(yytext);
1853 }
1854<CallEnd>{ID} {
1855 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1856 {
1857 REJECT;
1858 }
1859
1861 yyextra->parmName=yytext;
1863 BEGIN(OldStyleArgs);
1864 }
1865<OldStyleArgs>{ID} {
1867 yyextra->parmName=yytext;
1869 }
1870<OldStyleArgs>[,;] {
1871 yyextra->code->codify(yytext);
1872 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1873 if (*yytext==';') yyextra->parmType.clear();
1874 yyextra->parmName.clear();
1875 }
1876<CallEnd,OldStyleArgs>"#" {
1878 yyextra->lastSkipCppContext = Body;
1879 yyextra->code->codify(yytext);
1880 BEGIN( SkipCPP );
1881 }
1882<CallEnd>. {
1883 unput(*yytext);
1884 if (!yyextra->insideBody)
1885 {
1886 yyextra->theVarContext.popScope();
1887 }
1888 yyextra->name.clear();yyextra->args.clear();
1889 yyextra->parmType.clear();yyextra->parmName.clear();
1890 BEGIN( Body );
1891 }
1892<SkipInits>";" {
1893 yyextra->code->codify(yytext);
1894 yyextra->type.clear(); yyextra->name.clear();
1895 BEGIN( Body );
1896 }
1897<SkipInits>"{" {
1898 yyextra->code->codify(yytext);
1899 if (yyextra->searchingForBody)
1900 {
1901 yyextra->searchingForBody=
FALSE;
1902 yyextra->insideBody=
TRUE;
1903 }
1904 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1905 if (yyextra->name.find("::")!=-1)
1906 {
1907 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1910 }
1911 else
1912 {
1913 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1915 }
1916 yyextra->type.clear(); yyextra->name.clear();
1917 BEGIN( Body );
1918 }
1919<SkipInits>{ID}{B}*"{" {
1921 int bracketPos = text.
find(
'{');
1922 int spacePos = text.
find(
' ');
1923 int len = spacePos==-1 ? bracketPos : spacePos;
1925 yyextra->code->codify(yytext+len);
1926 }
1927<SkipInits>{ID} {
1929 }
1930<FuncCall>{ID}/"(" {
1932 }
1933<FuncCall>{ID}/("."|"->") {
1934 yyextra->name=yytext;
1936 BEGIN( MemberCall2 );
1937 }
1938<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1939 yyextra->code->codify(yytext);
1940 uint32_t s=0;
while (!
isId(yytext[s])) s++;
1941 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1942 yyextra->name=((
QCString)yytext).mid(s,e-s+1);
1943 BEGIN( MemberCall2 );
1944 }
1945<MemberCall2>{ID}/([ \t\n]*"(") {
1946 if (!yyextra->args.isEmpty())
1948 else
1950 yyextra->args.clear();
1951 BEGIN( FuncCall );
1952 }
static void generateMemberLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &varName, const QCString &memName)
1953<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1954
1955 yyextra->name=yytext;
1957 BEGIN( MemberCall2 );
1958 }
1959<MemberCall2>"->"|"." {
1960 if (yytext[0]=='-')
1961 {
1963 }
1964 yyextra->code->codify(yytext);
1965 yyextra->memCallContext = YY_START;
1966 BEGIN( MemberCall );
1967 }
1968<SkipComment>{CCS}("!"?){CCE} {
1969 yyextra->code->codify(yytext);
1971 BEGIN( yyextra->lastCContext ) ;
1972 }
1973<SkipComment>{CPPC}|{CCS} {
1974 yyextra->code->codify(yytext);
1975 }
1976<SkipComment>[^*\/\n]+ {
1977 yyextra->code->codify(yytext);
1978 }
1979<SkipComment>[ \t]*{CCE} {
1980 yyextra->code->codify(yytext);
1982 if (yyextra->lastCContext==SkipCPP)
1983 {
1985 }
1986 BEGIN( yyextra->lastCContext ) ;
1987 }
1988<SkipCxxComment>[^\r\n]*"\\"[\r]?\n { // line continuation
1990 }
1991<SkipCxxComment>[^\r\n]+ {
1992 yyextra->code->codify(yytext);
1993 }
1994<SkipCxxComment>\r
1995<SkipCxxComment>\n {
1996 unput('\n');
1998 BEGIN( yyextra->lastCContext ) ;
1999 }
2000<SkipCxxComment>. {
2001 yyextra->code->codify(yytext);
2002 }
2003<MemberCall>[^a-z_A-Z0-9(\n] {
2004 yyextra->code->codify(yytext);
2005 yyextra->type.clear();
2006 yyextra->name.clear();
2007 BEGIN(yyextra->memCallContext);
2008 }
2009<*>\n({B}*{CPPC}[!/][^\n]*\n)+ { // remove special one-line comment
2010 if (YY_START==SkipCPP) REJECT;
2015 if (YY_START==SkipCxxComment)
2016 {
2017 BEGIN( yyextra->lastCContext ) ;
2018 }
2019 }
2020<SkipCPP>\n/(.|\n) {
2022 BEGIN( yyextra->lastSkipCppContext ) ;
2023 unput('\n');
2024 }
2025<*>\n{B}*{CPPC}"@"[{}].*\n { // remove one-line group marker
2030 if (YY_START==SkipCxxComment)
2031 {
2032 BEGIN( yyextra->lastCContext ) ;
2033 }
2034 }
2035<*>\n{B}*{CCS}"@"[{}] { // remove one-line group marker
2036
2037 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2038 {
2039 yyextra->lastCContext = YY_START ;
2040 }
2043 BEGIN(SkipComment);
2044 }
2045<*>^{B}*{CPPC}"@"[{}].*\n { // remove one-line group marker
2050 }
2051<*>^{B}*{CCS}"@"[{}] { // remove multi-line group marker
2052
2053 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2054 {
2055 yyextra->lastCContext = YY_START ;
2056 }
2058 yyextra->code->codify(yytext);
2059 BEGIN(SkipComment);
2060 }
2061<*>^{B}*{CPPC}[!/][^\n]* { // remove special one-line comment
2065 }
2066<*>{CPPC}[!/][^\n]* { // strip special one-line comment
2067 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2071 }
2072<*>\n{B}*{CCS}[!*]/{NCOMM} {
2073
2074 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2075 {
2076 yyextra->lastCContext = YY_START ;
2077 }
2080 BEGIN(SkipComment);
2081 }
2082<*>^{B}*{CCS}"*"[*]+/[^/] {
2083
2084 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2085 {
2086 yyextra->lastCContext = YY_START ;
2087 }
2088
2090 yyextra->code->codify(yytext);
2091 BEGIN(SkipComment);
2092 }
2093<*>^{B}*{CCS}[!*]/{NCOMM} { // special C comment block at a new line
2094
2095 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2096 {
2097 yyextra->lastCContext = YY_START ;
2098 }
2100 yyextra->code->codify(yytext);
2101 BEGIN(SkipComment);
2102 }
2103<*>{CCS}[!*]/{NCOMM} { // special C comment block half way a line
2104 if (YY_START==SkipString) REJECT;
2105
2106 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2107 {
2108 yyextra->lastCContext = YY_START ;
2109 }
2111 yyextra->code->codify(yytext);
2112 BEGIN(SkipComment);
2113 }
2114<*>{CCS}("!"?){CCE} {
2115 if (YY_START==SkipString) REJECT;
2118 yyextra->code->codify(yytext);
2120 }
2121<SkipComment>[^\*\n]+ {
2122 yyextra->code->codify(yytext);
2123 }
2124<*>{CCS} {
2126 yyextra->code->codify(yytext);
2127
2128 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2129 {
2130 yyextra->lastCContext = YY_START ;
2131 }
2132 BEGIN( SkipComment ) ;
2133 }
2134<*>[$]?@\" { // C# (interpolated) verbatim string
2136 yyextra->code->codify(yytext);
2137 yyextra->lastVerbStringContext=YY_START;
2138 BEGIN(SkipVerbString);
2139 }
2140<*>{CPPC} {
2142 yyextra->code->codify(yytext);
2143 yyextra->lastCContext = YY_START ;
2144 BEGIN( SkipCxxComment ) ;
2145 }
2146<*>"("|"[" {
2147 if (yytext[0]=='(') yyextra->bracketCount++;
2148 yyextra->code->codify(yytext);
2149 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2150 }
2151<*>")"|"]" {
2152 if (yytext[0]==')') yyextra->bracketCount--;
2153 yyextra->code->codify(yytext);
2154 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2155 }
2156<*>\n {
2158 }
2159<*>[\x80-\xFF]* { // keep utf8 characters together...
2160 yyextra->code->codify(yytext);
2161 }
2162<*>. {
2163 yyextra->code->codify(yytext);
2164 }
2165
2166%%