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;
1260 yyextra->delimiter = yytext+i+2;
1261 yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
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 );
1271<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{NUMBER} {
1272 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1273 yyextra->code->codify(yytext);
1275<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
1277 yyextra->code->codify(yytext);
1278 yyextra->lastStringContext=YY_START;
1279 yyextra->inForEachExpression =
FALSE;
1280 BEGIN( SkipStringS );
1282<SkipString>[^\"\\\r\n]* {
1283 yyextra->code->codify(yytext);
1285<SkipStringS>[^\'\\\r\n]* {
1286 yyextra->code->codify(yytext);
1288<SkipString,SkipStringS>{CPPC}|{CCS} {
1289 yyextra->code->codify(yytext);
1292 yyextra->code->codify(yytext);
1293 if (yyextra->lastStringContext!=SkipCPP)
1297 BEGIN( yyextra->lastStringContext );
1300 yyextra->code->codify(yytext);
1302 BEGIN( yyextra->lastStringContext );
1304<SkipString,SkipStringS>\\. {
1305 yyextra->code->codify(yytext);
1307<RawString>{RAWEND} {
1308 yyextra->code->codify(yytext);
1310 delimiter=delimiter.left(delimiter.length()-1);
1311 if (delimiter==yyextra->delimiter)
1313 BEGIN( yyextra->lastStringContext );
1316<RawString>[^)\n]+ { yyextra->code->codify(yytext); }
1317<RawString>. { yyextra->code->codify(yytext); }
1319<SkipVerbString>[^"\n]+ {
1320 yyextra->code->codify(yytext);
1322<SkipVerbString>\"\" {
1323 yyextra->code->codify(yytext);
1326 yyextra->code->codify(yytext);
1328 BEGIN( yyextra->lastVerbStringContext );
1331 yyextra->code->codify(yytext);
1337 yyextra->code->codify(yytext);
1338 yyextra->name.clear();yyextra->type.clear();
1341 if (yyextra->insideTemplate)
1343 yyextra->sharpCount++;
1345 yyextra->code->codify(yytext);
1348 if (yyextra->insideTemplate)
1350 if (--yyextra->sharpCount<=0)
1352 yyextra->insideTemplate=
FALSE;
1355 yyextra->code->codify(yytext);
1357<Body,MemberCall,MemberCall2,FuncCall,OldStyleArgs>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
1359 yyextra->code->codify(yytext);
1367 yyextra->code->codify(yytext);
1368 yyextra->memCallContext = YY_START;
1369 BEGIN( MemberCall );
1371<MemberCall>{SCOPETNAME}/{BN}*"(" {
1372 if (yyextra->theCallContext.getScope().globalDef())
1379 yyextra->name.clear();
1385 yyextra->name.clear();
1387 yyextra->type.clear();
1388 if (yyextra->memCallContext==Body)
1394 BEGIN(yyextra->memCallContext);
1397<MemberCall>{SCOPENAME}/{B}* {
1398 if (yyextra->theCallContext.getScope().globalDef())
1400 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1406 yyextra->name.clear();
1410 DBG_CTX((stderr,
"no class context!\n"));
1413 yyextra->name.clear();
1415 yyextra->type.clear();
1416 BEGIN(yyextra->memCallContext);
1419 if (yyextra->insideObjC && *yytext==
'[')
1421 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
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;
1438 if (*yytext!=
'{') yyextra->code->codify(yytext);
1439 yyextra->saveName = yyextra->name;
1440 yyextra->saveType = yyextra->type;
1441 if (*yytext!=
'[' && !yyextra->type.isEmpty())
1448 addVariable(yyscanner,yyextra->type,yyextra->name);
1450 yyextra->name.clear();
1452 if (*yytext==
';' || *yytext==
'=' || *yytext==
'{')
1454 yyextra->type.clear();
1455 yyextra->name.clear();
1457 else if (*yytext==
'[')
1459 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1461 yyextra->args.clear();
1462 yyextra->parmType.clear();
1463 yyextra->parmName.clear();
1471<Body,FuncCall,BodyVar>"{" {
1472 yyextra->theVarContext.pushScope();
1473 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1474 yyextra->bracketCount = 0;
1477 if (yyextra->type.find(
"enum ")!=-1)
1479 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1485 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1489 if (yyextra->searchingForBody)
1491 yyextra->searchingForBody=
FALSE;
1492 yyextra->insideBody=
TRUE;
1494 yyextra->code->codify(yytext);
1495 if (yyextra->insideBody)
1497 yyextra->bodyCurlyCount++;
1499 yyextra->type.clear();
1500 yyextra->name.clear();
1503<ObjCCall,ObjCMName>"["|"{" {
1505 yyextra->currentCtx->format+=*yytext;
1509<ObjCCall,ObjCMName>"]"|"}" {
1510 yyextra->currentCtx->format+=*yytext;
1513 if (yyextra->currentCtx==
nullptr)
1517 auto it = yyextra->contextMap.find(0);
1518 if (it!=yyextra->contextMap.end())
1520 ctx = it->second.get();
1527<ObjCCall,ObjCMName>{CPPC}.* {
1528 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1530<ObjCCall,ObjCMName>{CCS} {
1531 yyextra->lastObjCCallContext = YY_START;
1532 yyextra->currentCtx->comment.str(yytext);
1533 BEGIN(ObjCCallComment);
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);
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)
1549 yyextra->currentCtx->objectTypeOrName=yytext;
1550 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1554<ObjCMName>{ID}/{BN}*"]" {
1555 if (yyextra->braceCount==0 &&
1556 yyextra->currentCtx->methodName.isEmpty())
1558 yyextra->currentCtx->methodName=yytext;
1559 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1563 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1566<ObjCMName>{ID}/{BN}*":" {
1567 if (yyextra->braceCount==0)
1569 yyextra->currentCtx->methodName+=yytext;
1570 yyextra->currentCtx->methodName+=
":";
1572 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1574<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1575<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1576<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1577 BEGIN(yyextra->lastStringContext);
1579<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1580<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1581 yyextra->lastStringContext=YY_START;
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>"@"/"\"" {
1588 yyextra->currentCtx->format+=yytext;
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; }
1595 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1596 yyextra->code->codify(yytext);
1598 yyextra->name = yyextra->saveName;
1599 yyextra->type = yyextra->saveType;
1602 yyextra->code->codify(yytext);
1604<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1605 yyextra->code->codify(yytext);
1607<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1612 yyextra->code->codify(yytext);
1615<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1617 yyextra->parmName=yytext;
1619 yyextra->code->codify(yytext);
1622<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1623 if (yyextra->lang!=SrcLangExt::Slice)
1630 yyextra->parmName=yytext;
1632 yyextra->code->codify(yytext);
1636<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1638 yyextra->parmName=yytext;
1640 yyextra->code->codify(yytext);
1643<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1646 yyextra->parmName=yytext;
1648 yyextra->code->codify(yytext);
1651<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1657 yyextra->parmName=yytext;
1661 yyextra->code->codify(yytext);
1662 yyextra->inForEachExpression =
FALSE;
1665<MemberCall2,FuncCall>, {
1666 yyextra->code->codify(yytext);
1667 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1668 yyextra->parmType.clear();yyextra->parmName.clear();
1670<MemberCall2,FuncCall>"{" {
1671 if (yyextra->bracketCount>0)
1673 yyextra->code->codify(yytext);
1674 yyextra->skipInlineInitContext=YY_START;
1675 yyextra->curlyCount=0;
1683<InlineInit>"{" { yyextra->curlyCount++;
1684 yyextra->code->codify(yytext);
1687 yyextra->code->codify(yytext);
1688 if (--yyextra->curlyCount<=0)
1690 BEGIN(yyextra->skipInlineInitContext);
1697 yyextra->code->codify(yytext);
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)
1706 yyextra->theVarContext.pushScope();
1709<MemberCall2,FuncCall>{OPERATOR} {
1716 yyextra->parmType.clear();yyextra->parmName.clear();
1718 yyextra->code->codify(yytext);
1720<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1723 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1724 if (yyextra->parmType.isEmpty())
1726 yyextra->parmType=yyextra->parmName;
1727 yyextra->parmName.clear();
1729 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1733 yyextra->parmType = yyextra->parmName;
1734 yyextra->parmName.clear();
1735 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1737 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1738 yyextra->inForEachExpression =
FALSE;
1740 yyextra->code->codify(yytext);
1741 if (--yyextra->bracketCount<=0)
1743 if (yyextra->name.isEmpty())
1753<MemberCall,MemberCall2,FuncCall>[;:] {
1755 if (yyextra->bracketCount<=0)
1762 yyextra->code->codify(yytext);
1765<CallEnd>[ \t\n]* {
codifyLines(yyscanner,yytext); }
1768 yyextra->bracketCount=0;
1769 if (*yytext==
';') yyextra->searchingForBody=
FALSE;
1770 if (!yyextra->type.isEmpty())
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);
1775 yyextra->parmType.clear();yyextra->parmName.clear();
1777 if (*yytext==
';' || yyextra->insideBody)
1779 if (!yyextra->insideBody)
1781 yyextra->theVarContext.popScope();
1783 yyextra->name.clear();yyextra->type.clear();
1788 yyextra->bracketCount=0;
1792<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1797<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1798 if (yyextra->insideBody)
1800 yyextra->theVarContext.pushScope();
1802 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1804 yyextra->parmType.clear();yyextra->parmName.clear();
1805 int index = yyextra->name.findRev(
"::");
1806 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1810 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1816 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1822 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1827 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1830 yytext[yyleng-1]=
'\0';
1832 if (!cv.stripWhiteSpace().isEmpty())
1842 yyextra->code->codify(
"{");
1843 if (yyextra->searchingForBody)
1845 yyextra->searchingForBody=
FALSE;
1846 yyextra->insideBody=
TRUE;
1848 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1849 yyextra->type.clear(); yyextra->name.clear();
static NamespaceDefMutable * globalScope
QCString & prepend(const char *s)
1854 yyextra->code->codify(yytext);
1856 yyextra->inFunctionTryBlock=
TRUE;
1858<CallEnd>"requires" {
1860 yyextra->code->codify(yytext);
1864 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1870 yyextra->parmName=yytext;
1872 BEGIN(OldStyleArgs);
1876 yyextra->parmName=yytext;
1880 yyextra->code->codify(yytext);
1881 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1882 if (*yytext==
';') yyextra->parmType.clear();
1883 yyextra->parmName.clear();
1885<CallEnd,OldStyleArgs>"#" {
1887 yyextra->lastSkipCppContext = Body;
1888 yyextra->code->codify(yytext);
1893 if (!yyextra->insideBody)
1895 yyextra->theVarContext.popScope();
1897 yyextra->name.clear();yyextra->args.clear();
1898 yyextra->parmType.clear();yyextra->parmName.clear();
1902 yyextra->code->codify(yytext);
1903 yyextra->type.clear(); yyextra->name.clear();
1907 yyextra->code->codify(yytext);
1908 if (yyextra->searchingForBody)
1910 yyextra->searchingForBody=
FALSE;
1911 yyextra->insideBody=
TRUE;
1913 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1914 if (yyextra->name.find(
"::")!=-1)
1916 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1922 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1925 yyextra->type.clear(); yyextra->name.clear();
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));
1942<FuncCall>{ID}/("."|"->") {
1943 yyextra->name=yytext;
1945 BEGIN( MemberCall2 );
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 );
1954<MemberCall2>{ID}/([ \t\n]*"(") {
1955 if (!yyextra->args.isEmpty())
1959 yyextra->args.clear();
1962<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1964 yyextra->name=yytext;
1966 BEGIN( MemberCall2 );
1968<MemberCall2>"->"|"." {
1973 yyextra->code->codify(yytext);
1974 yyextra->memCallContext = YY_START;
1975 BEGIN( MemberCall );
1977<SkipComment>{CCS}("!"?){CCE} {
1978 yyextra->code->codify(yytext);
1980 BEGIN( yyextra->lastCContext ) ;
1982<SkipComment>{CPPC}|{CCS} {
1983 yyextra->code->codify(yytext);
1985<SkipComment>[^*\/\n]+ {
1986 yyextra->code->codify(yytext);
1988<SkipComment>[ \t]*{CCE} {
1989 yyextra->code->codify(yytext);
1991 if (yyextra->lastCContext==SkipCPP)
1995 BEGIN( yyextra->lastCContext ) ;
1997<SkipCxxComment>[^\r\n]*"\\"[\r]?\n {
2000<SkipCxxComment>[^\r\n]+ {
2001 yyextra->code->codify(yytext);
2007 BEGIN( yyextra->lastCContext ) ;
2010 yyextra->code->codify(yytext);
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);
2018<*>\n({B}*{CPPC}[!/][^\n]*\n)+ {
2019 if (YY_START==SkipCPP) REJECT;
2024 if (YY_START==SkipCxxComment)
2026 BEGIN( yyextra->lastCContext ) ;
2031 BEGIN( yyextra->lastSkipCppContext ) ;
2034<*>\n{B}*{CPPC}"@"[{}].*\n {
2039 if (YY_START==SkipCxxComment)
2041 BEGIN( yyextra->lastCContext ) ;
2044<*>\n{B}*{CCS}"@"[{}] {
2046 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2048 yyextra->lastCContext = YY_START ;
2054<*>^{B}*{CPPC}"@"[{}].*\n {
2060<*>^{B}*{CCS}"@"[{}] {
2062 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2064 yyextra->lastCContext = YY_START ;
2067 yyextra->code->codify(yytext);
2070<*>^{B}*{CPPC}[!/][^\n]* {
2075<*>{CPPC}[!/][^\n]* {
2076 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2081<*>\n{B}*{CCS}[!*]/{NCOMM} {
2083 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2085 yyextra->lastCContext = YY_START ;
2091<*>^{B}*{CCS}"*"[*]+/[^/] {
2093 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2095 yyextra->lastCContext = YY_START ;
2099 yyextra->code->codify(yytext);
#define Config_getBool(name)
2102<*>^{B}*{CCS}[!*]/{NCOMM} {
2104 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2106 yyextra->lastCContext = YY_START ;
2109 yyextra->code->codify(yytext);
2112<*>{CCS}[!*]/{NCOMM} {
2113 if (YY_START==SkipString) REJECT;
2115 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2117 yyextra->lastCContext = YY_START ;
2120 yyextra->code->codify(yytext);
2123<*>{CCS}("!"?){CCE} {
2124 if (YY_START==SkipString) REJECT;
2127 yyextra->code->codify(yytext);
2130<SkipComment>[^\*\n]+ {
2131 yyextra->code->codify(yytext);
2135 yyextra->code->codify(yytext);
2137 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2139 yyextra->lastCContext = YY_START ;
2141 BEGIN( SkipComment ) ;
2145 yyextra->code->codify(yytext);
2146 yyextra->lastVerbStringContext=YY_START;
2147 BEGIN(SkipVerbString);
2151 yyextra->code->codify(yytext);
2152 yyextra->lastCContext = YY_START ;
2153 BEGIN( SkipCxxComment ) ;
2156 if (yytext[0]==
'(') yyextra->bracketCount++;
2157 yyextra->code->codify(yytext);
2158 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2161 if (yytext[0]==
')') yyextra->bracketCount--;
2162 yyextra->code->codify(yytext);
2163 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2169 yyextra->code->codify(yytext);
2172 yyextra->code->codify(yytext);
2189 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2197 DBG_CTX((stderr,
"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n",
2198 qPrint(ltype),
qPrint(lname),yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>"));
2199 auto it = yyextra->codeClassMap.find(ltype.
str());
2200 if (it!=yyextra->codeClassMap.end())
2203 yyextra->theVarContext.addVariable(lname,std::move(it->second));
2207 auto findVariableType = [&yyscanner,&yyg,<ype,&lname,&name](
const Definition *d) ->
const ClassDef *
2209 const ClassDef *varDef = yyextra->symbolResolver.resolveClass(d,ltype,
true);
2216 else if ((i=ltype.find(
'<'))!=-1)
2223 const ClassDef *varDef = findVariableType(yyextra->currentDefinition);
2224 if (varDef==
nullptr)
2226 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2228 varDef = findVariableType(namespaceDef);
2232 if (varDef==
nullptr)
2234 if (!yyextra->theVarContext.atGlobalScope())
2238 DBG_CTX((stderr,
"** addVariable: dummy context for '%s'\n",
qPrint(lname)));
2243 DBG_CTX((stderr,
"** addVariable: not adding variable!\n"));
2254 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2255 yyextra->scopeNameLengthStack.push_back(
int(yyextra->scopeName.length()));
2256 if (yyextra->scopeName.isEmpty() ||
leftScopeMatch(s,yyextra->scopeName))
2258 yyextra->scopeName = s;
2262 yyextra->scopeName +=
"::";
2263 yyextra->scopeName += s;
2272 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2273 if (!yyextra->scopeNameLengthStack.empty())
2275 int length = yyextra->scopeNameLengthStack.back();
2276 yyextra->scopeNameLengthStack.pop_back();
2277 yyextra->scopeName.resize(length);
2283 DBG_CTX((stderr,
"popScope() result: '%s'\n",
qPrint(yyextra->scopeName)));
2288 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2291 if (yyextra->searchCtx)
2318 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2324 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
2325 if (ts!=-1 && te!=-1 && te>ts)
2330 while (!yyextra->scopeNameLengthStack.empty())
2334 yyextra->scopeName.clear();
2336 while ((i=n.
find(
"::"))!=-1)
2342 DBG_CTX((stderr,
"--->New class scope '%s'\n",
qPrint(yyextra->scopeName)));
2347 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2348 while (!yyextra->foldStack.empty())
2350 const Definition *dd = yyextra->foldStack.back();
2353 yyextra->code->endFold();
2355 yyextra->foldStack.pop_back();
2370 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2379 if (endLine!=-1 && startLine!=endLine &&
2387 (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
2395 yyextra->code->startFold(yyextra->yyLineNr,
"",
"");
2399 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2403 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2408 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2412 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2414 yyextra->foldStack.push_back(d);
2426 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2428 if (yyextra->sourceFileDef && yyextra->lineNumbers)
2434 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
2436 DBG_CTX((stderr,
"%s:startCodeLine(%d)=%p\n",
qPrint(yyextra->sourceFileDef->name()),yyextra->yyLineNr,(
void*)d));
2437 if (!yyextra->includeCodeFragment && d)
2439 yyextra->currentDefinition = d;
2440 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
2441 yyextra->insideBody =
FALSE;
2442 yyextra->searchingForBody =
TRUE;
2444 yyextra->type.
clear();
2445 yyextra->name.clear();
2446 yyextra->args.clear();
2447 yyextra->parmType.clear();
2448 yyextra->parmName.clear();
2449 DBG_CTX((stderr,
"Real scope: '%s'\n",
qPrint(yyextra->realScope)));
2450 yyextra->bodyCurlyCount = 0;
2452 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
2453 if (yyextra->currentMemberDef)
2456 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
2457 yyextra->currentMemberDef->getOutputFileBase(),
2458 yyextra->currentMemberDef->anchor(),
2459 yyextra->yyLineNr,!yyextra->includeCodeFragment);
2467 QCString(),yyextra->yyLineNr,!yyextra->includeCodeFragment);
2479 !yyextra->includeCodeFragment);
2482 DBG_CTX((stderr,
"startCodeLine(%d)\n",yyextra->yyLineNr));
2483 yyextra->code->startCodeLine(yyextra->yyLineNr);
2484 yyextra->insideCodeLine =
true;
2485 if (yyextra->currentFontClass)
2487 yyextra->code->startFontClass(
QCString(yyextra->currentFontClass));
2495 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2496 DBG_CTX((stderr,
"endCodeLine(%d)\n",yyextra->yyLineNr));
2498 yyextra->code->endCodeLine();
2499 yyextra->insideCodeLine =
false;
2504 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2505 const char * fc = yyextra->currentFontClass;
2506 if (yyextra->insideCodeLine)
2510 if (yyextra->yyLineNr<yyextra->inputLines)
2512 yyextra->currentFontClass = fc;
2522 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2523 DBG_CTX((stderr,
"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,
qPrint(text)));
2525 const char *p=text.
data(),*sp=p;
2531 while ((c=*p++) && c!=
'\n');
2534 yyextra->yyLineNr++;
2535 size_t l =
static_cast<size_t>(p-sp-1);
2536 std::string tmp(sp,l);
2537 yyextra->code->codify(tmp.c_str());
2542 yyextra->code->codify(
QCString(sp));
2556 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2557 if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
2575 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2577 yyextra->tooltipManager.addTooltip(d);
2582 if (!sourceTooltips)
2587 const char *p=text.
data();
2592 while ((c=*p++) && c!=
'\n') { }
2595 yyextra->yyLineNr++;
2611 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2612 if (yyextra->name==
"const") { yyextra->name.clear();
return; }
2613 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2614 yyextra->type += yyextra->name ;
2615 yyextra->name.clear() ;
2616 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2617 yyextra->type += yyextra->args ;
2618 yyextra->args.clear() ;
2623 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2624 if (yyextra->parmName==
"const") { yyextra->parmName.clear();
return; }
2625 if (!yyextra->parmType.isEmpty()) yyextra->parmType +=
' ' ;
2626 yyextra->parmType += yyextra->parmName ;
2627 yyextra->parmName.clear() ;
2633 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2634 if (yyextra->sourceFileDef && !name.
isEmpty())
2639 yyextra->theUsingContext.emplace(name.
str(),nd);
2646 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2649 yyextra->parmName = a.name;
2650 yyextra->parmType = a.type;
2651 int i = yyextra->parmType.find(
'*');
2652 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2653 i = yyextra->parmType.find(
'&');
2654 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2655 yyextra->parmType.stripPrefix(
"const ");
2656 yyextra->parmType=yyextra->parmType.stripWhiteSpace();
2657 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
2663 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2664 DBG_CTX((stderr,
"stripClassName(scope=%s,type=%s) scopeName=%s\n",
2672 QCString clName=className+templSpec;
2674 if (!yyextra->scopeName.isEmpty())
2676 cd=yyextra->symbolResolver.resolveClass(d,yyextra->scopeName+
"::"+clName,
true);
2680 cd=yyextra->symbolResolver.resolveClass(d,clName,
true);
2682 DBG_CTX((stderr,
"stripClass trying '%s' = %p\n",
qPrint(clName),(
void*)cd));
2694 if (name.
isEmpty())
return nullptr;
2695 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2696 DBG_CTX((stderr,
"setCallContextForVar(%s) yyextra->scopeName=%s\n",
qPrint(name),
qPrint(yyextra->scopeName)));
2698 int scopeEnd = name.
findRev(
"::");
2705 if (mcd && !locName.
isEmpty())
2718 if (mnd && !locName.
isEmpty())
2734 DBG_CTX((stderr,
"local variable?\n"));
2738 yyextra->theCallContext.setScope(*mcv);
2743 DBG_CTX((stderr,
"class member? scope=%s\n",
qPrint(yyextra->scopeName)));
2753 if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=
CLASSBLOCK)
2770 const std::unique_ptr<MemberDef> &md=mn->
front();
2771 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2778 else if (mn->
size()>1)
2780 for (
const auto &md : *mn)
2789 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2792 DBG_CTX((stderr,
"returning member %s in source file %s\n",
qPrint(md->name()),
qPrint(yyextra->sourceFileDef->name())));
2804 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2805 const Definition *d = yyextra->theCallContext.getScope().globalDef();
2828 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2829 DBG_CTX((stderr,
"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",
qPrint(c),
qPrint(m),varOnly));
2834 DBG_CTX((stderr,
"scopeNameLengthStack.size()=%zu\n",yyextra->scopeNameLengthStack.size()));
2835 if (!result.
found && !yyextra->scopeNameLengthStack.empty() && c==yyextra->scopeName)
2837 QCString localName = yyextra->scopeName.
mid(yyextra->scopeNameLengthStack[0]+2);
2838 auto it = yyextra->codeClassMap.
find(localName.
str());
2839 if (it!=yyextra->codeClassMap.end())
2846 DBG_CTX((stderr,
"trying lookup via base class %s\n",
qPrint(bcName)));
2849 if (result.
found)
break;
2859 if (yyextra->exampleBlock)
2863 anchor.
sprintf(
"a%d",yyextra->anchorCount);
2865 qPrint(yyextra->exampleFile)));
2867 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
2870 yyextra->anchorCount++;
2884 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n",
2885 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,yyextra->insideBody));
2887 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
2888 yyextra->insideBody && yyextra->collectXRefs)
2910 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2911 DBG_CTX((stderr,
"getLink(%s,%s) yyextra->curClassName=%s\n",
2917 if (!yyextra->curClassName.isEmpty())
2920 c.
prepend(yyextra->curClassName);
2934 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2936 if (!scopeName.
isEmpty() && scopeName[0]==
'~')
2938 scopeName=scopeName.
mid(1);
2942 yyextra->code->codify(
"~");
2945 if (yyextra->insideProtocolList)
2949 if (yyextra->lang==SrcLangExt::PHP)
2953 else if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
2957 if (yyextra->currentDefinition==
nullptr && !yyextra->scopeName.isEmpty())
2959 scopeName = yyextra->scopeName+
"::"+scopeName;
2965 DBG_CTX((stderr,
"generateClassOrGlobalLink(name=%s) yyextra->scopeName=%s scopeName=%s\n",
qPrint(scName),
qPrint(yyextra->scopeName),
qPrint(scopeName)));
2966 if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(scopeName))==
nullptr)
2968 int i=scopeName.
find(
'<');
2970 if (i!=-1) bareName = bareName.
left(i);
2972 auto checkForSymbol = [&yyg,&bareName,&scopeName](
const Definition *
parent,
2975 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,scopeName,
QCString(),
false,
true);
2976 DBG_CTX((stderr,
"non-local variable name=%s sym=%s!\n",
2977 qPrint(scopeName),sym_?
qPrint(sym_->name()):
"<none>"));
2978 if (sym_==
nullptr && !bareName.
isEmpty())
2981 if (bareName!=scopeName)
2983 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,bareName,
QCString(),
false,
true);
2987 const Definition *d = yyextra->currentDefinition;
2988 DBG_CTX((stderr,
"d=%s yyextra->sourceFileDef=%s\n",d?
qPrint(d->
name()):
"<none>",yyextra->sourceFileDef?
qPrint(yyextra->sourceFileDef->name()):
"<none>"));
2989 checkForSymbol(d,sym);
2998 checkForSymbol(nd,sym);
3006 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
3008 checkForSymbol(namespaceDef,sym);
3030 DBG_CTX((stderr,
"is found as a type sym=%s nd=%s\n",
3035 if (
getLink(yyscanner,yyextra->scopeName,scName,ol,scName,varOnly))
3043 DBG_CTX((stderr,
"local variable!\n"));
3047 yyextra->theCallContext.setScope(*lcd);
3058 DBG_CTX((stderr,
"is a local variable sym=%p!\n",(
void*)sym));
3060 yyextra->isPrefixedWithThis =
FALSE;
3065 if (yyextra->exampleBlock)
3069 anchor.
sprintf(
"_a%d",yyextra->anchorCount);
3070 DBG_CTX((stderr,
"addExampleClass(%s,%s,%s)\n",
qPrint(anchor),
qPrint(yyextra->exampleName),
3071 qPrint(yyextra->exampleFile)));
3075 if (cdm && cdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3078 yyextra->anchorCount++;
3084 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3087 yyextra->anchorCount++;
3101 yyextra->currentMemberDef && yyextra->collectXRefs)
3110 DBG_CTX((stderr,
"class %s not linkable! cd=%p typeOnly=%d\n",
qPrint(scName),(
void*)sym,typeOnly));
3111 if (!isLocal && (md || (!sym && !typeOnly)))
3116 DBG_CTX((stderr,
"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%s\n",
qPrint(scName),(
void*)md,yyextra->currentDefinition ?
qPrint(yyextra->currentDefinition->name()) :
"<none>"));
3117 if (md && yyextra->currentDefinition)
3119 DBG_CTX((stderr,
"%s accessible from %s? %d md->getOuterScope=%s\n",
3120 qPrint(md->name()),
qPrint(yyextra->currentDefinition->name()),
3121 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md),
3122 qPrint(md->getOuterScope()->name())));
3125 if (md && yyextra->currentDefinition &&
3126 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md)==-1)
3133 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()));
3134 if (md->isLinkable())
3138 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3148 DBG_CTX((stderr,
"not found!\n"));
3155 bool typeOnly,
bool varOnly)
3165 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3169 DBG_CTX((stderr,
"type='%s' args='%s' class=%s\n",
3173 if (yyextra->exampleBlock)
3177 anchor.
sprintf(
"a%d",yyextra->anchorCount);
3179 qPrint(yyextra->exampleFile)));
3181 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3184 yyextra->anchorCount++;
3198 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",
3199 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,(
void*)xmd,yyextra->insideBody));
3201 if (xmd->templateMaster()) xmd = xmd->templateMaster();
3203 if (xmd->isLinkable())
3206 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
3207 yyextra->insideBody && yyextra->collectXRefs)
3227 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3232 DBG_CTX((stderr,
"generateClassMemberLink(class=%s,member=%s)=%p\n",
qPrint(def->
name()),
qPrint(memName),(
void*)xmd));
3270 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3271 DBG_CTX((stderr,
"generateMemberLink(object=%s,mem=%s) classScope=%s\n",
3274 if (varName.
isEmpty())
return;
3282 DBG_CTX((stderr,
"Class found!\n"));
3285 DBG_CTX((stderr,
"Found result!\n"));
3292 if (
getLink(yyscanner,bcName,memName,ol))
3294 DBG_CTX((stderr,
"Found result!\n"));
3303 const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->scopeName,
true);
3306 DBG_CTX((stderr,
"Found class %s for variable '%s'\n",
qPrint(yyextra->scopeName),
qPrint(varName)));
3320 for (
const auto &vmd : *vmn)
3322 if (vmd->getClassDef()==jcd)
3324 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3337 DBG_CTX((stderr,
"There is a variable with name '%s'\n",
qPrint(varName)));
3338 for (
const auto &vmd : *vmn)
3340 if (vmd->getClassDef()==vcd)
3342 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3361 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3364 DBG_CTX((stderr,
"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,
qPrint(name),
qPrint(yyextra->scopeName)));
3373 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3375 QCString locScope=yyextra->scopeName;
3377 if (yyextra->lang==SrcLangExt::PHP && locFunc.
startsWith(
"self::")) locFunc=locFunc.
mid(4);
3380 QCString funcWithFullScope=locFunc;
3385 if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() &&
3386 funcName==yyextra->currentMemberDef->localName() &&
3387 yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr &&
3399 if (i==-1) i=locFunc.
findRev(
"."),len=1;
3400 if (i==-1) i=locFunc.
findRev(
"\\"),len=1;
3403 funcScope=locFunc.
left(i);
3405 int ts=locScope.
find(
'<');
3407 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3408 if (ts!=-1 && te!=-1 && te>ts)
3413 ts=funcScope.
find(
'<');
3415 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3416 if (ts!=-1 && te!=-1 && te>ts)
3419 funcScope=funcScope.
left(ts)+funcScope.
right(funcScope.
length()-te-1);
3423 funcWithScope = funcScope+
"::"+locFunc;
3426 fullScope=locScope+
"::"+funcScope;
3431 funcWithFullScope = locScope+
"::"+funcWithScope;
3437 auto it = yyextra->codeClassMap.find(fullScope.
str());
3438 if (it!=yyextra->codeClassMap.end())
3445 if (
getLink(yyscanner,bcName,locFunc,ol,funcName))
3454 if (!locScope.
isEmpty() && fullScope!=locScope)
3456 auto it = yyextra->codeClassMap.find(locScope.
str());
3457 if (it!=yyextra->codeClassMap.end())
3464 if (
getLink(yyscanner,bcName,funcWithScope,ol,funcName))
3472 if (!
getLink(yyscanner,locScope,funcWithScope,ol,funcName))
3488 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3489 const char *p=yyextra->inputString;
3495 if (c==
'\n') count++;
3497 if (p>yyextra->inputString && *(p-1)!=
'\n')
3506 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3507 if (yyextra->currentFontClass)
3509 yyextra->code->endFontClass();
3510 yyextra->currentFontClass=
nullptr;
3512 if (specialComment && yyextra->insideSpecialComment)
3514 yyextra->code->endSpecialComment();
3515 yyextra->insideSpecialComment =
false;
3521 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3525 yyextra->code->startSpecialComment();
3526 yyextra->insideSpecialComment =
true;
3528 yyextra->code->startFontClass(
QCString(s));
3529 yyextra->currentFontClass=s;
3537 if (ctx==
nullptr)
return;
3538 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3542 DBG_CTX((stderr,
"writeObjCMethodCall(%s) obj=%s method=%s\n",
3551 DBG_CTX((stderr,
" object is local variable\n"));
3559 DBG_CTX((stderr,
" class=%p method=%p\n",(
void*)cd,(
void*)ctx->
method));
3570 char skipChar =
' ';
3595 yyextra->code->codify(
"$");
3603 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3605 int refId=refIdStr.
toInt();
3606 auto it = yyextra->nameMap.find(refId);
3607 if (it!=yyextra->nameMap.end())
3613 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3625 DBG_CTX((stderr,
"Invalid name: id=%d\n",refId));
3632 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3634 int refId=refIdStr.
toInt();
3635 auto it = yyextra->objectMap.find(refId);
3636 if (it!=yyextra->objectMap.end())
3641 if (yyextra->currentDefinition &&
3658 else if (
object==
"super")
3660 if (yyextra->currentDefinition &&
3687 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3700 int dotPos=
object.find(
'.',pp);
3701 int len =
static_cast<int>(
object.length());
3702 if (dotPos==-1) dotPos=len;
3703 const Definition *scope = yyextra->currentDefinition;
3710 if (fragmentStripped==
"self")
3723 const Definition *symbol = yyextra->symbolResolver.resolveSymbol(scope,fragmentStripped,
QCString(),
false,
true);
3729 ctx->
method = yyextra->symbolResolver.getTypedef();
3753 dotPos=
object.find(
'.',pp);
3754 if (dotPos==-1) dotPos=len;
3763 else if (ctx->
method==
nullptr)
3766 DBG_CTX((stderr,
"yyextra->currentDefinition=%p\n",(
void*)yyextra->currentDefinition));
3767 if (yyextra->currentDefinition &&
3788 DBG_CTX((stderr,
"Invalid object: id=%d\n",refId));
3795 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3797 int refId=refIdStr.
toInt();
3798 auto it = yyextra->contextMap.find(refId);
3799 if (it!=yyextra->contextMap.end())
3814 if (mn && mn->
size()==1)
3832 DBG_CTX((stderr,
"Invalid context: id=%d\n",refId));
3839 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3841 int refId=refIdStr.
toInt();
3842 auto it = yyextra->wordMap.find(refId);
3843 if (it!=yyextra->wordMap.end())
3846 bool isKeyword = word==
"self";
3862 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3864 int refId=refIdStr.
toInt();
3865 auto it = yyextra->commentMap.find(refId);
3866 if (it!=yyextra->commentMap.end())
3880 else if (c==
'\'' || c ==
'"')
3897 DBG_CTX((stderr,
"}=(type='%s',name='%s')",
3907 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3909 result.
sprintf(
"$n%d",yyextra->currentNameId);
3910 yyextra->nameMap.emplace(yyextra->currentNameId,s);
3911 yyextra->currentNameId++;
3917 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3919 result.
sprintf(
"$o%d",yyextra->currentObjId);
3920 yyextra->objectMap.emplace(yyextra->currentObjId,s);
3921 yyextra->currentObjId++;
3927 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3929 result.
sprintf(
"$w%d",yyextra->currentWordId);
3930 yyextra->wordMap.emplace(yyextra->currentWordId,s);
3931 yyextra->currentWordId++;
3937 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3939 result.
sprintf(
"$d%d",yyextra->currentCommentId);
3940 yyextra->commentMap.emplace(yyextra->currentCommentId,s);
3941 yyextra->currentCommentId++;
3947 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3948 static const std::unordered_set<std::string> non_cpp_keywords = {
3949 "__assume",
"__super",
"abstract",
"function",
3950 "gcnew",
"gcroot",
"generic",
"get",
3951 "internal",
"null",
"pin_ptr",
"raise",
3952 "remove",
"self",
"set",
"transient",
3955 static const std::unordered_set<std::string> non_java_keywords = {
3956 "alignas",
"alignof",
"and",
"and_eq",
"asm",
3957 "atomic_cancel",
"atomic_commit",
"atomic_noexcept",
"auto",
"bitand",
3958 "bitor",
"bool",
"char8_t",
"char16_t",
"char32_t",
3959 "compl",
"concept",
"consteval",
"constexpr",
"constinit",
3960 "const_cast",
"co_await",
"co_return",
"co_yield",
"decltype",
3961 "delete",
"dynamic_cast",
"explicit",
"export",
"extern",
3962 "friend",
"inline",
"mutable",
"namespace",
"noexcept",
3963 "not",
"not_eq",
"nullptr",
"operator",
"or",
3964 "or_eq",
"reflexpr",
"register",
"reinterpret_cast",
"requires",
3965 "signed",
"sizeof",
"static_assert",
"_Static_assert",
"static_cast",
"struct",
3966 "template",
"thread_local",
"typedef",
"typeid",
"typename",
3967 "union",
"unsigned",
"using",
"virtual",
"wchar_t",
3968 "xor",
"xor_eq",
"override",
"sealed"
3970 bool retval =
false;
3971 switch (yyextra->lang)
3973 case SrcLangExt::Cpp:
3974 retval = (non_cpp_keywords.find(keyword) != non_cpp_keywords.end());
3976 case SrcLangExt::Java:
3977 retval = (non_java_keywords.find(keyword) != non_java_keywords.end());
3990 if (i==-1)
return FALSE;
3992 return kw==
"const_cast" || kw==
"static_cast" || kw==
"dynamic_cast" || kw==
"reinterpret_cast";
3997 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3998 yy_size_t inputPosition = yyextra->inputPosition;
3999 const char *s = yyextra->inputString + inputPosition;
4001 while( c < max_size && *s )
4006 yyextra->inputPosition += c;
4013 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4014 if (yyextra->currentCtx)
4016 yyextra->currentCtx->format+=
QCString().
sprintf(
"$c%d",yyextra->currentCtxId);
4017 if (yyextra->braceCount==0 && YY_START==ObjCCall)
4019 yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1);
4020 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
4022 yyextra->contextStack.push(yyextra->currentCtx);
4026 DBG_CTX((stderr,
"Trying to save NULL context!\n"));
4028 auto newCtx = std::make_unique<ObjCCallCtx>();
4029 newCtx->id = yyextra->currentCtxId;
4030 newCtx->lexState = YY_START;
4031 newCtx->braceCount = yyextra->braceCount;
4032 newCtx->objectType =
nullptr;
4033 newCtx->objectVar =
nullptr;
4034 newCtx->method =
nullptr;
4035 DBG_CTX((stderr,
"save state=%d\n",YY_START));
4036 yyextra->currentCtx = newCtx.get();
4037 yyextra->contextMap.emplace(yyextra->currentCtxId,std::move(newCtx));
4038 yyextra->braceCount = 0;
4039 yyextra->currentCtxId++;
4044 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4045 DBG_CTX((stderr,
"restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState));
4046 BEGIN(yyextra->currentCtx->lexState);
4047 yyextra->braceCount = yyextra->currentCtx->braceCount;
4048 if (!yyextra->contextStack.empty())
4050 yyextra->currentCtx = yyextra->contextStack.top();
4051 yyextra->contextStack.pop();
4055 yyextra->currentCtx =
nullptr;
4056 DBG_CTX((stderr,
"Trying to pop context while yyextra->contextStack is empty!\n"));
4068 codeYYlex_init_extra(&
p->state,&
p->yyscanner);
4077 codeYYlex_destroy(
p->yyscanner);
4082 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4083 DBG_CTX((stderr,
"***CodeParser::reset()\n"));
4084 yyextra->theVarContext.clear();
4085 while (!yyextra->scopeNameLengthStack.empty()) yyextra->scopeNameLengthStack.pop_back();
4086 yyextra->codeClassMap.clear();
4087 yyextra->curClassBases.clear();
4088 yyextra->anchorCount = 0;
4089 yyextra->insideCodeLine =
false;
4094 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4095 yyextra->insideCodeLine = inp;
4100 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4101 return yyextra->insideCodeLine;
4106 int startLine,
int endLine,
bool inlineFragment,
4111 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4112 DBG_CTX((stderr,
"***parseCode() exBlock=%d exName=%s fd=%p scopeName=%s searchCtx=%s\n",
4120 yyextra->code = &od;
4121 yyextra->inputString = s.
data();
4122 yyextra->fileName = fd ? fd->
fileName():
"";
4124 yyextra->inputPosition = 0;
4125 codeYYrestart(
nullptr,yyscanner);
4126 yyextra->currentFontClass =
nullptr;
4127 yyextra->searchCtx = searchCtx;
4128 yyextra->collectXRefs = collectXRefs;
4129 yyextra->inFunctionTryBlock =
FALSE;
4130 yyextra->symbolResolver.setFileScope(fd);
4131 yyextra->foldStack.clear();
4132 yyextra->insideSpecialComment =
false;
4135 yyextra->yyLineNr = startLine;
4137 yyextra->yyLineNr = 1;
4140 yyextra->inputLines = endLine+1;
4142 yyextra->inputLines = yyextra->yyLineNr +
countLines(yyscanner) - 1;
4144 yyextra->curlyCount = 0;
4145 yyextra->bodyCurlyCount = 0;
4146 yyextra->bracketCount = 0;
4147 yyextra->sharpCount = 0;
4148 yyextra->insideTemplate =
FALSE;
4149 yyextra->theCallContext.clear();
4150 while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
4151 yyextra->scopeName = scopeName;
4153 yyextra->exampleBlock = exBlock;
4154 yyextra->exampleName = exName;
4155 yyextra->sourceFileDef = fd;
4156 yyextra->lineNumbers = fd && showLineNumbers;
4161 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
4163 yyextra->lang = lang;
4164 yyextra->insideObjC = lang==SrcLangExt::ObjC;
4165 if (yyextra->sourceFileDef)
4170 yyextra->currentMemberDef =
nullptr;
4171 yyextra->searchingForBody = exBlock;
4172 yyextra->insideBody =
FALSE;
4173 yyextra->bracketCount = 0;
4174 if (!yyextra->exampleName.isEmpty())
4177 DBG_CTX((stderr,
"yyextra->exampleFile=%s\n",
qPrint(yyextra->exampleFile)));
4179 yyextra->includeCodeFragment = inlineFragment;
4180 DBG_CTX((stderr,
"** exBlock=%d exName=%s include=%d\n",exBlock,
qPrint(exName),inlineFragment));
4181 if (!yyextra->insideCodeLine)
4185 yyextra->type.clear();
4186 yyextra->name.clear();
4187 yyextra->args.clear();
4188 yyextra->parmName.clear();
4189 yyextra->parmType.clear();
4192 codeYYlex(yyscanner);
4193 yyextra->lexInit=
TRUE;
4194 if (yyextra->insideCodeLine)
4200 while (!yyextra->foldStack.empty())
4202 yyextra->code->endFold();
4203 yyextra->foldStack.pop_back();
4206 if (yyextra->exampleFileDef)
4209 yyextra->exampleFileDef.reset();
4210 yyextra->sourceFileDef=
nullptr;
4213 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)