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 {
528 found = true;
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}*"(" {
1365 if (yyextra->theCallContext.getScope().globalDef())
1366 {
1368 {
1371 }
1372 yyextra->name.clear();
1373 }
1374 else
1375 {
1378 yyextra->name.clear();
1379 }
1380 yyextra->type.clear();
1381 if (yyextra->memCallContext==Body)
1382 {
1383 BEGIN(FuncCall);
1384 }
1385 else
1386 {
1387 BEGIN(yyextra->memCallContext);
1388 }
1389 }
1390<MemberCall>{SCOPENAME}/{B}* {
1391 if (yyextra->theCallContext.getScope().globalDef())
1392 {
1393 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1395 {
1398 }
1399 yyextra->name.clear();
1400 }
1401 else
1402 {
1403 DBG_CTX((stderr,
"no class context!\n"));
1406 yyextra->name.clear();
1407 }
1408 yyextra->type.clear();
1409 BEGIN(yyextra->memCallContext);
1410 }
1411<Body>[,=;\[{] {
1412 if (yyextra->insideObjC && *yytext=='[')
1413 {
1414 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
1415
1416 yyextra->contextMap.clear();
1417 yyextra->nameMap.clear();
1418 yyextra->objectMap.clear();
1419 yyextra->wordMap.clear();
1420 yyextra->commentMap.clear();
1421 yyextra->currentCtxId = 0;
1422 yyextra->currentNameId = 0;
1423 yyextra->currentObjId = 0;
1424 yyextra->currentCtx = nullptr;
1425 yyextra->braceCount = 0;
1426 unput('[');
1427 BEGIN(ObjCCall);
1428 }
1429 else
1430 {
1431 if (*yytext!='{') yyextra->code->codify(yytext);
1432 yyextra->saveName = yyextra->name;
1433 yyextra->saveType = yyextra->type;
1434 if (*yytext!='[' && !yyextra->type.isEmpty())
1435 {
1436
1437
1438 {
1439
1440
1441 addVariable(yyscanner,yyextra->type,yyextra->name);
1442 }
1443 yyextra->name.clear();
1444 }
1445 if (*yytext==';' || *yytext=='=' || *yytext=='{')
1446 {
1447 yyextra->type.clear();
1448 yyextra->name.clear();
1449 }
1450 else if (*yytext=='[')
1451 {
1452 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1453 }
1454 yyextra->args.clear();
1455 yyextra->parmType.clear();
1456 yyextra->parmName.clear();
1457 if (*yytext=='{')
1458 {
1459 BEGIN( BodyVar );
1460 unput('{');
1461 }
1462 }
1463 }
1464<Body,FuncCall,BodyVar>"{" {
1465 yyextra->theVarContext.pushScope();
1466 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1467 yyextra->bracketCount = 0;
1468
1470 if (yyextra->type.find("enum ")!=-1)
1471 {
1472 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1475 }
1476 else
1477 {
1478 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1480 }
1481
1482 if (yyextra->searchingForBody)
1483 {
1484 yyextra->searchingForBody=false;
1485 yyextra->insideBody=true;
1486 }
1487 yyextra->code->codify(yytext);
1488 if (yyextra->insideBody)
1489 {
1490 yyextra->bodyCurlyCount++;
1491 }
1492 yyextra->type.clear();
1493 yyextra->name.clear();
1494 BEGIN( Body );
1495 }
1496<ObjCCall,ObjCMName>"["|"{" {
1498 yyextra->currentCtx->format+=*yytext;
1499 BEGIN(ObjCCall);
1501 }
static void saveObjCContext(yyscan_t yyscanner)
1502<ObjCCall,ObjCMName>"]"|"}" {
1503 yyextra->currentCtx->format+=*yytext;
1505 BEGIN(ObjCMName);
1506 if (yyextra->currentCtx==nullptr)
1507 {
1508
1510 auto it = yyextra->contextMap.find(0);
1511 if (it!=yyextra->contextMap.end())
1512 {
1513 ctx = it->second.get();
1514 }
1516 BEGIN(Body);
1517 }
1519 }
static void restoreObjCContext(yyscan_t yyscanner)
1520<ObjCCall,ObjCMName>{CPPC}.* {
1521 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1522 }
static QCString escapeComment(yyscan_t yyscanner, const QCString &s)
1523<ObjCCall,ObjCMName>{CCS} {
1524 yyextra->lastObjCCallContext = YY_START;
1525 yyextra->currentCtx->comment.str(yytext);
1526 BEGIN(ObjCCallComment);
1527 }
1528<ObjCCallComment>{CCE} {
1529 yyextra->currentCtx->comment << yytext;
1530 yyextra->currentCtx->format+=
escapeComment(yyscanner,yyextra->currentCtx->comment.str());
1531 BEGIN(yyextra->lastObjCCallContext);
1532 }
1533<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
1534<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
1535<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
1536<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
1537<ObjCCall>{ID}({B}*"."{B}*{ID})* {
1538 yyextra->currentCtx->format+=
escapeObject(yyscanner,yytext);
1539 if (yyextra->braceCount==0)
1540 {
1541 yyextra->currentCtx->objectTypeOrName=yytext;
1542 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1543 BEGIN(ObjCMName);
1544 }
1545 }
static QCString escapeObject(yyscan_t yyscanner, const QCString &s)
1546<ObjCMName>{ID}/{BN}*"]" {
1547 if (yyextra->braceCount==0 &&
1548 yyextra->currentCtx->methodName.isEmpty())
1549 {
1550 yyextra->currentCtx->methodName=yytext;
1551 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1552 }
1553 else
1554 {
1555 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1556 }
1557 }
static QCString escapeWord(yyscan_t yyscanner, const QCString &s)
static QCString escapeName(yyscan_t yyscanner, const QCString &s)
1558<ObjCMName>{ID}/{BN}*":" {
1559 if (yyextra->braceCount==0)
1560 {
1561 yyextra->currentCtx->methodName+=yytext;
1562 yyextra->currentCtx->methodName+=":";
1563 }
1564 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1565 }
1566<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1567<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1568<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1569 BEGIN(yyextra->lastStringContext);
1570 }
1571<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1572<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1573 yyextra->lastStringContext=YY_START;
1574 BEGIN(ObjCSkipStr);
1575 }
1576<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+="$$"; }
1577<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
1578<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
1579<ObjCSkipStr>"@"/"\"" { // needed to prevent matching the global rule (for C#)
1580 yyextra->currentCtx->format+=yytext;
1581 }
1582<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=escapeWord(yyscanner,yytext); }
1583<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
1584<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
1585
1586<Body>"]" {
1587 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1588 yyextra->code->codify(yytext);
1589
1590 yyextra->name = yyextra->saveName;
1591 yyextra->type = yyextra->saveType;
1592 }
1593<Body>[0-9]+ {
1594 yyextra->code->codify(yytext);
1595 }
1596<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1597 yyextra->code->codify(yytext);
1598 }
1599<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1600
1601
1604 yyextra->code->codify(yytext);
1606 }
1607<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1609 yyextra->parmName=yytext;
1611 yyextra->code->codify(yytext);
1613 }
static void addParmType(yyscan_t yyscanner)
1614<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1615 if (yyextra->lang!=SrcLangExt::Slice)
1616 {
1617 REJECT;
1618 }
1619 else
1620 {
1622 yyextra->parmName=yytext;
1624 yyextra->code->codify(yytext);
1626 }
1627 }
1628<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1630 yyextra->parmName=yytext;
1632 yyextra->code->codify(yytext);
1634 }
1635<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1638 yyextra->parmName=yytext;
1640 yyextra->code->codify(yytext);
1642 }
1643<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1645 {
1646 REJECT;
1647 }
1649 yyextra->parmName=yytext;
1651 }
1652<FuncCall>";" { // probably a cast, not a function call
1653 yyextra->code->codify(yytext);
1654 yyextra->inForEachExpression = false;
1655 BEGIN( Body );
1656 }
1657<MemberCall2,FuncCall>, {
1658 yyextra->code->codify(yytext);
1659 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1660 yyextra->parmType.clear();yyextra->parmName.clear();
1661 }
1662<MemberCall2,FuncCall>"{" {
1663 if (yyextra->bracketCount>0)
1664 {
1665 yyextra->code->codify(yytext);
1666 yyextra->skipInlineInitContext=YY_START;
1667 yyextra->curlyCount=0;
1668 BEGIN(InlineInit);
1669 }
1670 else
1671 {
1672 REJECT;
1673 }
1674 }
1675<InlineInit>"{" { yyextra->curlyCount++;
1676 yyextra->code->codify(yytext);
1677 }
1678<InlineInit>"}" {
1679 yyextra->code->codify(yytext);
1680 if (--yyextra->curlyCount<=0)
1681 {
1682 BEGIN(yyextra->skipInlineInitContext);
1683 }
1684 }
1685<InlineInit>\n {
1687 }
1688<InlineInit>. {
1689 yyextra->code->codify(yytext);
1690 }
1691<MemberCall2,FuncCall>"(" {
1692 yyextra->parmType.clear();yyextra->parmName.clear();
1693 yyextra->code->codify(yytext);
1694 yyextra->bracketCount++;
1695 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1696 if (YY_START==FuncCall && !yyextra->insideBody)
1697 {
1698 yyextra->theVarContext.pushScope();
1699 }
1700 }
1701<MemberCall2,FuncCall>{OPERATOR} { // operator
1706 {
1707
1708 yyextra->parmType.clear();yyextra->parmName.clear();
1709 }
1710 yyextra->code->codify(yytext);
1711 }
1712<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1713 if (yytext[0]==')')
1714 {
1715 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1716 if (yyextra->parmType.isEmpty())
1717 {
1718 yyextra->parmType=yyextra->parmName;
1719 yyextra->parmName.clear();
1720 }
1721 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1722 }
1723 else
1724 {
1725 yyextra->parmType = yyextra->parmName;
1726 yyextra->parmName.clear();
1727 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1728 }
1729 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1730 yyextra->inForEachExpression = false;
1731
1732 yyextra->code->codify(yytext);
1733 if (--yyextra->bracketCount<=0)
1734 {
1735 if (yyextra->name.isEmpty())
1736 {
1737 BEGIN( Body );
1738 }
1739 else
1740 {
1741 BEGIN( CallEnd );
1742 }
1743 }
1744 }
1745<MemberCall,MemberCall2,FuncCall>[;:] { // recover from unexpected end of call
1746
1747 if (yyextra->bracketCount<=0)
1748 {
1749 unput(*yytext);
1750 BEGIN(CallEnd);
1751 }
1752 else
1753 {
1754 yyextra->code->codify(yytext);
1755 }
1756 }
1757<CallEnd>[ \t\n]* { codifyLines(yyscanner,yytext); }
1758<CallEnd>[;:] {
1760 yyextra->bracketCount=0;
1761 if (*yytext==';') yyextra->searchingForBody=false;
1762 if (!yyextra->type.isEmpty())
1763 {
1764 DBG_CTX((stderr,
"add variable yyextra->type=%s yyextra->name=%s)\n",
qPrint(yyextra->type),
qPrint(yyextra->name)));
1765 addVariable(yyscanner,yyextra->type,yyextra->name);
1766 }
1767 yyextra->parmType.clear();yyextra->parmName.clear();
1769 if (*yytext==';' || yyextra->insideBody)
1770 {
1771 if (!yyextra->insideBody)
1772 {
1773 yyextra->theVarContext.popScope();
1774 }
1775 yyextra->name.clear();yyextra->type.clear();
1776 BEGIN( Body );
1777 }
1778 else
1779 {
1780 yyextra->bracketCount=0;
1781 BEGIN( SkipInits );
1782 }
1783 }
1784<CallEnd>"=>" { // C# Expression Body
1785 if (yyextra->lang!=SrcLangExt::CSharp || yyextra->insideBody)
1786 {
1787 REJECT;
1788 }
1789 else
1790 {
1791 yyextra->code->codify("=>");
1792 BEGIN( Body );
1793 }
1794 }
1795<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1799 }
1800<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1801 if (yyextra->insideBody)
1802 {
1803 yyextra->theVarContext.pushScope();
1804 }
1805 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1806
1807 yyextra->parmType.clear();yyextra->parmName.clear();
1808 int index = yyextra->name.findRev("::");
1809 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1810 if (index!=-1)
1811 {
1813 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1815 if (cd)
1816 {
1819 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1820 }
1821 else
1822 {
1823
1825 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1826 }
1827 }
1828 else
1829 {
1830 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1832 }
1833 yytext[yyleng-1]='\0';
1835 if (!cv.stripWhiteSpace().isEmpty())
1836 {
1840 }
1841 else
1842 {
1844 }
1845 yyextra->code->codify("{");
1846 if (yyextra->searchingForBody)
1847 {
1848 yyextra->searchingForBody=false;
1849 yyextra->insideBody=true;
1850 }
1851 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1852 yyextra->type.clear(); yyextra->name.clear();
1853 BEGIN( Body );
1854 }
static void setClassScope(yyscan_t yyscanner, const QCString &name)
1855<CallEnd>"try" { // function-try-block
1857 yyextra->code->codify(yytext);
1859 yyextra->inFunctionTryBlock=true;
1860 }
1861<CallEnd>"requires" { // function-try-block
1863 yyextra->code->codify(yytext);
1865 }
1866<CallEnd>{ID} {
1867 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1868 {
1869 REJECT;
1870 }
1871
1873 yyextra->parmName=yytext;
1875 BEGIN(OldStyleArgs);
1876 }
1877<OldStyleArgs>{ID} {
1879 yyextra->parmName=yytext;
1881 }
1882<OldStyleArgs>[,;] {
1883 yyextra->code->codify(yytext);
1884 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1885 if (*yytext==';') yyextra->parmType.clear();
1886 yyextra->parmName.clear();
1887 }
1888<CallEnd,OldStyleArgs>"#" {
1890 yyextra->lastSkipCppContext = Body;
1891 yyextra->code->codify(yytext);
1892 BEGIN( SkipCPP );
1893 }
1894<CallEnd>. {
1895 unput(*yytext);
1896 if (!yyextra->insideBody)
1897 {
1898 yyextra->theVarContext.popScope();
1899 }
1900 yyextra->name.clear();yyextra->args.clear();
1901 yyextra->parmType.clear();yyextra->parmName.clear();
1902 BEGIN( Body );
1903 }
1904<SkipInits>";" {
1905 yyextra->code->codify(yytext);
1906 yyextra->type.clear(); yyextra->name.clear();
1907 BEGIN( Body );
1908 }
1909<SkipInits>"{" {
1910 yyextra->code->codify(yytext);
1911 if (yyextra->searchingForBody)
1912 {
1913 yyextra->searchingForBody=false;
1914 yyextra->insideBody=true;
1915 }
1916 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1917 if (yyextra->name.find("::")!=-1)
1918 {
1919 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1922 }
1923 else
1924 {
1925 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1927 }
1928 yyextra->type.clear(); yyextra->name.clear();
1929 BEGIN( Body );
1930 }
1931<SkipInits>{ID}{B}*"{" {
1933 int bracketPos = text.
find(
'{');
1934 int spacePos = text.
find(
' ');
1935 int len = spacePos==-1 ? bracketPos : spacePos;
1937 yyextra->code->codify(yytext+len);
1938 }
1939<SkipInits>{ID} {
1941 }
1942<FuncCall>{ID}/"(" {
1944 }
1945<FuncCall>{ID}/("."|"->") {
1946 yyextra->name=yytext;
1948 BEGIN( MemberCall2 );
1949 }
1950<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1951 yyextra->code->codify(yytext);
1952 uint32_t s=0;
while (!
isId(yytext[s])) s++;
1953 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1954 yyextra->name=((
QCString)yytext).mid(s,e-s+1);
1955 BEGIN( MemberCall2 );
1956 }
1957<MemberCall2>{ID}/([ \t\n]*"(") {
1958 if (!yyextra->args.isEmpty())
1960 else
1962 yyextra->args.clear();
1963 BEGIN( FuncCall );
1964 }
static void generateMemberLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &varName, const QCString &memName)
1965<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1966
1967 yyextra->name=yytext;
1969 BEGIN( MemberCall2 );
1970 }
1971<MemberCall2>"->"|"." {
1972 if (yytext[0]=='-')
1973 {
1975 }
1976 yyextra->code->codify(yytext);
1977 yyextra->memCallContext = YY_START;
1978 BEGIN( MemberCall );
1979 }
1980<SkipComment>{CCS}("!"?){CCE} {
1981 yyextra->code->codify(yytext);
1983 BEGIN( yyextra->lastCContext ) ;
1984 }
1985<SkipComment>{CPPC}|{CCS} {
1986 yyextra->code->codify(yytext);
1987 }
1988<SkipComment>[^*\/\n]+ {
1989 yyextra->code->codify(yytext);
1990 }
1991<SkipComment>[ \t]*{CCE} {
1992 yyextra->code->codify(yytext);
1994 if (yyextra->lastCContext==SkipCPP)
1995 {
1997 }
1998 BEGIN( yyextra->lastCContext ) ;
1999 }
2000<SkipCxxComment>[^\r\n]*"\\"[\r]?\n { // line continuation
2002 }
2003<SkipCxxComment>[^\r\n]+ {
2004 yyextra->code->codify(yytext);
2005 }
2006<SkipCxxComment>\r
2007<SkipCxxComment>\n {
2008 unput('\n');
2010 BEGIN( yyextra->lastCContext ) ;
2011 }
2012<SkipCxxComment>. {
2013 yyextra->code->codify(yytext);
2014 }
2015<MemberCall>[^a-z_A-Z0-9(\n] {
2016 yyextra->code->codify(yytext);
2017 yyextra->type.clear();
2018 yyextra->name.clear();
2019 BEGIN(yyextra->memCallContext);
2020 }
2021<*>\n({B}*{CPPC}[!/][^\n]*\n)+ { // remove special one-line comment
2022 if (YY_START==SkipCPP) REJECT;
2027 if (YY_START==SkipCxxComment)
2028 {
2029 BEGIN( yyextra->lastCContext ) ;
2030 }
2031 }
2032<SkipCPP>\n/(.|\n) {
2034 BEGIN( yyextra->lastSkipCppContext ) ;
2035 unput('\n');
2036 }
2037<*>\n{B}*{CPPC}"@"[{}].*\n { // remove one-line group marker
2042 if (YY_START==SkipCxxComment)
2043 {
2044 BEGIN( yyextra->lastCContext ) ;
2045 }
2046 }
2047<*>\n{B}*{CCS}"@"[{}] { // remove one-line group marker
2048
2049 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2050 {
2051 yyextra->lastCContext = YY_START ;
2052 }
2055 BEGIN(SkipComment);
2056 }
2057<*>^{B}*{CPPC}"@"[{}].*\n { // remove one-line group marker
2062 }
2063<*>^{B}*{CCS}"@"[{}] { // remove multi-line group marker
2064
2065 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2066 {
2067 yyextra->lastCContext = YY_START ;
2068 }
2070 yyextra->code->codify(yytext);
2071 BEGIN(SkipComment);
2072 }
2073<*>^{B}*{CPPC}[!/][^\n]* { // remove special one-line comment
2077 }
2078<*>{CPPC}[!/][^\n]* { // strip special one-line comment
2079 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2083 }
2084<*>\n{B}*{CCS}[!*]/{NCOMM} {
2085
2086 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2087 {
2088 yyextra->lastCContext = YY_START ;
2089 }
2092 BEGIN(SkipComment);
2093 }
2094<*>^{B}*{CCS}"*"[*]+/[^/] {
2095
2096 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2097 {
2098 yyextra->lastCContext = YY_START ;
2099 }
2100
2102 yyextra->code->codify(yytext);
2103 BEGIN(SkipComment);
2104 }
2105<*>^{B}*{CCS}[!*]/{NCOMM} { // special C comment block at a new line
2106
2107 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2108 {
2109 yyextra->lastCContext = YY_START ;
2110 }
2112 yyextra->code->codify(yytext);
2113 BEGIN(SkipComment);
2114 }
2115<*>{CCS}[!*]/{NCOMM} { // special C comment block half way a line
2116 if (YY_START==SkipString) REJECT;
2117
2118 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2119 {
2120 yyextra->lastCContext = YY_START ;
2121 }
2123 yyextra->code->codify(yytext);
2124 BEGIN(SkipComment);
2125 }
2126<*>{CCS}("!"?){CCE} {
2127 if (YY_START==SkipString) REJECT;
2130 yyextra->code->codify(yytext);
2132 }
2133<SkipComment>[^\*\n]+ {
2134 yyextra->code->codify(yytext);
2135 }
2136<*>{CCS} {
2138 yyextra->code->codify(yytext);
2139
2140 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2141 {
2142 yyextra->lastCContext = YY_START ;
2143 }
2144 BEGIN( SkipComment ) ;
2145 }
2146<*>[$]?@\" { // C# (interpolated) verbatim string
2148 yyextra->code->codify(yytext);
2149 yyextra->lastVerbStringContext=YY_START;
2150 BEGIN(SkipVerbString);
2151 }
2152<*>{CPPC} {
2154 yyextra->code->codify(yytext);
2155 yyextra->lastCContext = YY_START ;
2156 BEGIN( SkipCxxComment ) ;
2157 }
2158<*>"("|"[" {
2159 if (yytext[0]=='(') yyextra->bracketCount++;
2160 yyextra->code->codify(yytext);
2161 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2162 }
2163<*>")"|"]" {
2164 if (yytext[0]==')') yyextra->bracketCount--;
2165 yyextra->code->codify(yytext);
2166 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2167 }
2168<*>\n {
2170 }
2171<*>[\x80-\xFF]* { // keep utf8 characters together...
2172 yyextra->code->codify(yytext);
2173 }
2174<*>. {
2175 yyextra->code->codify(yytext);
2176 }
2177
2178%%