15%option never-interactive
16%option prefix="codeYY"
18%option extra-type="struct codeYY_state *"
22#define YY_TYPEDEF_YY_SCANNER_T
36#include <unordered_map>
37#include <unordered_set>
73#define DBG_CTX(x) do { } while(0)
75#define YY_NO_UNISTD_H 1
179 std::unordered_map< int,std::unique_ptr<ObjCCallCtx> >
contextMap;
265#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
Represents the call context.
A abstract class representing of a compound symbol.
The common base class of all entity definitions found in the sources.
A model of a file symbol.
A model of a class/file/namespace member symbol.
Class representing a list of different code generators.
This is an alternative implementation of QCString.
Text streaming class that buffers data.
static bool isCastKeyword(const char *s)
static void pushScope(yyscan_t yyscanner, const QCString &s)
static void writeMultiLineCodeLink(yyscan_t yyscanner, OutputCodeList &ol, const Definition *d, const QCString &text)
static QCString escapeName(yyscan_t yyscanner, const char *s)
static void endCodeLine(yyscan_t yyscanner)
static bool skipLanguageSpecificKeyword(yyscan_t yyscanner, const char *kw)
static QCString escapeWord(yyscan_t yyscanner, const char *s)
static void generateClassOrGlobalLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &clName, bool typeOnly=FALSE, bool varOnly=FALSE)
static void restoreObjCContext(yyscan_t yyscanner)
static void nextCodeLine(yyscan_t yyscanner)
static void popScope(yyscan_t yyscanner)
static void startCodeLine(yyscan_t yyscanner)
static void codifyLines(yyscan_t yyscanner, const QCString &text)
static void incrementFlowKeyWordCount(yyscan_t yyscanner)
static bool startsWithKeyword(const QCString &str, const QCString &kw)
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
static int countLines(yyscan_t yyscanner)
static void addToSearchIndex(yyscan_t yyscanner, const QCString &text)
static const char * stateToString(int state)
static void addParmType(yyscan_t yyscanner)
static bool getLinkInScope(yyscan_t yyscanner, const QCString &c, const QCString &m, const QCString &memberText, OutputCodeList &ol, const QCString &text, bool varOnly=FALSE)
static const ClassDef * stripClassName(yyscan_t yyscanner, const QCString &s, const Definition *d)
static void updateCallContextForSmartPointer(yyscan_t yyscanner)
static QCString escapeObject(yyscan_t yyscanner, const char *s)
static void generateMemberLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &varName, const QCString &memName)
static void addUsingDirective(yyscan_t yyscanner, const QCString &name)
static bool getLink(yyscan_t yyscanner, const QCString &className, const QCString &memberName, OutputCodeList &ol, const QCString &text=QCString(), bool varOnly=FALSE)
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
static const MemberDef * setCallContextForVar(yyscan_t yyscanner, const QCString &name)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
static QCString escapeComment(yyscan_t yyscanner, const char *s)
static void generateFunctionLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &funcName)
static void addVariable(yyscan_t yyscanner, QCString type, QCString name)
static const char * getLexerFILE()
static void setClassScope(yyscan_t yyscanner, const QCString &name)
static bool generateClassMemberLink(yyscan_t yyscanner, OutputCodeList &ol, const MemberDef *xmd, const QCString &memName)
static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
static void setParameterList(yyscan_t yyscanner, const MemberDef *md)
static void addType(yyscan_t yyscanner)
static void saveObjCContext(yyscan_t yyscanner)
static void writeObjCMethodCall(yyscan_t yyscanner, ObjCCallCtx *ctx)
static void endCodeFold(yyscan_t yyscanner)
static void generatePHPVariableLink(yyscan_t yyscanner, OutputCodeList &ol, const char *varName)
std::vector< std::string > StringVector
Web server based search engine.
QCString objectTypeOrName
const MemberDef * objectVar
const ClassDef * objectType
StringVector curClassBases
CallContext theCallContext
std::unordered_map< int, QCString > commentMap
const Definition * currentDefinition
std::unique_ptr< FileDef > exampleFileDef
std::unordered_map< int, QCString > wordMap
const char * currentFontClass
std::stack< int > scopeStack
1 if bracket starts a scope,
const FileDef * sourceFileDef
std::unordered_map< int, QCString > objectMap
std::unordered_map< int, std::unique_ptr< ObjCCallCtx > > contextMap
VariableContext theVarContext
TooltipManager tooltipManager
std::vector< int > scopeNameLengthStack
std::map< std::string, const NamespaceDef * > UsingContext
const char * inputString
the code fragment as text
const Definition * searchCtx
SymbolResolver symbolResolver
yy_size_t inputPosition
read offset during parsing
bool insideSpecialComment
int yyLineNr
current line number
std::vector< const Definition * > foldStack
int lastVerbStringContext
int inputLines
number of line in the code fragment
const MemberDef * currentMemberDef
std::unordered_map< std::string, ScopedTypeVariant > codeClassMap
UsingContext theUsingContext
std::unordered_map< int, QCString > nameMap
bool skipCodify
for CSharp files scoped namespace {
std::stack< ObjCCallCtx * > contextStack
int skipInlineInitContext
A bunch of utility functions.
276ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
278SCOPENAME ("::"{BN}*)?({ID}{BN}*{SEP}{BN}*)*("~"{BN}*)?{ID}
279TEMPLIST "<"[^\"\}\{\(\)\/\n>]*">"
280SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID})
281SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+
282KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property")
284KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"null"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"sealed"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|"concept"|"requires"|"decltype"|{KEYWORD_OBJC}|"constexpr"|"consteval"|"constinit"|"co_await"|"co_return"|"co_yield"|"static_assert"|"_Static_assert"|"noexcept"|"thread_local"|"enum"{B}+("class"|"struct"))
285FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally")
286FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try")
287TYPEKW ("bool"|"byte"|"char"|"char8_t"|"char16_t"|"char32_t"|"double"|"float"|"int"|"long"|"object"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"size_t"|"boolean"|"id"|"SEL"|"string"|"nullptr")
288TYPEKWSL ("LocalObject"|"Object"|"Value")
289CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast")
290CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'"))
291ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++"
292ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|="
293LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"|"<=>"
294BITOP "&"|"|"|"^"|"<<"|">>"|"~"
295OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
296RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
297RAWEND ")"[^ \t\(\)\\]{0,16}\"
298MODULE_ID ({ID}".")*{ID}
304DECIMAL_INTEGER [1-9][0-9']*[0-9]?[uU]?[lL]?[lL]?
305HEXADECIMAL_INTEGER "0"[xX][0-9a-zA-Z']+[0-9a-zA-Z]?
306OCTAL_INTEGER "0"[0-7][0-7']+[0-7]?
307BINARY_INTEGER "0"[bB][01][01']*[01]?
308INTEGER_NUMBER {DECIMAL_INTEGER}|{HEXADECIMAL_INTEGER}|{OCTAL_INTEGER}|{BINARY_INTEGER}
312DIGIT_SEQ [0-9][0-9']*[0-9]?
313FRAC_CONST {DIGIT_SEQ}"."|{DIGIT_SEQ}?"."{DIGIT_SEQ}
314FP_EXP [eE][+-]?{DIGIT_SEQ}
315DEC_FP1 {FRAC_CONST}{FP_EXP}?{FP_SUF}?
316DEC_FP2 {DIGIT_SEQ}{FP_EXP}{FP_SUF}
318HEX_DIGIT_SEQ [0-9a-fA-F][0-9a-fA-F']*[0-9a-fA-F]?
319HEX_FRAC_CONST {HEX_DIGIT_SEQ}"."|{HEX_DIGIT_SEQ}?"."{HEX_DIGIT_SEQ}
320BIN_EXP [pP][+-]?{DIGIT_SEQ}
321HEX_FP1 "0"[xX]{HEX_FRAC_CONST}{BIN_EXP}{FP_SUF}?
322HEX_FP2 "0"[xX]{HEX_DIGIT_SEQ}{BIN_EXP}{FP_SUF}?
324FLOAT_DECIMAL {DEC_FP1}|{DEC_FP2}
325FLOAT_HEXADECIMAL {HEX_FP1}|{HEX_FP2}
326FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL}
327NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
340ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"sealed"|"override"))*
361%x CppCliTypeModifierFollowup
386<Body>^([ \t]*"#"[ \t]*("include"|"import")[ \t]*)("<"|"\"") {
388 yyextra->code->codify(yytext);
389 BEGIN( ReadInclude );
391<Body>("@interface"|"@implementation"|"@protocol")[ \t\n]+ {
392 yyextra->insideObjC=
TRUE;
396 if (!yyextra->insideTemplate)
399<Body>(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") {
400 if (yyextra->insideTemplate) REJECT;
406<Body>"property"|"event"/{BN}* {
407 if (yyextra->insideTemplate) REJECT;
412<Body>("partial"{B}+)?("class"|"struct"|"union"|"namespace"|"interface"){B}+ {
416 if (!yyextra->insideTemplate)
419<Body>("package")[ \t\n]+ {
423 BEGIN( PackageName );
426 if (!yyextra->insideObjC) REJECT;
430<Body,ClassVar,Bases>"-"|"+" {
431 if (!yyextra->insideObjC || yyextra->insideBody)
433 yyextra->code->codify(yytext);
437 DBG_CTX((stderr,
"Start of Objective-C method!\n"));
438 yyextra->code->codify(yytext);
443 yyextra->code->codify(yytext);
447 yyextra->code->codify(yytext);
448 BEGIN(ObjCParamType);
450<ObjCParams,ObjCMethod>";"|"{" {
451 yyextra->code->codify(yytext);
454 if (yyextra->searchingForBody)
456 yyextra->searchingForBody=
FALSE;
457 yyextra->insideBody=
TRUE;
459 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
460 if (!yyextra->curClassName.isEmpty())
462 pushScope(yyscanner,yyextra->curClassName);
463 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
467 yyextra->type.clear();
468 yyextra->name.clear();
471<ObjCParams>{ID}{B}*":" {
472 yyextra->code->codify(yytext);
474<ObjCParamType>{TYPEKW} {
476 yyextra->code->codify(yytext);
478 yyextra->parmType=yytext;
482 yyextra->parmType=yytext;
485 yyextra->code->codify(yytext);
489 yyextra->code->codify(yytext);
490 yyextra->parmName=yytext;
491 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
492 yyextra->parmType.clear();yyextra->parmName.clear();
494<ObjCMethod,ObjCParams,ObjCParamType>{ID} {
497<ObjCMethod,ObjCParams,ObjCParamType>. {
498 yyextra->code->codify(yytext);
500<ObjCMethod,ObjCParams,ObjCParamType>\n {
503<ReadInclude>[^\n\">]+/(">"|"\"") {
514 DBG_CTX((stderr,
"===== yes %s is ambiguous\n",yytext));
516 if (!name.isEmpty() && yyextra->sourceFileDef)
522 auto it = std::find_if(fn->begin(),
524 [&sfd=yyextra->sourceFileDef]
526 { return sfd->isIncluded(lfd->absFilePath()); });
527 found = it!=fn->end();
543 yyextra->code->codify(yytext);
545 char c=(char)yyinput(yyscanner);
548 yyextra->code->codify(text);
virtual bool isLinkable() const =0
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.
const char * qPrint(const char *s)
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);
559 yyextra->code->codify(yytext);
560 yyextra->lastStringContext=YY_START;
561 BEGIN( SkipString ) ;
564 yyextra->code->codify(yytext);
566<SkipCPP>[^\n\/\\\"]+ {
567 yyextra->code->codify(yytext);
572<SkipCPP>{CPPC}/[^/!] {
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();
581 if (!yyextra->scopeStack.empty())
583 int scope = yyextra->scopeStack.top();
584 yyextra->scopeStack.pop();
592 yyextra->code->codify(yytext);
594 DBG_CTX((stderr,
"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount));
595 if (--yyextra->bodyCurlyCount<=0)
597 yyextra->insideBody=
FALSE;
598 yyextra->currentMemberDef=
nullptr;
599 if (yyextra->currentDefinition)
600 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
604<Body,ClassVar>"@end" {
605 DBG_CTX((stderr,
"End of objc scope fd=%s\n",
qPrint(yyextra->sourceFileDef->name())));
606 if (yyextra->sourceFileDef)
608 const FileDef *fd=yyextra->sourceFileDef;
611 DBG_CTX((stderr,
"insideObjC=%d\n",yyextra->insideObjC));
615 yyextra->insideObjC =
FALSE;
617 if (yyextra->insideBody)
619 yyextra->theVarContext.popScope();
621 if (!yyextra->scopeStack.empty())
623 int scope = yyextra->scopeStack.top();
624 yyextra->scopeStack.pop();
631 yyextra->insideBody=
FALSE;
635 yyextra->code->codify(yytext);
638 yyextra->currentMemberDef=
nullptr;
639 if (yyextra->currentDefinition)
640 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
virtual const QCString & name() const =0
bool endsWith(const char *s) const
643<ClassName,ClassVar>";" {
644 if (yyextra->lang==SrcLangExt::CSharp)
646 yyextra->code->codify(yytext);
647 yyextra->skipCodify =
true;
652 yyextra->code->codify(yytext);
653 yyextra->searchingForBody=
FALSE;
657<ClassName,ClassVar>[*&^%]+ {
658 yyextra->type=yyextra->curClassName;
659 yyextra->name.clear();
660 yyextra->code->codify(yytext);
663<ClassName>"__declspec"{B}*"("{B}*{ID}{B}*")" {
665 yyextra->code->codify(yytext);
668<ClassName>{ID}("."{ID})* |
669<ClassName>{ID}("::"{ID})* {
670 if (yyextra->lang==SrcLangExt::CSharp)
671 yyextra->curClassName=
substitute(yytext,
".",
"::");
673 yyextra->curClassName=yytext;
675 if (yyextra->curClassName==
"alignas")
678 yyextra->code->codify(yytext);
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
689 yyextra->bracketCount=1;
690 yyextra->code->codify(yytext);
693<AlignAs>\n { yyextra->yyLineNr++;
696<AlignAs>. { yyextra->code->codify(yytext); }
697<AlignAsEnd>"(" { yyextra->code->codify(yytext);
698 yyextra->bracketCount++;
701 yyextra->code->codify(yytext);
702 if (--yyextra->bracketCount<=0)
707<AlignAsEnd>\n { yyextra->yyLineNr++;
710<AlignAsEnd>. { yyextra->code->codify(yytext); }
711<ClassName>{ID}("\\"{ID})* {
712 yyextra->curClassName=
substitute(yytext,
"\\",
"::");
714 pushScope(yyscanner,yyextra->curClassName);
719<ClassName>{ID}{B}*"("{ID}")" {
722 pushScope(yyscanner,yyextra->curClassName);
QCString removeRedundantWhiteSpace(const QCString &s)
727<PackageName>{ID}("."{ID})* {
728 yyextra->curClassName=
substitute(yytext,
".",
"::");
729 DBG_CTX((stderr,
"found package: %s\n",
qPrint(yyextra->curClassName)));
737<ClassVar>("extends"|"implements") {
741 yyextra->curClassBases.clear();
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 );
752 yyextra->type = yyextra->curClassName;
753 yyextra->name = yytext;
754 if (yyextra->insideBody)
756 addVariable(yyscanner,yyextra->type,yyextra->name);
760<ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*":"{B}* {
762 yyextra->curClassBases.clear();
765<PackageName>[ \t]*";" |
766<Bases>^{Bopt}/"@"{ID} |
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())
773 yyextra->curClassName = yyextra->name;
775 if (yyextra->searchingForBody)
777 yyextra->searchingForBody=
FALSE;
778 yyextra->insideBody=
TRUE;
780 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
781 if (!yyextra->curClassName.isEmpty())
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)
789 DBG_CTX((stderr,
"Adding new class %s\n",
qPrint(yyextra->curClassName)));
792 for (
const auto &
s : yyextra->curClassBases)
795 auto it = yyextra->codeClassMap.find(
s);
796 if (it!=yyextra->codeClassMap.end())
800 if (bcd==
nullptr) bcd=yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,
QCString(
s),
true);
801 if (bcd && bcd->
name()!=yyextra->curClassName)
803 var.localDef()->insertBaseClass(bcd->
name());
806 yyextra->codeClassMap.emplace(yyextra->curClassName.str(),std::move(var));
812 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
815 yyextra->curClassName.clear();
816 yyextra->curClassBases.clear();
ClassDef * toClassDef(Definition *d)
819<Bases>"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" {
821 yyextra->code->codify(yytext);
824<Bases>{SEP}?({ID}{SEP})*{ID} {
825 DBG_CTX((stderr,
"%s:addBase(%s)\n",
qPrint(yyextra->curClassName),yytext));
826 yyextra->curClassBases.emplace_back(yytext);
830 yyextra->code->codify(yytext);
831 if (!yyextra->insideObjC)
833 yyextra->sharpCount=1;
838 yyextra->insideProtocolList=
TRUE;
842 yyextra->code->codify(yytext);
843 yyextra->insideProtocolList=
FALSE;
846 yyextra->code->codify(yytext);
847 ++yyextra->sharpCount;
850 yyextra->code->codify(yytext);
851 if (--yyextra->sharpCount<=0)
855 yyextra->code->codify(yytext);
856 yyextra->lastStringContext=YY_START;
860 yyextra->code->codify(yytext);
861 yyextra->lastStringContext=YY_START;
865 yyextra->code->codify(yytext);
866 yyextra->sharpCount=1;
870 yyextra->code->codify(yytext);
871 ++yyextra->sharpCount;
874 yyextra->code->codify(yytext);
875 if (--yyextra->sharpCount<=0)
881 yyextra->code->codify(yytext);
885<Body>{SCOPEPREFIX}?"operator"{B}*"()"{Bopt}/"(" {
888 yyextra->bracketCount=0;
889 yyextra->args.clear();
890 yyextra->name+=yytext;
893<Body>{SCOPEPREFIX}?"operator"/"(" {
896 yyextra->bracketCount=0;
897 yyextra->args.clear();
898 yyextra->name+=yytext;
901<Body>{SCOPEPREFIX}?"operator"[^a-z_A-Z0-9\(\n]+/"(" {
904 yyextra->bracketCount=0;
905 yyextra->args.clear();
906 yyextra->name+=yytext;
909<Body,TemplDecl>("template"|"generic")/([^a-zA-Z0-9]) {
913 yyextra->insideTemplate=
TRUE;
914 yyextra->sharpCount=0;
916<Body>"concept"{BN}+ {
922<Body>"using"{BN}+"namespace"{BN}+ {
934<Body>"module"/{B}*[:;]? {
935 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
936 if (!yyextra->type.isEmpty() || !yyextra->name.isEmpty()) REJECT;
942<Body>"import"/{B}*[<":]? {
943 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
949<ConceptName>{ID}("::"{ID})* {
952<ConceptName>"=" {
codifyLines(yyscanner,yytext); BEGIN(Body); }
953<UsingName>{ID}(("::"|"."){ID})* {
958<UsingName>\n {
codifyLines(yyscanner,yytext); BEGIN(Body); }
959<UsingName>. {
codifyLines(yyscanner,yytext); BEGIN(Body); }
960<Body,FuncCall>"$"?"this"("->"|".") { yyextra->code->codify(yytext);
961 yyextra->isPrefixedWithThis =
TRUE;
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)
972 yyextra->name+=yytext;
int find(char c, int index=0, bool cs=TRUE) const
int qstrcmp(const char *str1, const char *str2)
976<Body>{KEYWORD}/{B}* {
982<Body>{KEYWORD}/{BN}*"(" {
987 yyextra->name.clear();yyextra->type.clear();
989<FuncCall>"in"/{BN}* {
990 if (!yyextra->inForEachExpression) REJECT;
995 yyextra->theVarContext.popScope();
996 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
997 yyextra->theVarContext.pushScope();
998 yyextra->name.clear();yyextra->type.clear();
1000<Body>{FLOWKW}/{BN}*"(" {
1004 yyextra->name.clear();yyextra->type.clear();
1005 yyextra->inForEachExpression = (
qstrcmp(yytext,
"for each")==0 ||
qstrcmp(yytext,
"foreach")==0);
1008<Body>{FLOWCONDITION}/{BN}*"(" {
1013 yyextra->name.clear();yyextra->type.clear();
1014 yyextra->inForEachExpression = (strcmp(yytext,
"for each")==0 || strcmp(yytext,
"foreach")==0);
1017<Body>{FLOWKW}/([^a-z_A-Z0-9]) {
1021 if (yyextra->inFunctionTryBlock && (
qstrcmp(yytext,
"catch")==0 ||
qstrcmp(yytext,
"finally")==0))
1023 yyextra->inFunctionTryBlock=
FALSE;
1026<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1031 if (yyextra->inFunctionTryBlock && (strcmp(yytext,
"catch")==0 || strcmp(yytext,
"finally")==0))
1033 yyextra->inFunctionTryBlock=
FALSE;
1036<Body>{FLOWKW}/{B}* {
1041<Body>{FLOWCONDITION}/{B}* {
1048 yyextra->code->codify(yytext);
1049 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1050 yyextra->bracketCount--;
1051 yyextra->parmType = yyextra->name;
1054<Body>"\\)"|"\\(" {
1055 yyextra->code->codify(yytext);
1057<Body>[\\|\)\+\-\/\%\~\!] {
1058 yyextra->code->codify(yytext);
1059 yyextra->name.clear();yyextra->type.clear();
1062 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1063 yyextra->bracketCount--;
1064 if (yyextra->bracketCount<=0)
1070<Body,TemplDecl,ObjCMethod>{TYPEKW}/{B}* {
1072 yyextra->code->codify(yytext);
1075 yyextra->name+=yytext;
1077<Body,TemplDecl,ObjCMethod>{TYPEKWSL}/{B}* {
1078 if (yyextra->lang!=SrcLangExt::Slice)
1085 yyextra->code->codify(yytext);
1088 yyextra->name+=yytext;
1091<Body>"generic"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1093 yyextra->code->codify(yytext);
1095 yyextra->sharpCount=0;
1098<Body>"template"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1100 yyextra->code->codify(yytext);
1102 yyextra->sharpCount=0;
1105<TemplDecl>"class"|"typename" {
1111 yyextra->code->codify(yytext);
1112 yyextra->sharpCount++;
1115 yyextra->code->codify(yytext);
1116 yyextra->sharpCount--;
1117 if (yyextra->sharpCount<=0)
1126 BEGIN( yyextra->lastTemplCastContext );
1128<TemplCast>{ID}("::"{ID})* {
1131<TemplCast>("const"|"volatile"){B}* {
1139<Body,MemberCall2,FuncCall>{CASTKW}{B}*"<" {
1143 yyextra->lastTemplCastContext = YY_START;
1146<Body>"$this->"{SCOPENAME}/{BN}*[;,)\]] {
1149 yyextra->name+=yytext+7;
1151<Body,TemplCast>{SCOPENAME}{B}*"<"[^\n\/\-\.\{\">\(']*">"{ENDIDopt}/{B}* {
1158 yyextra->name+=yytext;
1160<ModuleName,ModuleImport>{MODULE_ID}({BN}*":"{BN}*{MODULE_ID})? {
1162 int i = name.
find(
':');
static ModuleManager & instance()
ModuleDef * getPrimaryInterface(const QCString &moduleName) const
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
QCString left(size_t len) const
1179<ModuleName>":"{BN}+"private" {
1181 int i=text.
find(
'p');
1187<ModuleName>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1188<ModuleName>. { yyextra->code->codify(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); }
1195<Body>{SCOPENAME}/{BN}*[:;,)\]] {
1202 yyextra->name+=yytext;
1204<Body>{ID}("."{ID})+/{BN}+ {
1205 if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
1209 yyextra->name+=yytext;
1216<Body>"export"/{B}* {
1217 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1222<Body>{SCOPENAME}/{B}* {
1229 yyextra->name+=yytext;
1231<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* {
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);
1239<Body>{SCOPETNAME}{B}*"<"[^\n\/\-\.\{\">]*">"/{BN}*"(" |
1240<Body>{SCOPETNAME}/{BN}*"(" {
1247 yyextra->bracketCount=0;
1248 yyextra->args.clear();
1249 yyextra->name+=yytext;
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;
QCString extractBeginRawStringDelimiter(const char *rawStart)
1263<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit,ClassVar,OldStyleArgs>\" {
1265 yyextra->code->codify(yytext);
1266 yyextra->lastStringContext=YY_START;
1267 yyextra->inForEachExpression =
FALSE;
1268 BEGIN( SkipString );
1270<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{NUMBER} {
1271 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1272 yyextra->code->codify(yytext);
1274<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
1276 yyextra->code->codify(yytext);
1277 yyextra->lastStringContext=YY_START;
1278 yyextra->inForEachExpression =
FALSE;
1279 BEGIN( SkipStringS );
1281<SkipString>[^\"\\\r\n]{1,100} {
1282 yyextra->code->codify(yytext);
1284<SkipStringS>[^\'\\\r\n]{1,100} {
1285 yyextra->code->codify(yytext);
1287<SkipString,SkipStringS>{CPPC}|{CCS} {
1288 yyextra->code->codify(yytext);
1291 yyextra->code->codify(yytext);
1292 if (yyextra->lastStringContext!=SkipCPP)
1296 BEGIN( yyextra->lastStringContext );
1299 yyextra->code->codify(yytext);
1301 BEGIN( yyextra->lastStringContext );
1303<SkipString,SkipStringS>\\. {
1304 yyextra->code->codify(yytext);
1306<RawString>{RAWEND} {
1307 yyextra->code->codify(yytext);
1310 BEGIN( yyextra->lastStringContext );
QCString extractEndRawStringDelimiter(const char *rawEnd)
1313<RawString>[^)\n]+ { yyextra->code->codify(yytext); }
1314<RawString>. { yyextra->code->codify(yytext); }
1316<SkipVerbString>[^"\n]+ {
1317 yyextra->code->codify(yytext);
1319<SkipVerbString>\"\" {
1320 yyextra->code->codify(yytext);
1323 yyextra->code->codify(yytext);
1325 BEGIN( yyextra->lastVerbStringContext );
1328 yyextra->code->codify(yytext);
1334 yyextra->code->codify(yytext);
1335 yyextra->name.clear();yyextra->type.clear();
1338 if (yyextra->insideTemplate)
1340 yyextra->sharpCount++;
1342 yyextra->code->codify(yytext);
1345 if (yyextra->insideTemplate)
1347 if (--yyextra->sharpCount<=0)
1349 yyextra->insideTemplate=
FALSE;
1352 yyextra->code->codify(yytext);
1354<Body,MemberCall,MemberCall2,FuncCall,OldStyleArgs>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
1356 yyextra->code->codify(yytext);
1364 yyextra->code->codify(yytext);
1365 yyextra->memCallContext = YY_START;
1366 BEGIN( MemberCall );
1368<MemberCall>{SCOPETNAME}/{BN}*"(" {
1369 if (yyextra->theCallContext.getScope().globalDef())
1376 yyextra->name.clear();
1382 yyextra->name.clear();
1384 yyextra->type.clear();
1385 if (yyextra->memCallContext==Body)
1391 BEGIN(yyextra->memCallContext);
1394<MemberCall>{SCOPENAME}/{B}* {
1395 if (yyextra->theCallContext.getScope().globalDef())
1397 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1403 yyextra->name.clear();
1407 DBG_CTX((stderr,
"no class context!\n"));
1410 yyextra->name.clear();
1412 yyextra->type.clear();
1413 BEGIN(yyextra->memCallContext);
1416 if (yyextra->insideObjC && *yytext==
'[')
1418 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
1420 yyextra->contextMap.clear();
1421 yyextra->nameMap.clear();
1422 yyextra->objectMap.clear();
1423 yyextra->wordMap.clear();
1424 yyextra->commentMap.clear();
1425 yyextra->currentCtxId = 0;
1426 yyextra->currentNameId = 0;
1427 yyextra->currentObjId = 0;
1428 yyextra->currentCtx =
nullptr;
1429 yyextra->braceCount = 0;
1435 if (*yytext!=
'{') yyextra->code->codify(yytext);
1436 yyextra->saveName = yyextra->name;
1437 yyextra->saveType = yyextra->type;
1438 if (*yytext!=
'[' && !yyextra->type.isEmpty())
1445 addVariable(yyscanner,yyextra->type,yyextra->name);
1447 yyextra->name.clear();
1449 if (*yytext==
';' || *yytext==
'=' || *yytext==
'{')
1451 yyextra->type.clear();
1452 yyextra->name.clear();
1454 else if (*yytext==
'[')
1456 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1458 yyextra->args.clear();
1459 yyextra->parmType.clear();
1460 yyextra->parmName.clear();
1468<Body,FuncCall,BodyVar>"{" {
1469 yyextra->theVarContext.pushScope();
1470 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1471 yyextra->bracketCount = 0;
1474 if (yyextra->type.find(
"enum ")!=-1)
1476 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1482 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1486 if (yyextra->searchingForBody)
1488 yyextra->searchingForBody=
FALSE;
1489 yyextra->insideBody=
TRUE;
1491 yyextra->code->codify(yytext);
1492 if (yyextra->insideBody)
1494 yyextra->bodyCurlyCount++;
1496 yyextra->type.clear();
1497 yyextra->name.clear();
1500<ObjCCall,ObjCMName>"["|"{" {
1502 yyextra->currentCtx->format+=*yytext;
1506<ObjCCall,ObjCMName>"]"|"}" {
1507 yyextra->currentCtx->format+=*yytext;
1510 if (yyextra->currentCtx==
nullptr)
1514 auto it = yyextra->contextMap.find(0);
1515 if (it!=yyextra->contextMap.end())
1517 ctx = it->second.get();
1524<ObjCCall,ObjCMName>{CPPC}.* {
1525 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1527<ObjCCall,ObjCMName>{CCS} {
1528 yyextra->lastObjCCallContext = YY_START;
1529 yyextra->currentCtx->comment.str(yytext);
1530 BEGIN(ObjCCallComment);
1532<ObjCCallComment>{CCE} {
1533 yyextra->currentCtx->comment << yytext;
1534 std::string commentStr = yyextra->currentCtx->comment.str();
1535 yyextra->currentCtx->format+=
escapeComment(yyscanner,commentStr.c_str());
1536 BEGIN(yyextra->lastObjCCallContext);
1538<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
1539<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
1540<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
1541<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
1542<ObjCCall>{ID}({B}*"."{B}*{ID})* {
1544 if (yyextra->braceCount==0)
1546 yyextra->currentCtx->objectTypeOrName=yytext;
1547 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1551<ObjCMName>{ID}/{BN}*"]" {
1552 if (yyextra->braceCount==0 &&
1553 yyextra->currentCtx->methodName.isEmpty())
1555 yyextra->currentCtx->methodName=yytext;
1556 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1560 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1563<ObjCMName>{ID}/{BN}*":" {
1564 if (yyextra->braceCount==0)
1566 yyextra->currentCtx->methodName+=yytext;
1567 yyextra->currentCtx->methodName+=
":";
1569 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1571<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1572<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1573<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1574 BEGIN(yyextra->lastStringContext);
1576<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1577<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1578 yyextra->lastStringContext=YY_START;
1581<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+=
"$$"; }
1582<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
1583<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
1584<ObjCSkipStr>"@"/"\"" {
1585 yyextra->currentCtx->format+=yytext;
1587<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext); }
1588<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
1589<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
1592 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1593 yyextra->code->codify(yytext);
1595 yyextra->name = yyextra->saveName;
1596 yyextra->type = yyextra->saveType;
1599 yyextra->code->codify(yytext);
1601<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1602 yyextra->code->codify(yytext);
1604<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1609 yyextra->code->codify(yytext);
1612<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1614 yyextra->parmName=yytext;
1616 yyextra->code->codify(yytext);
1619<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1620 if (yyextra->lang!=SrcLangExt::Slice)
1627 yyextra->parmName=yytext;
1629 yyextra->code->codify(yytext);
1633<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1635 yyextra->parmName=yytext;
1637 yyextra->code->codify(yytext);
1640<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1643 yyextra->parmName=yytext;
1645 yyextra->code->codify(yytext);
1648<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1654 yyextra->parmName=yytext;
1658 yyextra->code->codify(yytext);
1659 yyextra->inForEachExpression =
FALSE;
1662<MemberCall2,FuncCall>, {
1663 yyextra->code->codify(yytext);
1664 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1665 yyextra->parmType.clear();yyextra->parmName.clear();
1667<MemberCall2,FuncCall>"{" {
1668 if (yyextra->bracketCount>0)
1670 yyextra->code->codify(yytext);
1671 yyextra->skipInlineInitContext=YY_START;
1672 yyextra->curlyCount=0;
1680<InlineInit>"{" { yyextra->curlyCount++;
1681 yyextra->code->codify(yytext);
1684 yyextra->code->codify(yytext);
1685 if (--yyextra->curlyCount<=0)
1687 BEGIN(yyextra->skipInlineInitContext);
1694 yyextra->code->codify(yytext);
1696<MemberCall2,FuncCall>"(" {
1697 yyextra->parmType.clear();yyextra->parmName.clear();
1698 yyextra->code->codify(yytext);
1699 yyextra->bracketCount++;
1700 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1701 if (YY_START==FuncCall && !yyextra->insideBody)
1703 yyextra->theVarContext.pushScope();
1706<MemberCall2,FuncCall>{OPERATOR} {
1713 yyextra->parmType.clear();yyextra->parmName.clear();
1715 yyextra->code->codify(yytext);
1717<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1720 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1721 if (yyextra->parmType.isEmpty())
1723 yyextra->parmType=yyextra->parmName;
1724 yyextra->parmName.clear();
1726 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1730 yyextra->parmType = yyextra->parmName;
1731 yyextra->parmName.clear();
1732 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1734 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1735 yyextra->inForEachExpression =
FALSE;
1737 yyextra->code->codify(yytext);
1738 if (--yyextra->bracketCount<=0)
1740 if (yyextra->name.isEmpty())
1750<MemberCall,MemberCall2,FuncCall>[;:] {
1752 if (yyextra->bracketCount<=0)
1759 yyextra->code->codify(yytext);
1762<CallEnd>[ \t\n]* {
codifyLines(yyscanner,yytext); }
1765 yyextra->bracketCount=0;
1766 if (*yytext==
';') yyextra->searchingForBody=
FALSE;
1767 if (!yyextra->type.isEmpty())
1769 DBG_CTX((stderr,
"add variable yyextra->type=%s yyextra->name=%s)\n",
qPrint(yyextra->type),
qPrint(yyextra->name)));
1770 addVariable(yyscanner,yyextra->type,yyextra->name);
1772 yyextra->parmType.clear();yyextra->parmName.clear();
1774 if (*yytext==
';' || yyextra->insideBody)
1776 if (!yyextra->insideBody)
1778 yyextra->theVarContext.popScope();
1780 yyextra->name.clear();yyextra->type.clear();
1785 yyextra->bracketCount=0;
1789<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1794<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1795 if (yyextra->insideBody)
1797 yyextra->theVarContext.pushScope();
1799 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1801 yyextra->parmType.clear();yyextra->parmName.clear();
1802 int index = yyextra->name.findRev(
"::");
1803 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1807 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1813 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1819 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1824 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1827 yytext[yyleng-1]=
'\0';
1829 if (!cv.stripWhiteSpace().isEmpty())
1839 yyextra->code->codify(
"{");
1840 if (yyextra->searchingForBody)
1842 yyextra->searchingForBody=
FALSE;
1843 yyextra->insideBody=
TRUE;
1845 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1846 yyextra->type.clear(); yyextra->name.clear();
static NamespaceDefMutable * globalScope
QCString & prepend(const char *s)
1851 yyextra->code->codify(yytext);
1853 yyextra->inFunctionTryBlock=
TRUE;
1855<CallEnd>"requires" {
1857 yyextra->code->codify(yytext);
1861 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1867 yyextra->parmName=yytext;
1869 BEGIN(OldStyleArgs);
1873 yyextra->parmName=yytext;
1877 yyextra->code->codify(yytext);
1878 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1879 if (*yytext==
';') yyextra->parmType.clear();
1880 yyextra->parmName.clear();
1882<CallEnd,OldStyleArgs>"#" {
1884 yyextra->lastSkipCppContext = Body;
1885 yyextra->code->codify(yytext);
1890 if (!yyextra->insideBody)
1892 yyextra->theVarContext.popScope();
1894 yyextra->name.clear();yyextra->args.clear();
1895 yyextra->parmType.clear();yyextra->parmName.clear();
1899 yyextra->code->codify(yytext);
1900 yyextra->type.clear(); yyextra->name.clear();
1904 yyextra->code->codify(yytext);
1905 if (yyextra->searchingForBody)
1907 yyextra->searchingForBody=
FALSE;
1908 yyextra->insideBody=
TRUE;
1910 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1911 if (yyextra->name.find(
"::")!=-1)
1913 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1919 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1922 yyextra->type.clear(); yyextra->name.clear();
1925<SkipInits>{ID}{B}*"{" {
1927 int bracketPos = text.
find(
'{');
1928 int spacePos = text.
find(
' ');
1929 int len = spacePos==-1 ? bracketPos : spacePos;
1931 yyextra->code->codify(
QCString(yytext+len));
1939<FuncCall>{ID}/("."|"->") {
1940 yyextra->name=yytext;
1942 BEGIN( MemberCall2 );
1944<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1945 yyextra->code->codify(yytext);
1946 uint32_t
s=0;
while (!
isId(yytext[
s]))
s++;
1947 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1948 yyextra->name=((
QCString)yytext).mid(
s,e-
s+1);
1949 BEGIN( MemberCall2 );
1951<MemberCall2>{ID}/([ \t\n]*"(") {
1952 if (!yyextra->args.isEmpty())
1956 yyextra->args.clear();
1959<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1961 yyextra->name=yytext;
1963 BEGIN( MemberCall2 );
1965<MemberCall2>"->"|"." {
1970 yyextra->code->codify(yytext);
1971 yyextra->memCallContext = YY_START;
1972 BEGIN( MemberCall );
1974<SkipComment>{CCS}("!"?){CCE} {
1975 yyextra->code->codify(yytext);
1977 BEGIN( yyextra->lastCContext ) ;
1979<SkipComment>{CPPC}|{CCS} {
1980 yyextra->code->codify(yytext);
1982<SkipComment>[^*\/\n]+ {
1983 yyextra->code->codify(yytext);
1985<SkipComment>[ \t]*{CCE} {
1986 yyextra->code->codify(yytext);
1988 if (yyextra->lastCContext==SkipCPP)
1992 BEGIN( yyextra->lastCContext ) ;
1994<SkipCxxComment>[^\r\n]*"\\"[\r]?\n {
1997<SkipCxxComment>[^\r\n]+ {
1998 yyextra->code->codify(yytext);
2004 BEGIN( yyextra->lastCContext ) ;
2007 yyextra->code->codify(yytext);
2009<MemberCall>[^a-z_A-Z0-9(\n] {
2010 yyextra->code->codify(yytext);
2011 yyextra->type.clear();
2012 yyextra->name.clear();
2013 BEGIN(yyextra->memCallContext);
2015<*>\n({B}*{CPPC}[!/][^\n]*\n)+ {
2016 if (YY_START==SkipCPP) REJECT;
2021 if (YY_START==SkipCxxComment)
2023 BEGIN( yyextra->lastCContext ) ;
2028 BEGIN( yyextra->lastSkipCppContext ) ;
2031<*>\n{B}*{CPPC}"@"[{}].*\n {
2036 if (YY_START==SkipCxxComment)
2038 BEGIN( yyextra->lastCContext ) ;
2041<*>\n{B}*{CCS}"@"[{}] {
2043 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2045 yyextra->lastCContext = YY_START ;
2051<*>^{B}*{CPPC}"@"[{}].*\n {
2057<*>^{B}*{CCS}"@"[{}] {
2059 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2061 yyextra->lastCContext = YY_START ;
2064 yyextra->code->codify(yytext);
2067<*>^{B}*{CPPC}[!/][^\n]* {
2072<*>{CPPC}[!/][^\n]* {
2073 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2078<*>\n{B}*{CCS}[!*]/{NCOMM} {
2080 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2082 yyextra->lastCContext = YY_START ;
2088<*>^{B}*{CCS}"*"[*]+/[^/] {
2090 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2092 yyextra->lastCContext = YY_START ;
2096 yyextra->code->codify(yytext);
#define Config_getBool(name)
2099<*>^{B}*{CCS}[!*]/{NCOMM} {
2101 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2103 yyextra->lastCContext = YY_START ;
2106 yyextra->code->codify(yytext);
2109<*>{CCS}[!*]/{NCOMM} {
2110 if (YY_START==SkipString) REJECT;
2112 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2114 yyextra->lastCContext = YY_START ;
2117 yyextra->code->codify(yytext);
2120<*>{CCS}("!"?){CCE} {
2121 if (YY_START==SkipString) REJECT;
2124 yyextra->code->codify(yytext);
2127<SkipComment>[^\*\n]+ {
2128 yyextra->code->codify(yytext);
2132 yyextra->code->codify(yytext);
2134 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2136 yyextra->lastCContext = YY_START ;
2138 BEGIN( SkipComment ) ;
2142 yyextra->code->codify(yytext);
2143 yyextra->lastVerbStringContext=YY_START;
2144 BEGIN(SkipVerbString);
2148 yyextra->code->codify(yytext);
2149 yyextra->lastCContext = YY_START ;
2150 BEGIN( SkipCxxComment ) ;
2153 if (yytext[0]==
'(') yyextra->bracketCount++;
2154 yyextra->code->codify(yytext);
2155 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2158 if (yytext[0]==
')') yyextra->bracketCount--;
2159 yyextra->code->codify(yytext);
2160 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2166 yyextra->code->codify(yytext);
2169 yyextra->code->codify(yytext);
2186 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2194 DBG_CTX((stderr,
"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n",
2195 qPrint(ltype),
qPrint(lname),yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>"));
2196 auto it = yyextra->codeClassMap.find(ltype.
str());
2197 if (it!=yyextra->codeClassMap.end())
2200 yyextra->theVarContext.addVariable(lname,std::move(it->second));
2204 auto findVariableType = [&yyscanner,&yyg,<ype,&lname,&name](
const Definition *d) ->
const ClassDef *
2206 const ClassDef *varDef = yyextra->symbolResolver.resolveClass(d,ltype,
true);
2213 else if ((
i=ltype.find(
'<'))!=-1)
2220 const ClassDef *varDef = findVariableType(yyextra->currentDefinition);
2221 if (varDef==
nullptr)
2223 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2225 varDef = findVariableType(namespaceDef);
2229 if (varDef==
nullptr)
2231 if (!yyextra->theVarContext.atGlobalScope())
2235 DBG_CTX((stderr,
"** addVariable: dummy context for '%s'\n",
qPrint(lname)));
2240 DBG_CTX((stderr,
"** addVariable: not adding variable!\n"));
2251 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2252 yyextra->scopeNameLengthStack.push_back(
int(yyextra->scopeName.length()));
2253 if (yyextra->scopeName.isEmpty() ||
leftScopeMatch(
s,yyextra->scopeName))
2255 yyextra->scopeName =
s;
2259 yyextra->scopeName +=
"::";
2260 yyextra->scopeName +=
s;
2269 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2270 if (!yyextra->scopeNameLengthStack.empty())
2272 int length = yyextra->scopeNameLengthStack.back();
2273 yyextra->scopeNameLengthStack.pop_back();
2274 yyextra->scopeName.resize(length);
2280 DBG_CTX((stderr,
"popScope() result: '%s'\n",
qPrint(yyextra->scopeName)));
2285 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2288 if (yyextra->searchCtx)
2315 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2321 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
2322 if (ts!=-1 && te!=-1 && te>ts)
2327 while (!yyextra->scopeNameLengthStack.empty())
2331 yyextra->scopeName.clear();
2333 while ((
i=n.
find(
"::"))!=-1)
2339 DBG_CTX((stderr,
"--->New class scope '%s'\n",
qPrint(yyextra->scopeName)));
2344 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2345 while (!yyextra->foldStack.empty())
2347 const Definition *dd = yyextra->foldStack.back();
2350 yyextra->code->endFold();
2352 yyextra->foldStack.pop_back();
2367 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2376 if (endLine!=-1 && startLine!=endLine &&
2384 (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
2392 yyextra->code->startFold(yyextra->yyLineNr,
"",
"");
2396 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2400 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2405 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2409 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2411 yyextra->foldStack.push_back(d);
2423 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2425 if (yyextra->sourceFileDef && yyextra->lineNumbers)
2431 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
2433 DBG_CTX((stderr,
"%s:startCodeLine(%d)=%p\n",
qPrint(yyextra->sourceFileDef->name()),yyextra->yyLineNr,(
void*)d));
2434 if (!yyextra->includeCodeFragment && d)
2436 yyextra->currentDefinition = d;
2437 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
2438 yyextra->insideBody =
FALSE;
2439 yyextra->searchingForBody =
TRUE;
2441 yyextra->type.
clear();
2442 yyextra->name.clear();
2443 yyextra->args.clear();
2444 yyextra->parmType.clear();
2445 yyextra->parmName.clear();
2446 DBG_CTX((stderr,
"Real scope: '%s'\n",
qPrint(yyextra->realScope)));
2447 yyextra->bodyCurlyCount = 0;
2449 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
2450 if (yyextra->currentMemberDef)
2453 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
2454 yyextra->currentMemberDef->getOutputFileBase(),
2455 yyextra->currentMemberDef->anchor(),
2456 yyextra->yyLineNr,!yyextra->includeCodeFragment);
2464 QCString(),yyextra->yyLineNr,!yyextra->includeCodeFragment);
2476 !yyextra->includeCodeFragment);
2479 DBG_CTX((stderr,
"startCodeLine(%d)\n",yyextra->yyLineNr));
2480 yyextra->code->startCodeLine(yyextra->yyLineNr);
2481 yyextra->insideCodeLine =
true;
2482 if (yyextra->currentFontClass)
2484 yyextra->code->startFontClass(
QCString(yyextra->currentFontClass));
2492 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2493 DBG_CTX((stderr,
"endCodeLine(%d)\n",yyextra->yyLineNr));
2495 yyextra->code->endCodeLine();
2496 yyextra->insideCodeLine =
false;
2501 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2502 const char * fc = yyextra->currentFontClass;
2503 if (yyextra->insideCodeLine)
2507 if (yyextra->yyLineNr<yyextra->inputLines)
2509 yyextra->currentFontClass = fc;
2519 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2520 DBG_CTX((stderr,
"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,
qPrint(text)));
2522 const char *p=text.
data(),*sp=p;
2528 while ((c=*p++) && c!=
'\n');
2531 yyextra->yyLineNr++;
2532 size_t l =
static_cast<size_t>(p-sp-1);
2533 std::string tmp(sp,l);
2534 yyextra->code->codify(tmp.c_str());
2539 yyextra->code->codify(
QCString(sp));
2553 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2554 if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
2572 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2574 yyextra->tooltipManager.addTooltip(d);
2579 if (!sourceTooltips)
2584 const char *p=text.
data();
2589 while ((c=*p++) && c!=
'\n') { }
2592 yyextra->yyLineNr++;
2608 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2609 if (yyextra->name==
"const") { yyextra->name.clear();
return; }
2610 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2611 yyextra->type += yyextra->name ;
2612 yyextra->name.clear() ;
2613 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2614 yyextra->type += yyextra->args ;
2615 yyextra->args.clear() ;
2620 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2621 if (yyextra->parmName==
"const") { yyextra->parmName.clear();
return; }
2622 if (!yyextra->parmType.isEmpty()) yyextra->parmType +=
' ' ;
2623 yyextra->parmType += yyextra->parmName ;
2624 yyextra->parmName.clear() ;
2630 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2631 if (yyextra->sourceFileDef && !name.
isEmpty())
2636 yyextra->theUsingContext.emplace(name.
str(),nd);
2643 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2646 yyextra->parmName = a.name;
2647 yyextra->parmType = a.type;
2648 int i = yyextra->parmType.find(
'*');
2649 if (
i!=-1) yyextra->parmType = yyextra->parmType.left(
i);
2650 i = yyextra->parmType.find(
'&');
2651 if (
i!=-1) yyextra->parmType = yyextra->parmType.left(
i);
2652 yyextra->parmType.stripPrefix(
"const ");
2653 yyextra->parmType=yyextra->parmType.stripWhiteSpace();
2654 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
2660 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2661 DBG_CTX((stderr,
"stripClassName(scope=%s,type=%s) scopeName=%s\n",
2669 QCString clName=className+templSpec;
2671 if (!yyextra->scopeName.isEmpty())
2673 cd=yyextra->symbolResolver.resolveClass(d,yyextra->scopeName+
"::"+clName,
true);
2677 cd=yyextra->symbolResolver.resolveClass(d,clName,
true);
2679 DBG_CTX((stderr,
"stripClass trying '%s' = %p\n",
qPrint(clName),(
void*)cd));
2691 if (name.
isEmpty())
return nullptr;
2692 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2693 DBG_CTX((stderr,
"setCallContextForVar(%s) yyextra->scopeName=%s\n",
qPrint(name),
qPrint(yyextra->scopeName)));
2695 int scopeEnd = name.
findRev(
"::");
2702 if (mcd && !locName.
isEmpty())
2715 if (mnd && !locName.
isEmpty())
2731 DBG_CTX((stderr,
"local variable?\n"));
2735 yyextra->theCallContext.setScope(*mcv);
2740 DBG_CTX((stderr,
"class member? scope=%s\n",
qPrint(yyextra->scopeName)));
2750 if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=
CLASSBLOCK)
2767 const std::unique_ptr<MemberDef> &md=mn->
front();
2768 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2775 else if (mn->
size()>1)
2777 for (
const auto &md : *mn)
2786 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2789 DBG_CTX((stderr,
"returning member %s in source file %s\n",
qPrint(md->name()),
qPrint(yyextra->sourceFileDef->name())));
2801 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2802 const Definition *d = yyextra->theCallContext.getScope().globalDef();
2825 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2826 DBG_CTX((stderr,
"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",
qPrint(c),
qPrint(m),varOnly));
2831 DBG_CTX((stderr,
"scopeNameLengthStack.size()=%zu\n",yyextra->scopeNameLengthStack.size()));
2832 if (!result.
found && !yyextra->scopeNameLengthStack.empty() && c==yyextra->scopeName)
2834 QCString localName = yyextra->scopeName.
mid(yyextra->scopeNameLengthStack[0]+2);
2835 auto it = yyextra->codeClassMap.
find(localName.
str());
2836 if (it!=yyextra->codeClassMap.end())
2843 DBG_CTX((stderr,
"trying lookup via base class %s\n",
qPrint(bcName)));
2846 if (result.
found)
break;
2856 if (yyextra->exampleBlock)
2860 anchor.
sprintf(
"a%d",yyextra->anchorCount);
2862 qPrint(yyextra->exampleFile)));
2864 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
2867 yyextra->anchorCount++;
2881 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n",
2882 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,yyextra->insideBody));
2884 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
2885 yyextra->insideBody && yyextra->collectXRefs)
2907 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2908 DBG_CTX((stderr,
"getLink(%s,%s) yyextra->curClassName=%s\n",
2914 if (!yyextra->curClassName.isEmpty())
2917 c.
prepend(yyextra->curClassName);
2931 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2933 if (!scopeName.
isEmpty() && scopeName[0]==
'~')
2935 scopeName=scopeName.
mid(1);
2939 yyextra->code->codify(
"~");
2942 if (yyextra->insideProtocolList)
2946 if (yyextra->lang==SrcLangExt::PHP)
2950 else if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
2954 if (yyextra->currentDefinition==
nullptr && !yyextra->scopeName.isEmpty())
2956 scopeName = yyextra->scopeName+
"::"+scopeName;
2962 DBG_CTX((stderr,
"generateClassOrGlobalLink(name=%s) yyextra->scopeName=%s scopeName=%s\n",
qPrint(scName),
qPrint(yyextra->scopeName),
qPrint(scopeName)));
2963 if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(scopeName))==
nullptr)
2965 int i=scopeName.
find(
'<');
2967 if (
i!=-1) bareName = bareName.
left(
i);
2969 auto checkForSymbol = [&yyg,&bareName,&scopeName](
const Definition *
parent,
2972 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,scopeName,
QCString(),
false,
true);
2973 DBG_CTX((stderr,
"non-local variable name=%s sym=%s!\n",
2974 qPrint(scopeName),sym_?
qPrint(sym_->name()):
"<none>"));
2975 if (sym_==
nullptr && !bareName.
isEmpty())
2978 if (bareName!=scopeName)
2980 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,bareName,
QCString(),
false,
true);
2984 const Definition *d = yyextra->currentDefinition;
2985 DBG_CTX((stderr,
"d=%s yyextra->sourceFileDef=%s\n",d?
qPrint(d->
name()):
"<none>",yyextra->sourceFileDef?
qPrint(yyextra->sourceFileDef->name()):
"<none>"));
2986 checkForSymbol(d,sym);
2995 checkForSymbol(nd,sym);
3003 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
3005 checkForSymbol(namespaceDef,sym);
3027 DBG_CTX((stderr,
"is found as a type sym=%s nd=%s\n",
3032 if (
getLink(yyscanner,yyextra->scopeName,scName,ol,scName,varOnly))
3040 DBG_CTX((stderr,
"local variable!\n"));
3044 yyextra->theCallContext.setScope(*lcd);
3055 DBG_CTX((stderr,
"is a local variable sym=%p!\n",(
void*)sym));
3057 yyextra->isPrefixedWithThis =
FALSE;
3062 if (yyextra->exampleBlock)
3066 anchor.
sprintf(
"_a%d",yyextra->anchorCount);
3067 DBG_CTX((stderr,
"addExampleClass(%s,%s,%s)\n",
qPrint(anchor),
qPrint(yyextra->exampleName),
3068 qPrint(yyextra->exampleFile)));
3072 if (cdm && cdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3075 yyextra->anchorCount++;
3081 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3084 yyextra->anchorCount++;
3098 yyextra->currentMemberDef && yyextra->collectXRefs)
3107 DBG_CTX((stderr,
"class %s not linkable! cd=%p typeOnly=%d\n",
qPrint(scName),(
void*)sym,typeOnly));
3108 if (!isLocal && (md || (!sym && !typeOnly)))
3113 DBG_CTX((stderr,
"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%s\n",
qPrint(scName),(
void*)md,yyextra->currentDefinition ?
qPrint(yyextra->currentDefinition->name()) :
"<none>"));
3114 if (md && yyextra->currentDefinition)
3116 DBG_CTX((stderr,
"%s accessible from %s? %d md->getOuterScope=%s\n",
3117 qPrint(md->name()),
qPrint(yyextra->currentDefinition->name()),
3118 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md),
3119 qPrint(md->getOuterScope()->name())));
3122 if (md && yyextra->currentDefinition &&
3123 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md)==-1)
3130 DBG_CTX((stderr,
"is a global md=%p yyextra->currentDefinition=%s linkable=%d\n",(
void*)md,yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>",md->isLinkable()));
3131 if (md->isLinkable())
3135 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3145 DBG_CTX((stderr,
"not found!\n"));
3152 bool typeOnly,
bool varOnly)
3162 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3166 DBG_CTX((stderr,
"type='%s' args='%s' class=%s\n",
3170 if (yyextra->exampleBlock)
3174 anchor.
sprintf(
"a%d",yyextra->anchorCount);
3176 qPrint(yyextra->exampleFile)));
3178 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3181 yyextra->anchorCount++;
3195 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",
3196 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,(
void*)xmd,yyextra->insideBody));
3198 if (xmd->templateMaster()) xmd = xmd->templateMaster();
3200 if (xmd->isLinkable())
3203 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
3204 yyextra->insideBody && yyextra->collectXRefs)
3224 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3229 DBG_CTX((stderr,
"generateClassMemberLink(class=%s,member=%s)=%p\n",
qPrint(def->
name()),
qPrint(memName),(
void*)xmd));
3267 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3268 DBG_CTX((stderr,
"generateMemberLink(object=%s,mem=%s) classScope=%s\n",
3271 if (varName.
isEmpty())
return;
3279 DBG_CTX((stderr,
"Class found!\n"));
3282 DBG_CTX((stderr,
"Found result!\n"));
3289 if (
getLink(yyscanner,bcName,memName,ol))
3291 DBG_CTX((stderr,
"Found result!\n"));
3300 const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->scopeName,
true);
3303 DBG_CTX((stderr,
"Found class %s for variable '%s'\n",
qPrint(yyextra->scopeName),
qPrint(varName)));
3317 for (
const auto &vmd : *vmn)
3319 if (vmd->getClassDef()==jcd)
3321 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3334 DBG_CTX((stderr,
"There is a variable with name '%s'\n",
qPrint(varName)));
3335 for (
const auto &vmd : *vmn)
3337 if (vmd->getClassDef()==vcd)
3339 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3358 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3361 DBG_CTX((stderr,
"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,
qPrint(name),
qPrint(yyextra->scopeName)));
3370 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3372 QCString locScope=yyextra->scopeName;
3374 if (yyextra->lang==SrcLangExt::PHP && locFunc.
startsWith(
"self::")) locFunc=locFunc.
mid(4);
3377 QCString funcWithFullScope=locFunc;
3382 if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() &&
3383 funcName==yyextra->currentMemberDef->localName() &&
3384 yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr &&
3396 if (
i==-1)
i=locFunc.
findRev(
"."),len=1;
3397 if (
i==-1)
i=locFunc.
findRev(
"\\"),len=1;
3400 funcScope=locFunc.
left(
i);
3402 int ts=locScope.
find(
'<');
3404 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3405 if (ts!=-1 && te!=-1 && te>ts)
3410 ts=funcScope.
find(
'<');
3412 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3413 if (ts!=-1 && te!=-1 && te>ts)
3416 funcScope=funcScope.
left(ts)+funcScope.
right(funcScope.
length()-te-1);
3420 funcWithScope = funcScope+
"::"+locFunc;
3423 fullScope=locScope+
"::"+funcScope;
3428 funcWithFullScope = locScope+
"::"+funcWithScope;
3434 auto it = yyextra->codeClassMap.find(fullScope.
str());
3435 if (it!=yyextra->codeClassMap.end())
3442 if (
getLink(yyscanner,bcName,locFunc,ol,funcName))
3451 if (!locScope.
isEmpty() && fullScope!=locScope)
3453 auto it = yyextra->codeClassMap.find(locScope.
str());
3454 if (it!=yyextra->codeClassMap.end())
3461 if (
getLink(yyscanner,bcName,funcWithScope,ol,funcName))
3469 if (!
getLink(yyscanner,locScope,funcWithScope,ol,funcName))
3485 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3486 const char *p=yyextra->inputString;
3492 if (c==
'\n') count++;
3494 if (p>yyextra->inputString && *(p-1)!=
'\n')
3503 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3504 if (yyextra->currentFontClass)
3506 yyextra->code->endFontClass();
3507 yyextra->currentFontClass=
nullptr;
3509 if (specialComment && yyextra->insideSpecialComment)
3511 yyextra->code->endSpecialComment();
3512 yyextra->insideSpecialComment =
false;
3518 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3522 yyextra->code->startSpecialComment();
3523 yyextra->insideSpecialComment =
true;
3525 yyextra->code->startFontClass(
QCString(
s));
3526 yyextra->currentFontClass=
s;
3534 if (ctx==
nullptr)
return;
3535 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3539 DBG_CTX((stderr,
"writeObjCMethodCall(%s) obj=%s method=%s\n",
3548 DBG_CTX((stderr,
" object is local variable\n"));
3556 DBG_CTX((stderr,
" class=%p method=%p\n",(
void*)cd,(
void*)ctx->
method));
3567 char skipChar =
' ';
3592 yyextra->code->codify(
"$");
3600 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3602 int refId=refIdStr.
toInt();
3603 auto it = yyextra->nameMap.find(refId);
3604 if (it!=yyextra->nameMap.end())
3610 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3622 DBG_CTX((stderr,
"Invalid name: id=%d\n",refId));
3629 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3631 int refId=refIdStr.
toInt();
3632 auto it = yyextra->objectMap.find(refId);
3633 if (it!=yyextra->objectMap.end())
3638 if (yyextra->currentDefinition &&
3655 else if (
object==
"super")
3657 if (yyextra->currentDefinition &&
3684 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3697 int dotPos=
object.find(
'.',pp);
3698 int len =
static_cast<int>(
object.length());
3699 if (dotPos==-1) dotPos=len;
3700 const Definition *scope = yyextra->currentDefinition;
3707 if (fragmentStripped==
"self")
3720 const Definition *symbol = yyextra->symbolResolver.resolveSymbol(scope,fragmentStripped,
QCString(),
false,
true);
3726 ctx->
method = yyextra->symbolResolver.getTypedef();
3750 dotPos=
object.find(
'.',pp);
3751 if (dotPos==-1) dotPos=len;
3760 else if (ctx->
method==
nullptr)
3763 DBG_CTX((stderr,
"yyextra->currentDefinition=%p\n",(
void*)yyextra->currentDefinition));
3764 if (yyextra->currentDefinition &&
3785 DBG_CTX((stderr,
"Invalid object: id=%d\n",refId));
3792 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3794 int refId=refIdStr.
toInt();
3795 auto it = yyextra->contextMap.find(refId);
3796 if (it!=yyextra->contextMap.end())
3811 if (mn && mn->
size()==1)
3829 DBG_CTX((stderr,
"Invalid context: id=%d\n",refId));
3836 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3838 int refId=refIdStr.
toInt();
3839 auto it = yyextra->wordMap.find(refId);
3840 if (it!=yyextra->wordMap.end())
3843 bool isKeyword = word==
"self";
3859 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3861 int refId=refIdStr.
toInt();
3862 auto it = yyextra->commentMap.find(refId);
3863 if (it!=yyextra->commentMap.end())
3877 else if (c==
'\'' || c ==
'"')
3894 DBG_CTX((stderr,
"}=(type='%s',name='%s')",
3904 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3906 result.
sprintf(
"$n%d",yyextra->currentNameId);
3907 yyextra->nameMap.emplace(yyextra->currentNameId,
s);
3908 yyextra->currentNameId++;
3914 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3916 result.
sprintf(
"$o%d",yyextra->currentObjId);
3917 yyextra->objectMap.emplace(yyextra->currentObjId,
s);
3918 yyextra->currentObjId++;
3924 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3926 result.
sprintf(
"$w%d",yyextra->currentWordId);
3927 yyextra->wordMap.emplace(yyextra->currentWordId,
s);
3928 yyextra->currentWordId++;
3934 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3936 result.
sprintf(
"$d%d",yyextra->currentCommentId);
3937 yyextra->commentMap.emplace(yyextra->currentCommentId,
s);
3938 yyextra->currentCommentId++;
3944 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3945 static const std::unordered_set<std::string> non_cpp_keywords = {
3946 "__assume",
"__super",
"abstract",
"function",
3947 "gcnew",
"gcroot",
"generic",
"get",
3948 "internal",
"null",
"pin_ptr",
"raise",
3949 "remove",
"self",
"set",
"transient",
3952 static const std::unordered_set<std::string> non_java_keywords = {
3953 "alignas",
"alignof",
"and",
"and_eq",
"asm",
3954 "atomic_cancel",
"atomic_commit",
"atomic_noexcept",
"auto",
"bitand",
3955 "bitor",
"bool",
"char8_t",
"char16_t",
"char32_t",
3956 "compl",
"concept",
"consteval",
"constexpr",
"constinit",
3957 "const_cast",
"co_await",
"co_return",
"co_yield",
"decltype",
3958 "delete",
"dynamic_cast",
"explicit",
"export",
"extern",
3959 "friend",
"inline",
"mutable",
"namespace",
"noexcept",
3960 "not",
"not_eq",
"nullptr",
"operator",
"or",
3961 "or_eq",
"reflexpr",
"register",
"reinterpret_cast",
"requires",
3962 "signed",
"sizeof",
"static_assert",
"_Static_assert",
"static_cast",
"struct",
3963 "template",
"thread_local",
"typedef",
"typeid",
"typename",
3964 "union",
"unsigned",
"using",
"virtual",
"wchar_t",
3965 "xor",
"xor_eq",
"override",
"sealed"
3967 bool retval =
false;
3968 switch (yyextra->lang)
3970 case SrcLangExt::Cpp:
3971 retval = (non_cpp_keywords.find(keyword) != non_cpp_keywords.end());
3973 case SrcLangExt::Java:
3974 retval = (non_java_keywords.find(keyword) != non_java_keywords.end());
3989 return kw==
"const_cast" || kw==
"static_cast" || kw==
"dynamic_cast" || kw==
"reinterpret_cast";
3994 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3995 yy_size_t inputPosition = yyextra->inputPosition;
3996 const char *
s = yyextra->inputString + inputPosition;
3998 while( c < max_size && *
s )
4003 yyextra->inputPosition += c;
4010 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4011 if (yyextra->currentCtx)
4013 yyextra->currentCtx->format+=
QCString().
sprintf(
"$c%d",yyextra->currentCtxId);
4014 if (yyextra->braceCount==0 && YY_START==ObjCCall)
4016 yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1);
4017 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
4019 yyextra->contextStack.push(yyextra->currentCtx);
4023 DBG_CTX((stderr,
"Trying to save NULL context!\n"));
4025 auto newCtx = std::make_unique<ObjCCallCtx>();
4026 newCtx->id = yyextra->currentCtxId;
4027 newCtx->lexState = YY_START;
4028 newCtx->braceCount = yyextra->braceCount;
4029 newCtx->objectType =
nullptr;
4030 newCtx->objectVar =
nullptr;
4031 newCtx->method =
nullptr;
4032 DBG_CTX((stderr,
"save state=%d\n",YY_START));
4033 yyextra->currentCtx = newCtx.get();
4034 yyextra->contextMap.emplace(yyextra->currentCtxId,std::move(newCtx));
4035 yyextra->braceCount = 0;
4036 yyextra->currentCtxId++;
4041 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4042 DBG_CTX((stderr,
"restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState));
4043 BEGIN(yyextra->currentCtx->lexState);
4044 yyextra->braceCount = yyextra->currentCtx->braceCount;
4045 if (!yyextra->contextStack.empty())
4047 yyextra->currentCtx = yyextra->contextStack.top();
4048 yyextra->contextStack.pop();
4052 yyextra->currentCtx =
nullptr;
4053 DBG_CTX((stderr,
"Trying to pop context while yyextra->contextStack is empty!\n"));
4065 codeYYlex_init_extra(&
p->state,&
p->yyscanner);
4074 codeYYlex_destroy(
p->yyscanner);
4079 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4080 DBG_CTX((stderr,
"***CodeParser::reset()\n"));
4081 yyextra->theVarContext.clear();
4082 while (!yyextra->scopeNameLengthStack.empty()) yyextra->scopeNameLengthStack.pop_back();
4083 yyextra->codeClassMap.clear();
4084 yyextra->curClassBases.clear();
4085 yyextra->anchorCount = 0;
4086 yyextra->insideCodeLine =
false;
4091 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4092 yyextra->insideCodeLine = inp;
4097 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4098 return yyextra->insideCodeLine;
4103 int startLine,
int endLine,
bool inlineFragment,
4108 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4109 DBG_CTX((stderr,
"***parseCode() exBlock=%d exName=%s fd=%p scopeName=%s searchCtx=%s\n",
4112 if (
s.isEmpty())
return;
4117 yyextra->code = &od;
4118 yyextra->inputString =
s.data();
4119 yyextra->fileName = fd ? fd->
fileName():
"";
4121 yyextra->inputPosition = 0;
4122 codeYYrestart(
nullptr,yyscanner);
4123 yyextra->currentFontClass =
nullptr;
4124 yyextra->searchCtx = searchCtx;
4125 yyextra->collectXRefs = collectXRefs;
4126 yyextra->inFunctionTryBlock =
FALSE;
4127 yyextra->symbolResolver.setFileScope(fd);
4128 yyextra->foldStack.clear();
4129 yyextra->insideSpecialComment =
false;
4132 yyextra->yyLineNr = startLine;
4134 yyextra->yyLineNr = 1;
4137 yyextra->inputLines = endLine+1;
4139 yyextra->inputLines = yyextra->yyLineNr +
countLines(yyscanner) - 1;
4141 yyextra->curlyCount = 0;
4142 yyextra->bodyCurlyCount = 0;
4143 yyextra->bracketCount = 0;
4144 yyextra->sharpCount = 0;
4145 yyextra->insideTemplate =
FALSE;
4146 yyextra->theCallContext.clear();
4147 while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
4148 yyextra->scopeName = scopeName;
4150 yyextra->exampleBlock = exBlock;
4151 yyextra->exampleName = exName;
4152 yyextra->sourceFileDef = fd;
4153 yyextra->lineNumbers = fd && showLineNumbers;
4158 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
4160 yyextra->lang = lang;
4161 yyextra->insideObjC = lang==SrcLangExt::ObjC;
4162 if (yyextra->sourceFileDef)
4167 yyextra->currentMemberDef =
nullptr;
4168 yyextra->searchingForBody = exBlock;
4169 yyextra->insideBody =
FALSE;
4170 yyextra->bracketCount = 0;
4171 if (!yyextra->exampleName.isEmpty())
4174 DBG_CTX((stderr,
"yyextra->exampleFile=%s\n",
qPrint(yyextra->exampleFile)));
4176 yyextra->includeCodeFragment = inlineFragment;
4177 DBG_CTX((stderr,
"** exBlock=%d exName=%s include=%d\n",exBlock,
qPrint(exName),inlineFragment));
4178 if (!yyextra->insideCodeLine)
4182 yyextra->type.clear();
4183 yyextra->name.clear();
4184 yyextra->args.clear();
4185 yyextra->parmName.clear();
4186 yyextra->parmType.clear();
4189 codeYYlex(yyscanner);
4190 yyextra->lexInit=
TRUE;
4191 if (yyextra->insideCodeLine)
4197 while (!yyextra->foldStack.empty())
4199 yyextra->code->endFold();
4200 yyextra->foldStack.pop_back();
4203 if (yyextra->exampleFileDef)
4206 yyextra->exampleFileDef.reset();
4207 yyextra->sourceFileDef=
nullptr;
4210 yyextra->tooltipManager.writeTooltips(od);
void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool stripCodeComments, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
void resetCodeParserState() override
Resets the state of the code parser.
void setInsideCodeLine(bool inp)
std::unique_ptr< Private > p
bool insideCodeLine() const
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual const MemberDef * getMemberByName(const QCString &) const =0
Returns the member with the given name.
virtual ClassDef * categoryOf() const =0
Returns the class of which this is a category (Objective-C only)
virtual FileDef * getFileDef() const =0
Returns the namespace this compound is in, or 0 if it has a global scope.
virtual bool addExample(const QCString &anchor, const QCString &name, const QCString &file)=0
static bool isFlagSet(const DebugMask mask)
virtual int getEndBodyLine() const =0
virtual DefType definitionType() const =0
virtual QCString anchor() const =0
virtual QCString briefDescriptionAsTooltip() const =0
virtual bool isLinkableInProject() const =0
virtual const Definition * findInnerCompound(const QCString &name) const =0
virtual int getStartDefLine() const =0
virtual QCString getReference() const =0
virtual QCString qualifiedName() const =0
virtual CodeSymbolType codeSymbolType() const =0
virtual QCString getOutputFileBase() const =0
virtual Definition * getOuterScope() const =0
static NamespaceLinkedMap * namespaceLinkedMap
static MemberNameLinkedMap * functionNameLinkedMap
static std::mutex countFlowKeywordsMutex
static MemberNameLinkedMap * memberNameLinkedMap
static SearchIndexIntf searchIndex
static std::mutex addExampleMutex
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
virtual QCString fileName() const =0
std::vector< QCString > baseClasses() const
virtual QCString typeString() const =0
virtual const ClassDef * getClassDef() const =0
virtual GroupDef * getGroupDef()=0
virtual const FileDef * getFileDef() const =0
virtual const ArgumentList & argumentList() const =0
virtual MemberDef * resolveAlias()=0
virtual bool isDefine() const =0
virtual bool isVariable() const =0
virtual QCString argsString() const =0
virtual bool isCallable() const =0
virtual void incrementFlowKeyWordCount()=0
virtual bool addExample(const QCString &anchor, const QCString &name, const QCString &file)=0
An abstract interface of a namespace symbol.
virtual const MemberDef * getMemberByName(const QCString &) const =0
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
void writeCodeAnchor(const QCString &name)
void stripCodeComments(bool b)
int toInt(bool *ok=nullptr, int base=10) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
bool startsWith(const char *s) const
char & at(size_t i)
Returns a reference to the character at index i.
bool isEmpty() const
Returns TRUE iff the string is empty.
const std::string & str() const
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
QCString right(size_t len) const
QCString & sprintf(const char *format,...)
int findRev(char c, int index=-1, bool cs=TRUE) const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
bool stripPrefix(const QCString &prefix)
const Definition * globalDef() const
ClassDefMutable * toClassDefMutable(Definition *d)
ClassDef * getClass(const QCString &n)
static void codeFolding(yyscan_t yyscanner, const Definition *d)
ConceptDef * getResolvedConcept(const Definition *d, const QCString &name)
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
void addDocCrossReference(const MemberDef *s, const MemberDef *d)
MemberDefMutable * toMemberDefMutable(Definition *d)
MemberDef * toMemberDef(Definition *d)
NamespaceDef * getResolvedNamespace(const QCString &name)
NamespaceDef * toNamespaceDef(Definition *d)
This class contains the information about the argument of a function or template.
int extractClassNameFromType(const QCString &type, int &pos, QCString &name, QCString &templSpec, SrcLangExt lang)
bool leftScopeMatch(const QCString &scope, const QCString &name)
QCString removeAnonymousScopes(const QCString &str)
QCString convertNameToFile(const QCString &name, bool allowDots, bool allowUnderscore)
GetDefResult getDefs(const GetDefInput &input)