386 {
388 yyextra->code->codify(yytext);
389 BEGIN( ReadInclude );
390 }
391<Body>("@interface"|"@implementation"|"@protocol")[ \t\n]+ {
392 yyextra->insideObjC=
TRUE;
396 if (!yyextra->insideTemplate)
397 BEGIN( ClassName );
398 }
399<Body>(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") {
400 if (yyextra->insideTemplate) REJECT;
404 BEGIN( ClassName );
405 }
406<Body>"property"|"event"/{BN}* {
407 if (yyextra->insideTemplate) REJECT;
411 }
412<Body>("partial"{B}+)?("class"|"struct"|"union"|"namespace"|"interface"){B}+ {
416 if (!yyextra->insideTemplate)
417 BEGIN( ClassName );
418 }
419<Body>("package")[ \t\n]+ {
423 BEGIN( PackageName );
424 }
425<ClassVar>\n {
426 if (!yyextra->insideObjC) REJECT;
428 BEGIN(Body);
429 }
430<Body,ClassVar,Bases>"-"|"+" {
431 if (!yyextra->insideObjC || yyextra->insideBody)
432 {
433 yyextra->code->codify(yytext);
434 }
435 else
436 {
437 DBG_CTX((stderr,
"Start of Objective-C method!\n"));
438 yyextra->code->codify(yytext);
439 BEGIN(ObjCMethod);
440 }
441 }
442<ObjCMethod>":" {
443 yyextra->code->codify(yytext);
444 BEGIN(ObjCParams);
445 }
446<ObjCParams>"(" {
447 yyextra->code->codify(yytext);
448 BEGIN(ObjCParamType);
449 }
450<ObjCParams,ObjCMethod>";"|"{" {
451 yyextra->code->codify(yytext);
452 if (*yytext=='{')
453 {
454 if (yyextra->searchingForBody)
455 {
456 yyextra->searchingForBody=
FALSE;
457 yyextra->insideBody=
TRUE;
458 }
459 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
460 if (!yyextra->curClassName.isEmpty())
461 {
462 pushScope(yyscanner,yyextra->curClassName);
463 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
465 }
466 }
467 yyextra->type.clear();
468 yyextra->name.clear();
469 BEGIN(Body);
470 }
471<ObjCParams>{ID}{B}*":" {
472 yyextra->code->codify(yytext);
473 }
474<ObjCParamType>{TYPEKW} {
476 yyextra->code->codify(yytext);
478 yyextra->parmType=yytext;
479 }
480<ObjCParamType>{ID} {
482 yyextra->parmType=yytext;
483 }
484<ObjCParamType>")" {
485 yyextra->code->codify(yytext);
486 BEGIN(ObjCParams);
487 }
488<ObjCParams>{ID} {
489 yyextra->code->codify(yytext);
490 yyextra->parmName=yytext;
491 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
492 yyextra->parmType.clear();yyextra->parmName.clear();
493 }
494<ObjCMethod,ObjCParams,ObjCParamType>{ID} {
496 }
497<ObjCMethod,ObjCParams,ObjCParamType>. {
498 yyextra->code->codify(yytext);
499 }
500<ObjCMethod,ObjCParams,ObjCParamType>\n {
502 }
503<ReadInclude>[^\n\">]+/(">"|"\"") {
504
505 bool found = false;
506 bool ambig = false;
509
511 {
512 if (ambig)
513 {
514 DBG_CTX((stderr,
"===== yes %s is ambiguous\n",yytext));
516 if (!name.isEmpty() && yyextra->sourceFileDef)
517 {
519 if (fn)
520 {
521
522 auto it = std::find_if(fn->begin(),
523 fn->end(),
524 [&sfd=yyextra->sourceFileDef]
525 (const auto &lfd)
526 { return sfd->isIncluded(lfd->absFilePath()); });
527 found = it!=fn->end();
528 }
529 }
530 }
531 else
532 {
534 }
535 }
537 if (found)
538 {
540 }
541 else
542 {
543 yyextra->code->codify(yytext);
544 }
545 char c=(char)yyinput(yyscanner);
547 text+=c;
548 yyextra->code->codify(text);
550 BEGIN( Body );
551 }
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)
552<Body,Bases>^[ \t]*"#" {
554 yyextra->lastSkipCppContext = YY_START;
555 yyextra->code->codify(yytext);
556 BEGIN( SkipCPP ) ;
557 }
558<SkipCPP>\" {
559 yyextra->code->codify(yytext);
560 yyextra->lastStringContext=YY_START;
561 BEGIN( SkipString ) ;
562 }
563<SkipCPP>. {
564 yyextra->code->codify(yytext);
565 }
566<SkipCPP>[^\n\/\\\"]+ {
567 yyextra->code->codify(yytext);
568 }
569<SkipCPP>\\[\r]?\n {
571 }
572<SkipCPP>{CPPC}/[^/!] {
573 REJECT;
574 }
575<Body,FuncCall,MemberCall,MemberCall2>"}" {
576 yyextra->theVarContext.popScope();
577 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
578 yyextra->type.clear();
579 yyextra->name.clear();
580
581 if (!yyextra->scopeStack.empty())
582 {
583 int scope = yyextra->scopeStack.top();
584 yyextra->scopeStack.pop();
587 {
589 }
590 }
591
592 yyextra->code->codify(yytext);
593
594 DBG_CTX((stderr,
"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount));
595 if (--yyextra->bodyCurlyCount<=0)
596 {
597 yyextra->insideBody=
FALSE;
598 yyextra->currentMemberDef=nullptr;
599 if (yyextra->currentDefinition)
600 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
601 }
602 BEGIN(Body);
603 }
604<Body,ClassVar>"@end" {
605 DBG_CTX((stderr,
"End of objc scope fd=%s\n",
qPrint(yyextra->sourceFileDef->name())));
606 if (yyextra->sourceFileDef)
607 {
608 const FileDef *fd=yyextra->sourceFileDef;
611 DBG_CTX((stderr,
"insideObjC=%d\n",yyextra->insideObjC));
612 }
613 else
614 {
615 yyextra->insideObjC =
FALSE;
616 }
617 if (yyextra->insideBody)
618 {
619 yyextra->theVarContext.popScope();
bool endsWith(const char *s) const
620
621 if (!yyextra->scopeStack.empty())
622 {
623 int scope = yyextra->scopeStack.top();
624 yyextra->scopeStack.pop();
627 {
629 }
630 }
631 yyextra->insideBody=
FALSE;
632 }
633
635 yyextra->code->codify(yytext);
637
638 yyextra->currentMemberDef=nullptr;
639 if (yyextra->currentDefinition)
640 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
641 BEGIN(Body);
642 }
643<ClassName,ClassVar>";" {
644 if (yyextra->lang==SrcLangExt::CSharp)
645 {
646 yyextra->code->codify(yytext);
647 yyextra->skipCodify = true;
648 unput('{');
649 }
650 else
651 {
652 yyextra->code->codify(yytext);
653 yyextra->searchingForBody=
FALSE;
654 BEGIN( Body );
655 }
656 }
657<ClassName,ClassVar>[*&^%]+ {
658 yyextra->type=yyextra->curClassName;
659 yyextra->name.clear();
660 yyextra->code->codify(yytext);
661 BEGIN( Body );
662 }
663<ClassName>"__declspec"{B}*"("{B}*{ID}{B}*")" {
665 yyextra->code->codify(yytext);
667 }
668<ClassName>{ID}("."{ID})* |
669<ClassName>{ID}("::"{ID})* {
670 if (yyextra->lang==SrcLangExt::CSharp)
671 yyextra->curClassName=
substitute(yytext,
".",
"::");
672 else
673 yyextra->curClassName=yytext;
675 if (yyextra->curClassName=="alignas")
676 {
678 yyextra->code->codify(yytext);
680 BEGIN( AlignAs );
681 }
682 else
683 {
685 BEGIN( ClassVar );
686 }
687 }
static void addType(yyscan_t yyscanner)
688<AlignAs>"(" {
689 yyextra->bracketCount=1;
690 yyextra->code->codify(yytext);
691 BEGIN( AlignAsEnd );
692 }
693<AlignAs>\n { yyextra->yyLineNr++;
695 }
696<AlignAs>. { yyextra->code->codify(yytext); }
697<AlignAsEnd>"(" { yyextra->code->codify(yytext);
698 yyextra->bracketCount++;
699 }
700<AlignAsEnd>")" {
701 yyextra->code->codify(yytext);
702 if (--yyextra->bracketCount<=0)
703 {
704 BEGIN(ClassName);
705 }
706 }
707<AlignAsEnd>\n { yyextra->yyLineNr++;
709 }
710<AlignAsEnd>. { yyextra->code->codify(yytext); }
711<ClassName>{ID}("\\"{ID})* { // PHP namespace
712 yyextra->curClassName=
substitute(yytext,
"\\",
"::");
714 pushScope(yyscanner,yyextra->curClassName);
717 BEGIN( ClassVar );
718 }
719<ClassName>{ID}{B}*"("{ID}")" { // Obj-C category
722 pushScope(yyscanner,yyextra->curClassName);
725 BEGIN( ClassVar );
726 }
727<PackageName>{ID}("."{ID})* {
728 yyextra->curClassName=
substitute(yytext,
".",
"::");
729 DBG_CTX((stderr,
"found package: %s\n",
qPrint(yyextra->curClassName)));
732 }
733<ClassVar>"=" {
734 unput(*yytext);
735 BEGIN( Body );
736 }
737<ClassVar>("extends"|"implements") { // Java, Slice
741 yyextra->curClassBases.clear();
742 BEGIN( Bases );
743 }
744<ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") {
745 DBG_CTX((stderr,
"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,
qPrint(yyextra->curClassName)));
749 BEGIN( CppCliTypeModifierFollowup );
750 }
751<ClassVar>{ID} {
752 yyextra->type = yyextra->curClassName;
753 yyextra->name = yytext;
754 if (yyextra->insideBody)
755 {
756 addVariable(yyscanner,yyextra->type,yyextra->name);
757 }
759 }
760<ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*":"{B}* {
762 yyextra->curClassBases.clear();
763 BEGIN( Bases );
764 }
765<PackageName>[ \t]*";" |
766<Bases>^{Bopt}/"@"{ID} | // Objective-C interface
767<Bases,ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*"{"{B}* {
768 yyextra->theVarContext.pushScope();
769 if (!yyextra->skipCodify) yyextra->code->codify(yytext);
770 yyextra->skipCodify = false;
771 if (YY_START==ClassVar && yyextra->curClassName.isEmpty())
772 {
773 yyextra->curClassName = yyextra->name;
774 }
775 if (yyextra->searchingForBody)
776 {
777 yyextra->searchingForBody=
FALSE;
778 yyextra->insideBody=
TRUE;
779 }
780 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
781 if (!yyextra->curClassName.isEmpty())
782 {
783 DBG_CTX((stderr,
"** scope stack push CLASSBLOCK\n"));
785 pushScope(yyscanner,yyextra->curClassName);
786 DBG_CTX((stderr,
"***** yyextra->curClassName=%s\n",
qPrint(yyextra->curClassName)));
787 if (yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->curClassName,true)==nullptr)
788 {
789 DBG_CTX((stderr,
"Adding new class %s\n",
qPrint(yyextra->curClassName)));
791
792 for (const auto &s : yyextra->curClassBases)
793 {
795 auto it = yyextra->codeClassMap.find(s);
796 if (it!=yyextra->codeClassMap.end())
797 {
799 }
800 if (bcd==
nullptr) bcd=yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,
QCString(s),
true);
801 if (bcd && bcd->
name()!=yyextra->curClassName)
802 {
803 var.localDef()->insertBaseClass(bcd->
name());
804 }
805 }
806 yyextra->codeClassMap.emplace(yyextra->curClassName.str(),std::move(var));
807 }
808
809 }
810 else
811 {
812 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
814 }
815 yyextra->curClassName.clear();
816 yyextra->curClassBases.clear();
817 BEGIN( Body );
818 }
819<Bases>"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" {
821 yyextra->code->codify(yytext);
823 }
824<Bases>{SEP}?({ID}{SEP})*{ID} {
825 DBG_CTX((stderr,
"%s:addBase(%s)\n",
qPrint(yyextra->curClassName),yytext));
826 yyextra->curClassBases.emplace_back(yytext);
828 }
829<Bases>"<" {
830 yyextra->code->codify(yytext);
831 if (!yyextra->insideObjC)
832 {
833 yyextra->sharpCount=1;
834 BEGIN ( SkipSharp );
835 }
836 else
837 {
838 yyextra->insideProtocolList=
TRUE;
839 }
840 }
841<Bases>">" {
842 yyextra->code->codify(yytext);
843 yyextra->insideProtocolList=
FALSE;
844 }
845<SkipSharp>"<" {
846 yyextra->code->codify(yytext);
847 ++yyextra->sharpCount;
848 }
849<SkipSharp>">" {
850 yyextra->code->codify(yytext);
851 if (--yyextra->sharpCount<=0)
852 BEGIN ( Bases );
853 }
854<SkipSharp>"\"" {
855 yyextra->code->codify(yytext);
856 yyextra->lastStringContext=YY_START;
857 BEGIN(SkipString);
858 }
859<SkipSharp>"\'" {
860 yyextra->code->codify(yytext);
861 yyextra->lastStringContext=YY_START;
862 BEGIN(SkipStringS);
863 }
864<Bases>"(" {
865 yyextra->code->codify(yytext);
866 yyextra->sharpCount=1;
867 BEGIN ( SkipSharp );
868 }
869<SkipSharp>"(" {
870 yyextra->code->codify(yytext);
871 ++yyextra->sharpCount;
872 }
873<SkipSharp>")" {
874 yyextra->code->codify(yytext);
875 if (--yyextra->sharpCount<=0)
876 BEGIN ( Bases );
877 }
878
879
880<Bases>"," {
881 yyextra->code->codify(yytext);
882 }
883
884
885<Body>{SCOPEPREFIX}?"operator"{B}*"()"{Bopt}/"(" {
888 yyextra->bracketCount=0;
889 yyextra->args.clear();
890 yyextra->name+=yytext;
891 BEGIN( FuncCall );
892 }
893<Body>{SCOPEPREFIX}?"operator"/"(" {
896 yyextra->bracketCount=0;
897 yyextra->args.clear();
898 yyextra->name+=yytext;
899 BEGIN( FuncCall );
900 }
901<Body>{SCOPEPREFIX}?"operator"[^a-z_A-Z0-9\(\n]+/"(" {
904 yyextra->bracketCount=0;
905 yyextra->args.clear();
906 yyextra->name+=yytext;
907 BEGIN( FuncCall );
908 }
909<Body,TemplDecl>("template"|"generic")/([^a-zA-Z0-9]) {
913 yyextra->insideTemplate=
TRUE;
914 yyextra->sharpCount=0;
915 }
916<Body>"concept"{BN}+ {
920 BEGIN(ConceptName);
921 }
922<Body>"using"{BN}+"namespace"{BN}+ {
926 BEGIN(UsingName);
927 }
928<Body>"using"{BN}+ {
932 BEGIN(UsingName);
933 }
934<Body>"module"/{B}*[:;]? { // 'module X' or 'module : private' or 'module;'
935 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
936 if (!yyextra->type.isEmpty() || !yyextra->name.isEmpty()) REJECT;
940 BEGIN(ModuleName);
941 }
942<Body>"import"/{B}*[<":]? {
943 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
947 BEGIN(ModuleImport);
948 }
949<ConceptName>{ID}("::"{ID})* {
951 }
952<ConceptName>"=" { codifyLines(yyscanner,yytext); BEGIN(Body); }
953<UsingName>{ID}(("::"|"."){ID})* {
956 BEGIN(Body);
957 }
static void addUsingDirective(yyscan_t yyscanner, const QCString &name)
958<UsingName>\n { codifyLines(yyscanner,yytext); BEGIN(Body); }
959<UsingName>. { codifyLines(yyscanner,yytext); BEGIN(Body); }
960<Body,FuncCall>"$"?"this"("->"|".") { yyextra->code->codify(yytext); // this-> for C++, this. for C#
961 yyextra->isPrefixedWithThis =
TRUE;
962 }
963<Body>{KEYWORD}/([^a-z_A-Z0-9]) {
964 if (yyextra->lang==SrcLangExt::Java &&
qstrcmp(
"internal",yytext) ==0) REJECT;
969 if (text==
"typedef" || text.
find(
"enum ")!=-1)
970 {
972 yyextra->name+=yytext;
973 }
975 }
static bool skipLanguageSpecificKeyword(yyscan_t yyscanner, const char *kw)
int qstrcmp(const char *str1, const char *str2)
976<Body>{KEYWORD}/{B}* {
981 }
982<Body>{KEYWORD}/{BN}*"(" {
987 yyextra->name.clear();yyextra->type.clear();
988 }
989<FuncCall>"in"/{BN}* {
990 if (!yyextra->inForEachExpression) REJECT;
994
995 yyextra->theVarContext.popScope();
996 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
997 yyextra->theVarContext.pushScope();
998 yyextra->name.clear();yyextra->type.clear();
999 }
1000<Body>{FLOWKW}/{BN}*"(" {
1004 yyextra->name.clear();yyextra->type.clear();
1005 yyextra->inForEachExpression = (
qstrcmp(yytext,
"for each")==0 ||
qstrcmp(yytext,
"foreach")==0);
1006 BEGIN(FuncCall);
1007 }
1008<Body>{FLOWCONDITION}/{BN}*"(" {
1013 yyextra->name.clear();yyextra->type.clear();
1014 yyextra->inForEachExpression = (strcmp(yytext,"for each")==0 || strcmp(yytext, "foreach")==0);
1015 BEGIN(FuncCall);
1016 }
static void incrementFlowKeyWordCount(yyscan_t yyscanner)
1017<Body>{FLOWKW}/([^a-z_A-Z0-9]) {
1021 if (yyextra->inFunctionTryBlock && (
qstrcmp(yytext,
"catch")==0 ||
qstrcmp(yytext,
"finally")==0))
1022 {
1023 yyextra->inFunctionTryBlock=
FALSE;
1024 }
1025 }
1026<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1031 if (yyextra->inFunctionTryBlock && (strcmp(yytext,"catch")==0 || strcmp(yytext,"finally")==0))
1032 {
1033 yyextra->inFunctionTryBlock=
FALSE;
1034 }
1035 }
1036<Body>{FLOWKW}/{B}* {
1040 }
1041<Body>{FLOWCONDITION}/{B}* {
1046 }
1047<Body>"*"{B}*")" { // end of cast?
1048 yyextra->code->codify(yytext);
1049 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1050 yyextra->bracketCount--;
1051 yyextra->parmType = yyextra->name;
1052 BEGIN(FuncCall);
1053 }
1054<Body>"\\)"|"\\(" {
1055 yyextra->code->codify(yytext);
1056 }
1057<Body>[\\|\)\+\-\/\%\~\!] {
1058 yyextra->code->codify(yytext);
1059 yyextra->name.clear();yyextra->type.clear();
1060 if (*yytext==')')
1061 {
1062 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1063 yyextra->bracketCount--;
1064 if (yyextra->bracketCount<=0)
1065 {
1066 BEGIN(FuncCall);
1067 }
1068 }
1069 }
1070<Body,TemplDecl,ObjCMethod>{TYPEKW}/{B}* {
1072 yyextra->code->codify(yytext);
1075 yyextra->name+=yytext;
1076 }
1077<Body,TemplDecl,ObjCMethod>{TYPEKWSL}/{B}* {
1078 if (yyextra->lang!=SrcLangExt::Slice)
1079 {
1080 REJECT;
1081 }
1082 else
1083 {
1085 yyextra->code->codify(yytext);
1088 yyextra->name+=yytext;
1089 }
1090 }
1091<Body>"generic"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1093 yyextra->code->codify(yytext);
1095 yyextra->sharpCount=0;
1096 BEGIN(TemplDecl);
1097 }
1098<Body>"template"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* { // template<...>
1100 yyextra->code->codify(yytext);
1102 yyextra->sharpCount=0;
1103 BEGIN(TemplDecl);
1104 }
1105<TemplDecl>"class"|"typename" {
1109 }
1110<TemplDecl>"<" {
1111 yyextra->code->codify(yytext);
1112 yyextra->sharpCount++;
1113 }
1114<TemplDecl>">" {
1115 yyextra->code->codify(yytext);
1116 yyextra->sharpCount--;
1117 if (yyextra->sharpCount<=0)
1118 {
1119 BEGIN(Body);
1120 }
1121 }
1122<TemplCast>">" {
1126 BEGIN( yyextra->lastTemplCastContext );
1127 }
1128<TemplCast>{ID}("::"{ID})* {
1130 }
1131<TemplCast>("const"|"volatile"){B}* {
1135 }
1136<TemplCast>[*^]* {
1138 }
1139<Body,MemberCall2,FuncCall>{CASTKW}{B}*"<" { // static_cast<T>(
1143 yyextra->lastTemplCastContext = YY_START;
1144 BEGIN(TemplCast);
1145 }
1146<Body>"$this->"{SCOPENAME}/{BN}*[;,)\]] { // PHP member variable
1149 yyextra->name+=yytext+7;
1150 }
static void generatePHPVariableLink(yyscan_t yyscanner, OutputCodeList &ol, const char *varName)
1151<Body,TemplCast>{SCOPENAME}{B}*"<"[^\n\/\-\.\{\">\(']*">"{ENDIDopt}/{B}* { // A<T> *pt;
1153 {
1154 REJECT;
1155 }
1158 yyextra->name+=yytext;
1159 }
static bool isCastKeyword(const char *s)
1160<ModuleName,ModuleImport>{MODULE_ID}({BN}*":"{BN}*{MODULE_ID})? {
1162 int i = name.
find(
':');
1164 if (i!=-1)
1165 {
1168 }
1170 if (mod)
1171 {
1173 }
1174 else
1175 {
1177 }
1178 }
static ModuleManager & instance()
ModuleDef * getPrimaryInterface(const QCString &moduleName) const
1179<ModuleName>":"{BN}+"private" {
1181 int i=text.
find(
'p');
1186 }
1187<ModuleName>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1188<ModuleName>. { yyextra->code->codify(yytext); }
1189<ModuleName>\n { codifyLines(yyscanner,yytext); }
1190<ModuleImport>["<] { yyextra->code->codify(yytext); BEGIN(ReadInclude); }
1191<ModuleImport>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1192<ModuleImport>. { yyextra->code->codify(yytext); }
1193<ModuleImport>\n { codifyLines(yyscanner,yytext); }
1194
1195<Body>{SCOPENAME}/{BN}*[:;,)\]] { // "int var;" or "var, var2" or "debug(f) macro" , or int var : 5;
1197 {
1198 REJECT;
1199 }
1202 yyextra->name+=yytext;
1203 }
static bool startsWithKeyword(const QCString &str, const QCString &kw)
1204<Body>{ID}("."{ID})+/{BN}+ { // CSharp/Java scope
1205 if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
1206 {
1209 yyextra->name+=yytext;
1210 }
1211 else
1212 {
1213 REJECT;
1214 }
1215 }
1216<Body>"export"/{B}* {
1217 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1221 }
1222<Body>{SCOPENAME}/{B}* { // p->func()
1224 {
1225 REJECT;
1226 }
1229 yyextra->name+=yytext;
1230 }
1231<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* { // (*p)->func() but not "if (p) ..."
1232 yyextra->code->codify(yytext);
1233 uint32_t s=0;
while (s<(uint32_t)yyleng && !
isId(yytext[s])) s++;
1234 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1237 yyextra->name=std::move(varname);
1238 }
1239<Body>{SCOPETNAME}{B}*"<"[^\n\/\-\.\{\">]*">"/{BN}*"(" |
1240<Body>{SCOPETNAME}/{BN}*"(" { // a() or c::a() or t<A,B>::a() or A\B\foo()
1242 {
1243 REJECT;
1244 }
1247 yyextra->bracketCount=0;
1248 yyextra->args.clear();
1249 yyextra->name+=yytext;
1250 BEGIN( FuncCall );
1251 }
1252<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} {
1254 uint32_t i=(uint32_t)text.
find(
'R');
1255 yyextra->code->codify(text.
left(i+1));
1257 yyextra->code->codify(
QCString(yytext+i+1));
1258 yyextra->lastStringContext=YY_START;
1259 yyextra->inForEachExpression =
FALSE;
1260 yyextra->delimiter = yytext+i+2;
1261 yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
1262 BEGIN( RawString );
1263 }
1264<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit,ClassVar,OldStyleArgs>\" {
1266 yyextra->code->codify(yytext);
1267 yyextra->lastStringContext=YY_START;
1268 yyextra->inForEachExpression =
FALSE;
1269 BEGIN( SkipString );
1270 }
1271<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{NUMBER} { //Note similar code in commentcnv.l
1272 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1273 yyextra->code->codify(yytext);
1274 }
1275<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
1277 yyextra->code->codify(yytext);
1278 yyextra->lastStringContext=YY_START;
1279 yyextra->inForEachExpression =
FALSE;
1280 BEGIN( SkipStringS );
1281 }
1282<SkipString>[^\"\\\r\n]* {
1283 yyextra->code->codify(yytext);
1284 }
1285<SkipStringS>[^\'\\\r\n]* {
1286 yyextra->code->codify(yytext);
1287 }
1288<SkipString,SkipStringS>{CPPC}|{CCS} {
1289 yyextra->code->codify(yytext);
1290 }
1291<SkipString>@?\" {
1292 yyextra->code->codify(yytext);
1293 if (yyextra->lastStringContext!=SkipCPP)
1294 {
1296 }
1297 BEGIN( yyextra->lastStringContext );
1298 }
1299<SkipStringS>\' {
1300 yyextra->code->codify(yytext);
1302 BEGIN( yyextra->lastStringContext );
1303 }
1304<SkipString,SkipStringS>\\. {
1305 yyextra->code->codify(yytext);
1306 }
1307<RawString>{RAWEND} {
1308 yyextra->code->codify(yytext);
1310 delimiter=delimiter.left(delimiter.length()-1);
1311 if (delimiter==yyextra->delimiter)
1312 {
1313 BEGIN( yyextra->lastStringContext );
1314 }
1315 }
1316<RawString>[^)\n]+ { yyextra->code->codify(yytext); }
1317<RawString>. { yyextra->code->codify(yytext); }
1318<RawString>\n { codifyLines(yyscanner,yytext); }
1319<SkipVerbString>[^"\n]+ {
1320 yyextra->code->codify(yytext);
1321 }
1322<SkipVerbString>\"\" { // escaped quote
1323 yyextra->code->codify(yytext);
1324 }
1325<SkipVerbString>\" { // end of string
1326 yyextra->code->codify(yytext);
1328 BEGIN( yyextra->lastVerbStringContext );
1329 }
1330<SkipVerbString>. {
1331 yyextra->code->codify(yytext);
1332 }
1333<SkipVerbString>\n {
1335 }
1336<Body>":" {
1337 yyextra->code->codify(yytext);
1338 yyextra->name.clear();yyextra->type.clear();
1339 }
1340<Body>"<" {
1341 if (yyextra->insideTemplate)
1342 {
1343 yyextra->sharpCount++;
1344 }
1345 yyextra->code->codify(yytext);
1346 }
1347<Body>">" {
1348 if (yyextra->insideTemplate)
1349 {
1350 if (--yyextra->sharpCount<=0)
1351 {
1352 yyextra->insideTemplate=
FALSE;
1353 }
1354 }
1355 yyextra->code->codify(yytext);
1356 }
1357<Body,MemberCall,MemberCall2,FuncCall,OldStyleArgs>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
1359 yyextra->code->codify(yytext);
1361 }
1362<Body>"."|"->" {
1363 if (yytext[0]=='-')
1364 {
1366 }
1367 yyextra->code->codify(yytext);
1368 yyextra->memCallContext = YY_START;
1369 BEGIN( MemberCall );
1370 }
static void updateCallContextForSmartPointer(yyscan_t yyscanner)
1371<MemberCall>{SCOPETNAME}/{BN}*"(" {
1372 if (yyextra->theCallContext.getScope().globalDef())
1373 {
1375 {
1378 }
1379 yyextra->name.clear();
1380 }
1381 else
1382 {
1385 yyextra->name.clear();
1386 }
1387 yyextra->type.clear();
1388 if (yyextra->memCallContext==Body)
1389 {
1390 BEGIN(FuncCall);
1391 }
1392 else
1393 {
1394 BEGIN(yyextra->memCallContext);
1395 }
1396 }
1397<MemberCall>{SCOPENAME}/{B}* {
1398 if (yyextra->theCallContext.getScope().globalDef())
1399 {
1400 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1402 {
1405 }
1406 yyextra->name.clear();
1407 }
1408 else
1409 {
1410 DBG_CTX((stderr,
"no class context!\n"));
1413 yyextra->name.clear();
1414 }
1415 yyextra->type.clear();
1416 BEGIN(yyextra->memCallContext);
1417 }
1418<Body>[,=;\[{] {
1419 if (yyextra->insideObjC && *yytext=='[')
1420 {
1421 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
1422
1423 yyextra->contextMap.clear();
1424 yyextra->nameMap.clear();
1425 yyextra->objectMap.clear();
1426 yyextra->wordMap.clear();
1427 yyextra->commentMap.clear();
1428 yyextra->currentCtxId = 0;
1429 yyextra->currentNameId = 0;
1430 yyextra->currentObjId = 0;
1431 yyextra->currentCtx = nullptr;
1432 yyextra->braceCount = 0;
1433 unput('[');
1434 BEGIN(ObjCCall);
1435 }
1436 else
1437 {
1438 if (*yytext!='{') yyextra->code->codify(yytext);
1439 yyextra->saveName = yyextra->name;
1440 yyextra->saveType = yyextra->type;
1441 if (*yytext!='[' && !yyextra->type.isEmpty())
1442 {
1443
1444
1445 {
1446
1447
1448 addVariable(yyscanner,yyextra->type,yyextra->name);
1449 }
1450 yyextra->name.clear();
1451 }
1452 if (*yytext==';' || *yytext=='=' || *yytext=='{')
1453 {
1454 yyextra->type.clear();
1455 yyextra->name.clear();
1456 }
1457 else if (*yytext=='[')
1458 {
1459 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1460 }
1461 yyextra->args.clear();
1462 yyextra->parmType.clear();
1463 yyextra->parmName.clear();
1464 if (*yytext=='{')
1465 {
1466 BEGIN( BodyVar );
1467 unput('{');
1468 }
1469 }
1470 }
1471<Body,FuncCall,BodyVar>"{" {
1472 yyextra->theVarContext.pushScope();
1473 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1474 yyextra->bracketCount = 0;
1475
1477 if (yyextra->type.find("enum ")!=-1)
1478 {
1479 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1482 }
1483 else
1484 {
1485 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1487 }
1488
1489 if (yyextra->searchingForBody)
1490 {
1491 yyextra->searchingForBody=
FALSE;
1492 yyextra->insideBody=
TRUE;
1493 }
1494 yyextra->code->codify(yytext);
1495 if (yyextra->insideBody)
1496 {
1497 yyextra->bodyCurlyCount++;
1498 }
1499 yyextra->type.clear();
1500 yyextra->name.clear();
1501 BEGIN( Body );
1502 }
1503<ObjCCall,ObjCMName>"["|"{" {
1505 yyextra->currentCtx->format+=*yytext;
1506 BEGIN(ObjCCall);
1508 }
static void saveObjCContext(yyscan_t yyscanner)
1509<ObjCCall,ObjCMName>"]"|"}" {
1510 yyextra->currentCtx->format+=*yytext;
1512 BEGIN(ObjCMName);
1513 if (yyextra->currentCtx==nullptr)
1514 {
1515
1517 auto it = yyextra->contextMap.find(0);
1518 if (it!=yyextra->contextMap.end())
1519 {
1520 ctx = it->second.get();
1521 }
1523 BEGIN(Body);
1524 }
1526 }
static void restoreObjCContext(yyscan_t yyscanner)
1527<ObjCCall,ObjCMName>{CPPC}.* {
1528 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1529 }
static QCString escapeComment(yyscan_t yyscanner, const char *s)
1530<ObjCCall,ObjCMName>{CCS} {
1531 yyextra->lastObjCCallContext = YY_START;
1532 yyextra->currentCtx->comment.str(yytext);
1533 BEGIN(ObjCCallComment);
1534 }
1535<ObjCCallComment>{CCE} {
1536 yyextra->currentCtx->comment << yytext;
1537 std::string commentStr = yyextra->currentCtx->comment.str();
1538 yyextra->currentCtx->format+=
escapeComment(yyscanner,commentStr.c_str());
1539 BEGIN(yyextra->lastObjCCallContext);
1540 }
1541<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
1542<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
1543<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
1544<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
1545<ObjCCall>{ID}({B}*"."{B}*{ID})* {
1547 if (yyextra->braceCount==0)
1548 {
1549 yyextra->currentCtx->objectTypeOrName=yytext;
1550 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1551 BEGIN(ObjCMName);
1552 }
1553 }
static QCString escapeObject(yyscan_t yyscanner, const char *s)
1554<ObjCMName>{ID}/{BN}*"]" {
1555 if (yyextra->braceCount==0 &&
1556 yyextra->currentCtx->methodName.isEmpty())
1557 {
1558 yyextra->currentCtx->methodName=yytext;
1559 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1560 }
1561 else
1562 {
1563 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1564 }
1565 }
static QCString escapeName(yyscan_t yyscanner, const char *s)
static QCString escapeWord(yyscan_t yyscanner, const char *s)
1566<ObjCMName>{ID}/{BN}*":" {
1567 if (yyextra->braceCount==0)
1568 {
1569 yyextra->currentCtx->methodName+=yytext;
1570 yyextra->currentCtx->methodName+=":";
1571 }
1572 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1573 }
1574<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1575<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1576<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1577 BEGIN(yyextra->lastStringContext);
1578 }
1579<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1580<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1581 yyextra->lastStringContext=YY_START;
1582 BEGIN(ObjCSkipStr);
1583 }
1584<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+="$$"; }
1585<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
1586<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
1587<ObjCSkipStr>"@"/"\"" { // needed to prevent matching the global rule (for C#)
1588 yyextra->currentCtx->format+=yytext;
1589 }
1590<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=escapeWord(yyscanner,yytext); }
1591<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
1592<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
1593
1594<Body>"]" {
1595 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1596 yyextra->code->codify(yytext);
1597
1598 yyextra->name = yyextra->saveName;
1599 yyextra->type = yyextra->saveType;
1600 }
1601<Body>[0-9]+ {
1602 yyextra->code->codify(yytext);
1603 }
1604<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1605 yyextra->code->codify(yytext);
1606 }
1607<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1608
1609
1612 yyextra->code->codify(yytext);
1614 }
1615<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1617 yyextra->parmName=yytext;
1619 yyextra->code->codify(yytext);
1621 }
static void addParmType(yyscan_t yyscanner)
1622<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1623 if (yyextra->lang!=SrcLangExt::Slice)
1624 {
1625 REJECT;
1626 }
1627 else
1628 {
1630 yyextra->parmName=yytext;
1632 yyextra->code->codify(yytext);
1634 }
1635 }
1636<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1638 yyextra->parmName=yytext;
1640 yyextra->code->codify(yytext);
1642 }
1643<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1646 yyextra->parmName=yytext;
1648 yyextra->code->codify(yytext);
1650 }
1651<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1653 {
1654 REJECT;
1655 }
1657 yyextra->parmName=yytext;
1659 }
1660<FuncCall>";" { // probably a cast, not a function call
1661 yyextra->code->codify(yytext);
1662 yyextra->inForEachExpression =
FALSE;
1663 BEGIN( Body );
1664 }
1665<MemberCall2,FuncCall>, {
1666 yyextra->code->codify(yytext);
1667 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1668 yyextra->parmType.clear();yyextra->parmName.clear();
1669 }
1670<MemberCall2,FuncCall>"{" {
1671 if (yyextra->bracketCount>0)
1672 {
1673 yyextra->code->codify(yytext);
1674 yyextra->skipInlineInitContext=YY_START;
1675 yyextra->curlyCount=0;
1676 BEGIN(InlineInit);
1677 }
1678 else
1679 {
1680 REJECT;
1681 }
1682 }
1683<InlineInit>"{" { yyextra->curlyCount++;
1684 yyextra->code->codify(yytext);
1685 }
1686<InlineInit>"}" {
1687 yyextra->code->codify(yytext);
1688 if (--yyextra->curlyCount<=0)
1689 {
1690 BEGIN(yyextra->skipInlineInitContext);
1691 }
1692 }
1693<InlineInit>\n {
1695 }
1696<InlineInit>. {
1697 yyextra->code->codify(yytext);
1698 }
1699<MemberCall2,FuncCall>"(" {
1700 yyextra->parmType.clear();yyextra->parmName.clear();
1701 yyextra->code->codify(yytext);
1702 yyextra->bracketCount++;
1703 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1704 if (YY_START==FuncCall && !yyextra->insideBody)
1705 {
1706 yyextra->theVarContext.pushScope();
1707 }
1708 }
1709<MemberCall2,FuncCall>{OPERATOR} { // operator
1714 {
1715
1716 yyextra->parmType.clear();yyextra->parmName.clear();
1717 }
1718 yyextra->code->codify(yytext);
1719 }
1720<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1721 if (yytext[0]==')')
1722 {
1723 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1724 if (yyextra->parmType.isEmpty())
1725 {
1726 yyextra->parmType=yyextra->parmName;
1727 yyextra->parmName.clear();
1728 }
1729 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1730 }
1731 else
1732 {
1733 yyextra->parmType = yyextra->parmName;
1734 yyextra->parmName.clear();
1735 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1736 }
1737 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1738 yyextra->inForEachExpression =
FALSE;
1739
1740 yyextra->code->codify(yytext);
1741 if (--yyextra->bracketCount<=0)
1742 {
1743 if (yyextra->name.isEmpty())
1744 {
1745 BEGIN( Body );
1746 }
1747 else
1748 {
1749 BEGIN( CallEnd );
1750 }
1751 }
1752 }
1753<MemberCall,MemberCall2,FuncCall>[;:] { // recover from unexpected end of call
1754
1755 if (yyextra->bracketCount<=0)
1756 {
1757 unput(*yytext);
1758 BEGIN(CallEnd);
1759 }
1760 else
1761 {
1762 yyextra->code->codify(yytext);
1763 }
1764 }
1765<CallEnd>[ \t\n]* { codifyLines(yyscanner,yytext); }
1766<CallEnd>[;:] {
1768 yyextra->bracketCount=0;
1769 if (*yytext==
';') yyextra->searchingForBody=
FALSE;
1770 if (!yyextra->type.isEmpty())
1771 {
1772 DBG_CTX((stderr,
"add variable yyextra->type=%s yyextra->name=%s)\n",
qPrint(yyextra->type),
qPrint(yyextra->name)));
1773 addVariable(yyscanner,yyextra->type,yyextra->name);
1774 }
1775 yyextra->parmType.clear();yyextra->parmName.clear();
1777 if (*yytext==';' || yyextra->insideBody)
1778 {
1779 if (!yyextra->insideBody)
1780 {
1781 yyextra->theVarContext.popScope();
1782 }
1783 yyextra->name.clear();yyextra->type.clear();
1784 BEGIN( Body );
1785 }
1786 else
1787 {
1788 yyextra->bracketCount=0;
1789 BEGIN( SkipInits );
1790 }
1791 }
1792<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1796 }
1797<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1798 if (yyextra->insideBody)
1799 {
1800 yyextra->theVarContext.pushScope();
1801 }
1802 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1803
1804 yyextra->parmType.clear();yyextra->parmName.clear();
1805 int index = yyextra->name.findRev("::");
1806 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1807 if (index!=-1)
1808 {
1810 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1812 if (cd)
1813 {
1816 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1817 }
1818 else
1819 {
1820
1822 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1823 }
1824 }
1825 else
1826 {
1827 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1829 }
1830 yytext[yyleng-1]='\0';
1832 if (!cv.stripWhiteSpace().isEmpty())
1833 {
1837 }
1838 else
1839 {
1841 }
1842 yyextra->code->codify("{");
1843 if (yyextra->searchingForBody)
1844 {
1845 yyextra->searchingForBody=
FALSE;
1846 yyextra->insideBody=
TRUE;
1847 }
1848 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1849 yyextra->type.clear(); yyextra->name.clear();
1850 BEGIN( Body );
1851 }
static void setClassScope(yyscan_t yyscanner, const QCString &name)
1852<CallEnd>"try" { // function-try-block
1854 yyextra->code->codify(yytext);
1856 yyextra->inFunctionTryBlock=
TRUE;
1857 }
1858<CallEnd>"requires" { // function-try-block
1860 yyextra->code->codify(yytext);
1862 }
1863<CallEnd>{ID} {
1864 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1865 {
1866 REJECT;
1867 }
1868
1870 yyextra->parmName=yytext;
1872 BEGIN(OldStyleArgs);
1873 }
1874<OldStyleArgs>{ID} {
1876 yyextra->parmName=yytext;
1878 }
1879<OldStyleArgs>[,;] {
1880 yyextra->code->codify(yytext);
1881 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1882 if (*yytext==';') yyextra->parmType.clear();
1883 yyextra->parmName.clear();
1884 }
1885<CallEnd,OldStyleArgs>"#" {
1887 yyextra->lastSkipCppContext = Body;
1888 yyextra->code->codify(yytext);
1889 BEGIN( SkipCPP );
1890 }
1891<CallEnd>. {
1892 unput(*yytext);
1893 if (!yyextra->insideBody)
1894 {
1895 yyextra->theVarContext.popScope();
1896 }
1897 yyextra->name.clear();yyextra->args.clear();
1898 yyextra->parmType.clear();yyextra->parmName.clear();
1899 BEGIN( Body );
1900 }
1901<SkipInits>";" {
1902 yyextra->code->codify(yytext);
1903 yyextra->type.clear(); yyextra->name.clear();
1904 BEGIN( Body );
1905 }
1906<SkipInits>"{" {
1907 yyextra->code->codify(yytext);
1908 if (yyextra->searchingForBody)
1909 {
1910 yyextra->searchingForBody=
FALSE;
1911 yyextra->insideBody=
TRUE;
1912 }
1913 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1914 if (yyextra->name.find("::")!=-1)
1915 {
1916 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1919 }
1920 else
1921 {
1922 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1924 }
1925 yyextra->type.clear(); yyextra->name.clear();
1926 BEGIN( Body );
1927 }
1928<SkipInits>{ID}{B}*"{" {
1930 int bracketPos = text.
find(
'{');
1931 int spacePos = text.
find(
' ');
1932 int len = spacePos==-1 ? bracketPos : spacePos;
1934 yyextra->code->codify(
QCString(yytext+len));
1935 }
1936<SkipInits>{ID} {
1938 }
1939<FuncCall>{ID}/"(" {
1941 }
1942<FuncCall>{ID}/("."|"->") {
1943 yyextra->name=yytext;
1945 BEGIN( MemberCall2 );
1946 }
1947<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1948 yyextra->code->codify(yytext);
1949 uint32_t s=0;
while (!
isId(yytext[s])) s++;
1950 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1951 yyextra->name=((
QCString)yytext).mid(s,e-s+1);
1952 BEGIN( MemberCall2 );
1953 }
1954<MemberCall2>{ID}/([ \t\n]*"(") {
1955 if (!yyextra->args.isEmpty())
1957 else
1959 yyextra->args.clear();
1960 BEGIN( FuncCall );
1961 }
static void generateMemberLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &varName, const QCString &memName)
1962<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1963
1964 yyextra->name=yytext;
1966 BEGIN( MemberCall2 );
1967 }
1968<MemberCall2>"->"|"." {
1969 if (yytext[0]=='-')
1970 {
1972 }
1973 yyextra->code->codify(yytext);
1974 yyextra->memCallContext = YY_START;
1975 BEGIN( MemberCall );
1976 }
1977<SkipComment>{CCS}("!"?){CCE} {
1978 yyextra->code->codify(yytext);
1980 BEGIN( yyextra->lastCContext ) ;
1981 }
1982<SkipComment>{CPPC}|{CCS} {
1983 yyextra->code->codify(yytext);
1984 }
1985<SkipComment>[^*\/\n]+ {
1986 yyextra->code->codify(yytext);
1987 }
1988<SkipComment>[ \t]*{CCE} {
1989 yyextra->code->codify(yytext);
1991 if (yyextra->lastCContext==SkipCPP)
1992 {
1994 }
1995 BEGIN( yyextra->lastCContext ) ;
1996 }
1997<SkipCxxComment>[^\r\n]*"\\"[\r]?\n { // line continuation
1999 }
2000<SkipCxxComment>[^\r\n]+ {
2001 yyextra->code->codify(yytext);
2002 }
2003<SkipCxxComment>\r
2004<SkipCxxComment>\n {
2005 unput('\n');
2007 BEGIN( yyextra->lastCContext ) ;
2008 }
2009<SkipCxxComment>. {
2010 yyextra->code->codify(yytext);
2011 }
2012<MemberCall>[^a-z_A-Z0-9(\n] {
2013 yyextra->code->codify(yytext);
2014 yyextra->type.clear();
2015 yyextra->name.clear();
2016 BEGIN(yyextra->memCallContext);
2017 }
2018<*>\n({B}*{CPPC}[!/][^\n]*\n)+ { // remove special one-line comment
2019 if (YY_START==SkipCPP) REJECT;
2024 if (YY_START==SkipCxxComment)
2025 {
2026 BEGIN( yyextra->lastCContext ) ;
2027 }
2028 }
2029<SkipCPP>\n/(.|\n) {
2031 BEGIN( yyextra->lastSkipCppContext ) ;
2032 unput('\n');
2033 }
2034<*>\n{B}*{CPPC}"@"[{}].*\n { // remove one-line group marker
2039 if (YY_START==SkipCxxComment)
2040 {
2041 BEGIN( yyextra->lastCContext ) ;
2042 }
2043 }
2044<*>\n{B}*{CCS}"@"[{}] { // remove one-line group marker
2045
2046 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2047 {
2048 yyextra->lastCContext = YY_START ;
2049 }
2052 BEGIN(SkipComment);
2053 }
2054<*>^{B}*{CPPC}"@"[{}].*\n { // remove one-line group marker
2059 }
2060<*>^{B}*{CCS}"@"[{}] { // remove multi-line group marker
2061
2062 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2063 {
2064 yyextra->lastCContext = YY_START ;
2065 }
2067 yyextra->code->codify(yytext);
2068 BEGIN(SkipComment);
2069 }
2070<*>^{B}*{CPPC}[!/][^\n]* { // remove special one-line comment
2074 }
2075<*>{CPPC}[!/][^\n]* { // strip special one-line comment
2076 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2080 }
2081<*>\n{B}*{CCS}[!*]/{NCOMM} {
2082
2083 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2084 {
2085 yyextra->lastCContext = YY_START ;
2086 }
2089 BEGIN(SkipComment);
2090 }
2091<*>^{B}*{CCS}"*"[*]+/[^/] {
2092
2093 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2094 {
2095 yyextra->lastCContext = YY_START ;
2096 }
2097
2099 yyextra->code->codify(yytext);
2100 BEGIN(SkipComment);
2101 }
2102<*>^{B}*{CCS}[!*]/{NCOMM} { // special C comment block at a new line
2103
2104 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2105 {
2106 yyextra->lastCContext = YY_START ;
2107 }
2109 yyextra->code->codify(yytext);
2110 BEGIN(SkipComment);
2111 }
2112<*>{CCS}[!*]/{NCOMM} { // special C comment block half way a line
2113 if (YY_START==SkipString) REJECT;
2114
2115 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2116 {
2117 yyextra->lastCContext = YY_START ;
2118 }
2120 yyextra->code->codify(yytext);
2121 BEGIN(SkipComment);
2122 }
2123<*>{CCS}("!"?){CCE} {
2124 if (YY_START==SkipString) REJECT;
2127 yyextra->code->codify(yytext);
2129 }
2130<SkipComment>[^\*\n]+ {
2131 yyextra->code->codify(yytext);
2132 }
2133<*>{CCS} {
2135 yyextra->code->codify(yytext);
2136
2137 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2138 {
2139 yyextra->lastCContext = YY_START ;
2140 }
2141 BEGIN( SkipComment ) ;
2142 }
2143<*>[$]?@\" { // C# (interpolated) verbatim string
2145 yyextra->code->codify(yytext);
2146 yyextra->lastVerbStringContext=YY_START;
2147 BEGIN(SkipVerbString);
2148 }
2149<*>{CPPC} {
2151 yyextra->code->codify(yytext);
2152 yyextra->lastCContext = YY_START ;
2153 BEGIN( SkipCxxComment ) ;
2154 }
2155<*>"("|"[" {
2156 if (yytext[0]=='(') yyextra->bracketCount++;
2157 yyextra->code->codify(yytext);
2158 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2159 }
2160<*>")"|"]" {
2161 if (yytext[0]==')') yyextra->bracketCount--;
2162 yyextra->code->codify(yytext);
2163 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2164 }
2165<*>\n {
2167 }
2168<*>[\x80-\xFF]* { // keep utf8 characters together...
2169 yyextra->code->codify(yytext);
2170 }
2171<*>. {
2172 yyextra->code->codify(yytext);
2173 }
2174
2175%%