13%option never-interactive
14%option prefix="codeYY"
16%option extra-type="struct codeYY_state *"
20#define YY_TYPEDEF_YY_SCANNER_T
34#include <unordered_map>
35#include <unordered_set>
71#define DBG_CTX(x) do { } while(0)
73#define YY_NO_UNISTD_H 1
177 std::unordered_map< int,std::unique_ptr<ObjCCallCtx> >
contextMap;
258#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
261static inline const char *
getLexerFILE() {
return __FILE__;}
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 void endCodeLine(yyscan_t yyscanner)
static bool skipLanguageSpecificKeyword(yyscan_t yyscanner, const char *kw)
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 QCString escapeComment(yyscan_t yyscanner, const QCString &s)
static void addParmType(yyscan_t yyscanner)
static QCString escapeObject(yyscan_t yyscanner, const QCString &s)
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 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 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 QCString escapeWord(yyscan_t yyscanner, const QCString &s)
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 QCString escapeName(yyscan_t yyscanner, const QCString &s)
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.
269ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
271SCOPENAME ("::"{BN}*)?({ID}{BN}*{SEP}{BN}*)*("~"{BN}*)?{ID}
272TEMPLIST "<"[^\"\}\{\(\)\/\n>]*">"
273SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID})
274SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+
275KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property")
277KEYWORD ("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"))
278FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally")
279FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try")
280TYPEKW ("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")
281TYPEKWSL ("LocalObject"|"Object"|"Value")
282CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast")
283CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'"))
284ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++"
285ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|="
286LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"|"<=>"
287BITOP "&"|"|"|"^"|"<<"|">>"|"~"
288OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
289RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
290RAWEND ")"[^ \t\(\)\\]{0,16}\"
291MODULE_ID ({ID}".")*{ID}
297DECIMAL_INTEGER [1-9][0-9']*[0-9]?[uU]?[lL]?[lL]?
298HEXADECIMAL_INTEGER "0"[xX][0-9a-zA-Z']+[0-9a-zA-Z]?
299OCTAL_INTEGER "0"[0-7][0-7']+[0-7]?
300BINARY_INTEGER "0"[bB][01][01']*[01]?
301INTEGER_NUMBER {DECIMAL_INTEGER}|{HEXADECIMAL_INTEGER}|{OCTAL_INTEGER}|{BINARY_INTEGER}
305DIGIT_SEQ [0-9][0-9']*[0-9]?
306FRAC_CONST {DIGIT_SEQ}"."|{DIGIT_SEQ}?"."{DIGIT_SEQ}
307FP_EXP [eE][+-]?{DIGIT_SEQ}
308DEC_FP1 {FRAC_CONST}{FP_EXP}?{FP_SUF}?
309DEC_FP2 {DIGIT_SEQ}{FP_EXP}{FP_SUF}
311HEX_DIGIT_SEQ [0-9a-fA-F][0-9a-fA-F']*[0-9a-fA-F]?
312HEX_FRAC_CONST {HEX_DIGIT_SEQ}"."|{HEX_DIGIT_SEQ}?"."{HEX_DIGIT_SEQ}
313BIN_EXP [pP][+-]?{DIGIT_SEQ}
314HEX_FP1 "0"[xX]{HEX_FRAC_CONST}{BIN_EXP}{FP_SUF}?
315HEX_FP2 "0"[xX]{HEX_DIGIT_SEQ}{BIN_EXP}{FP_SUF}?
317FLOAT_DECIMAL {DEC_FP1}|{DEC_FP2}
318FLOAT_HEXADECIMAL {HEX_FP1}|{HEX_FP2}
319FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL}
320NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
333ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"sealed"|"override"))*
354%x CppCliTypeModifierFollowup
379<Body>^([ \t]*"#"[ \t]*("include"|"import")[ \t]*)("<"|"\"") {
381 yyextra->code->codify(yytext);
382 BEGIN( ReadInclude );
384<Body>("@interface"|"@implementation"|"@protocol")[ \t\n]+ {
385 yyextra->insideObjC=
TRUE;
389 if (!yyextra->insideTemplate)
392<Body>(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") {
393 if (yyextra->insideTemplate) REJECT;
399<Body>"property"|"event"/{BN}* {
400 if (yyextra->insideTemplate) REJECT;
405<Body>("partial"{B}+)?("class"|"struct"|"union"|"namespace"|"interface"){B}+ {
409 if (!yyextra->insideTemplate)
412<Body>("package")[ \t\n]+ {
416 BEGIN( PackageName );
419 if (!yyextra->insideObjC) REJECT;
423<Body,ClassVar,Bases>"-"|"+" {
424 if (!yyextra->insideObjC || yyextra->insideBody)
426 yyextra->code->codify(yytext);
430 DBG_CTX((stderr,
"Start of Objective-C method!\n"));
431 yyextra->code->codify(yytext);
436 yyextra->code->codify(yytext);
440 yyextra->code->codify(yytext);
441 BEGIN(ObjCParamType);
443<ObjCParams,ObjCMethod>";"|"{" {
444 yyextra->code->codify(yytext);
447 if (yyextra->searchingForBody)
449 yyextra->searchingForBody=
FALSE;
450 yyextra->insideBody=
TRUE;
452 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
453 if (!yyextra->curClassName.isEmpty())
455 pushScope(yyscanner,yyextra->curClassName);
456 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
460 yyextra->type.clear();
461 yyextra->name.clear();
464<ObjCParams>{ID}{B}*":" {
465 yyextra->code->codify(yytext);
467<ObjCParamType>{TYPEKW} {
469 yyextra->code->codify(yytext);
471 yyextra->parmType=yytext;
475 yyextra->parmType=yytext;
478 yyextra->code->codify(yytext);
482 yyextra->code->codify(yytext);
483 yyextra->parmName=yytext;
484 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
485 yyextra->parmType.clear();yyextra->parmName.clear();
487<ObjCMethod,ObjCParams,ObjCParamType>{ID} {
490<ObjCMethod,ObjCParams,ObjCParamType>. {
491 yyextra->code->codify(yytext);
493<ObjCMethod,ObjCParams,ObjCParamType>\n {
496<ReadInclude>[^\n\">]+/(">"|"\"") {
507 DBG_CTX((stderr,
"===== yes %s is ambiguous\n",yytext));
509 if (!name.isEmpty() && yyextra->sourceFileDef)
515 auto it = std::find_if(fn->begin(),
517 [&sfd=yyextra->sourceFileDef]
519 { return sfd->isIncluded(lfd->absFilePath()); });
520 found = it!=fn->end();
536 yyextra->code->codify(yytext);
538 char c=(char)yyinput(yyscanner);
541 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)
545<Body,Bases>^[ \t]*"#" {
547 yyextra->lastSkipCppContext = YY_START;
548 yyextra->code->codify(yytext);
552 yyextra->code->codify(yytext);
553 yyextra->lastStringContext=YY_START;
554 BEGIN( SkipString ) ;
557 yyextra->code->codify(yytext);
559<SkipCPP>[^\n\/\\\"]+ {
560 yyextra->code->codify(yytext);
565<SkipCPP>{CPPC}/[^/!] {
568<Body,FuncCall,MemberCall,MemberCall2>"}" {
569 yyextra->theVarContext.popScope();
570 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
571 yyextra->type.clear();
572 yyextra->name.clear();
574 if (!yyextra->scopeStack.empty())
576 int scope = yyextra->scopeStack.top();
577 yyextra->scopeStack.pop();
585 yyextra->code->codify(yytext);
587 DBG_CTX((stderr,
"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount));
588 if (--yyextra->bodyCurlyCount<=0)
590 yyextra->insideBody=
FALSE;
591 yyextra->currentMemberDef=
nullptr;
592 if (yyextra->currentDefinition)
593 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
597<Body,ClassVar>"@end" {
598 DBG_CTX((stderr,
"End of objc scope fd=%s\n",
qPrint(yyextra->sourceFileDef->name())));
599 if (yyextra->sourceFileDef)
601 const FileDef *fd=yyextra->sourceFileDef;
604 DBG_CTX((stderr,
"insideObjC=%d\n",yyextra->insideObjC));
608 yyextra->insideObjC =
FALSE;
610 if (yyextra->insideBody)
612 yyextra->theVarContext.popScope();
614 if (!yyextra->scopeStack.empty())
616 int scope = yyextra->scopeStack.top();
617 yyextra->scopeStack.pop();
624 yyextra->insideBody=
FALSE;
628 yyextra->code->codify(yytext);
631 yyextra->currentMemberDef=
nullptr;
632 if (yyextra->currentDefinition)
633 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
virtual const QCString & name() const =0
bool endsWith(const char *s) const
636<ClassName,ClassVar>";" {
637 if (yyextra->lang==SrcLangExt::CSharp)
639 yyextra->code->codify(yytext);
640 yyextra->skipCodify =
true;
645 yyextra->code->codify(yytext);
646 yyextra->searchingForBody=
FALSE;
650<ClassName,ClassVar>[*&^%]+ {
651 yyextra->type=yyextra->curClassName;
652 yyextra->name.clear();
653 yyextra->code->codify(yytext);
656<ClassName>"__declspec"{B}*"("{B}*{ID}{B}*")" {
658 yyextra->code->codify(yytext);
661<ClassName>{ID}("."{ID})* |
662<ClassName>{ID}("::"{ID})* {
663 if (yyextra->lang==SrcLangExt::CSharp)
664 yyextra->curClassName=
substitute(yytext,
".",
"::");
666 yyextra->curClassName=yytext;
668 if (yyextra->curClassName==
"alignas")
671 yyextra->code->codify(yytext);
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
682 yyextra->bracketCount=1;
683 yyextra->code->codify(yytext);
686<AlignAs>\n { yyextra->yyLineNr++;
689<AlignAs>. { yyextra->code->codify(yytext); }
690<AlignAsEnd>"(" { yyextra->code->codify(yytext);
691 yyextra->bracketCount++;
694 yyextra->code->codify(yytext);
695 if (--yyextra->bracketCount<=0)
700<AlignAsEnd>\n { yyextra->yyLineNr++;
703<AlignAsEnd>. { yyextra->code->codify(yytext); }
704<ClassName>{ID}("\\"{ID})* {
705 yyextra->curClassName=
substitute(yytext,
"\\",
"::");
707 pushScope(yyscanner,yyextra->curClassName);
712<ClassName>{ID}{B}*"("{ID}")" {
715 pushScope(yyscanner,yyextra->curClassName);
QCString removeRedundantWhiteSpace(const QCString &s)
720<PackageName>{ID}("."{ID})* {
721 yyextra->curClassName=
substitute(yytext,
".",
"::");
722 DBG_CTX((stderr,
"found package: %s\n",
qPrint(yyextra->curClassName)));
730<ClassVar>("extends"|"implements") {
734 yyextra->curClassBases.clear();
737<ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") {
738 DBG_CTX((stderr,
"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,
qPrint(yyextra->curClassName)));
742 BEGIN( CppCliTypeModifierFollowup );
745 yyextra->type = yyextra->curClassName;
746 yyextra->name = yytext;
747 if (yyextra->insideBody)
749 addVariable(yyscanner,yyextra->type,yyextra->name);
753<ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*":"{B}* {
755 yyextra->curClassBases.clear();
758<PackageName>[ \t]*";" |
759<Bases>^{Bopt}/"@"{ID} |
760<Bases,ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*"{"{B}* {
761 yyextra->theVarContext.pushScope();
762 if (!yyextra->skipCodify) yyextra->code->codify(yytext);
763 yyextra->skipCodify =
false;
764 if (YY_START==ClassVar && yyextra->curClassName.isEmpty())
766 yyextra->curClassName = yyextra->name;
768 if (yyextra->searchingForBody)
770 yyextra->searchingForBody=
FALSE;
771 yyextra->insideBody=
TRUE;
773 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
774 if (!yyextra->curClassName.isEmpty())
776 DBG_CTX((stderr,
"** scope stack push CLASSBLOCK\n"));
778 pushScope(yyscanner,yyextra->curClassName);
779 DBG_CTX((stderr,
"***** yyextra->curClassName=%s\n",
qPrint(yyextra->curClassName)));
780 if (yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->curClassName,
true)==
nullptr)
782 DBG_CTX((stderr,
"Adding new class %s\n",
qPrint(yyextra->curClassName)));
785 for (
const auto &s : yyextra->curClassBases)
788 auto it = yyextra->codeClassMap.find(s);
789 if (it!=yyextra->codeClassMap.end())
793 if (bcd==
nullptr) bcd=yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,s,
true);
794 if (bcd && bcd->
name()!=yyextra->curClassName)
796 var.localDef()->insertBaseClass(bcd->
name());
799 yyextra->codeClassMap.emplace(yyextra->curClassName.str(),std::move(var));
805 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
808 yyextra->curClassName.clear();
809 yyextra->curClassBases.clear();
ClassDef * toClassDef(Definition *d)
812<Bases>"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" {
814 yyextra->code->codify(yytext);
817<Bases>{SEP}?({ID}{SEP})*{ID} {
818 DBG_CTX((stderr,
"%s:addBase(%s)\n",
qPrint(yyextra->curClassName),yytext));
819 yyextra->curClassBases.emplace_back(yytext);
823 yyextra->code->codify(yytext);
824 if (!yyextra->insideObjC)
826 yyextra->sharpCount=1;
831 yyextra->insideProtocolList=
TRUE;
835 yyextra->code->codify(yytext);
836 yyextra->insideProtocolList=
FALSE;
839 yyextra->code->codify(yytext);
840 ++yyextra->sharpCount;
843 yyextra->code->codify(yytext);
844 if (--yyextra->sharpCount<=0)
848 yyextra->code->codify(yytext);
849 yyextra->lastStringContext=YY_START;
853 yyextra->code->codify(yytext);
854 yyextra->lastStringContext=YY_START;
858 yyextra->code->codify(yytext);
859 yyextra->sharpCount=1;
863 yyextra->code->codify(yytext);
864 ++yyextra->sharpCount;
867 yyextra->code->codify(yytext);
868 if (--yyextra->sharpCount<=0)
874 yyextra->code->codify(yytext);
878<Body>{SCOPEPREFIX}?"operator"{B}*"()"{Bopt}/"(" {
881 yyextra->bracketCount=0;
882 yyextra->args.clear();
883 yyextra->name+=yytext;
886<Body>{SCOPEPREFIX}?"operator"/"(" {
889 yyextra->bracketCount=0;
890 yyextra->args.clear();
891 yyextra->name+=yytext;
894<Body>{SCOPEPREFIX}?"operator"[^a-z_A-Z0-9\(\n]+/"(" {
897 yyextra->bracketCount=0;
898 yyextra->args.clear();
899 yyextra->name+=yytext;
902<Body,TemplDecl>("template"|"generic")/([^a-zA-Z0-9]) {
906 yyextra->insideTemplate=
TRUE;
907 yyextra->sharpCount=0;
909<Body>"concept"{BN}+ {
915<Body>"using"{BN}+"namespace"{BN}+ {
927<Body>"module"/{B}*[:;]? {
928 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
929 if (!yyextra->type.isEmpty() || !yyextra->name.isEmpty()) REJECT;
935<Body>"import"/{B}*[<":]? {
936 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
942<ConceptName>{ID}("::"{ID})* {
945<ConceptName>"=" {
codifyLines(yyscanner,yytext); BEGIN(Body); }
946<UsingName>{ID}(("::"|"."){ID})* {
951<UsingName>\n {
codifyLines(yyscanner,yytext); BEGIN(Body); }
952<UsingName>. {
codifyLines(yyscanner,yytext); BEGIN(Body); }
953<Body,FuncCall>"$"?"this"("->"|".") { yyextra->code->codify(yytext);
954 yyextra->isPrefixedWithThis =
TRUE;
956<Body>{KEYWORD}/([^a-z_A-Z0-9]) {
957 if (yyextra->lang==SrcLangExt::Java &&
qstrcmp(
"internal",yytext) ==0) REJECT;
962 if (text==
"typedef" || text.
find(
"enum ")!=-1)
965 yyextra->name+=yytext;
int find(char c, int index=0, bool cs=TRUE) const
int qstrcmp(const char *str1, const char *str2)
969<Body>{KEYWORD}/{B}* {
975<Body>{KEYWORD}/{BN}*"(" {
980 yyextra->name.clear();yyextra->type.clear();
982<FuncCall>"in"/{BN}* {
983 if (!yyextra->inForEachExpression) REJECT;
988 yyextra->theVarContext.popScope();
989 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
990 yyextra->theVarContext.pushScope();
991 yyextra->name.clear();yyextra->type.clear();
993<Body>{FLOWKW}/{BN}*"(" {
997 yyextra->name.clear();yyextra->type.clear();
998 yyextra->inForEachExpression = (
qstrcmp(yytext,
"for each")==0 ||
qstrcmp(yytext,
"foreach")==0);
1001<Body>{FLOWCONDITION}/{BN}*"(" {
1006 yyextra->name.clear();yyextra->type.clear();
1007 yyextra->inForEachExpression = (strcmp(yytext,
"for each")==0 || strcmp(yytext,
"foreach")==0);
1010<Body>{FLOWKW}/([^a-z_A-Z0-9]) {
1014 if (yyextra->inFunctionTryBlock && (
qstrcmp(yytext,
"catch")==0 ||
qstrcmp(yytext,
"finally")==0))
1016 yyextra->inFunctionTryBlock=
FALSE;
1019<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1024 if (yyextra->inFunctionTryBlock && (strcmp(yytext,
"catch")==0 || strcmp(yytext,
"finally")==0))
1026 yyextra->inFunctionTryBlock=
FALSE;
1029<Body>{FLOWKW}/{B}* {
1034<Body>{FLOWCONDITION}/{B}* {
1041 yyextra->code->codify(yytext);
1042 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1043 yyextra->bracketCount--;
1044 yyextra->parmType = yyextra->name;
1047<Body>"\\)"|"\\(" {
1048 yyextra->code->codify(yytext);
1050<Body>[\\|\)\+\-\/\%\~\!] {
1051 yyextra->code->codify(yytext);
1052 yyextra->name.clear();yyextra->type.clear();
1055 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1056 yyextra->bracketCount--;
1057 if (yyextra->bracketCount<=0)
1063<Body,TemplDecl,ObjCMethod>{TYPEKW}/{B}* {
1065 yyextra->code->codify(yytext);
1068 yyextra->name+=yytext;
1070<Body,TemplDecl,ObjCMethod>{TYPEKWSL}/{B}* {
1071 if (yyextra->lang!=SrcLangExt::Slice)
1078 yyextra->code->codify(yytext);
1081 yyextra->name+=yytext;
1084<Body>"generic"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1086 yyextra->code->codify(yytext);
1088 yyextra->sharpCount=0;
1091<Body>"template"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1093 yyextra->code->codify(yytext);
1095 yyextra->sharpCount=0;
1098<TemplDecl>"class"|"typename" {
1104 yyextra->code->codify(yytext);
1105 yyextra->sharpCount++;
1108 yyextra->code->codify(yytext);
1109 yyextra->sharpCount--;
1110 if (yyextra->sharpCount<=0)
1119 BEGIN( yyextra->lastTemplCastContext );
1121<TemplCast>{ID}("::"{ID})* {
1124<TemplCast>("const"|"volatile"){B}* {
1132<Body,MemberCall2,FuncCall>{CASTKW}{B}*"<" {
1136 yyextra->lastTemplCastContext = YY_START;
1139<Body>"$this->"{SCOPENAME}/{BN}*[;,)\]] {
1142 yyextra->name+=yytext+7;
1144<Body,TemplCast>{SCOPENAME}{B}*"<"[^\n\/\-\.\{\">\(']*">"{ENDIDopt}/{B}* {
1151 yyextra->name+=yytext;
1153<ModuleName,ModuleImport>{MODULE_ID}({BN}*":"{BN}*{MODULE_ID})? {
1155 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
1172<ModuleName>":"{BN}+"private" {
1174 int i=text.
find(
'p');
1180<ModuleName>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1181<ModuleName>. { yyextra->code->codify(yytext); }
1183<ModuleImport>["<] { yyextra->code->codify(yytext); BEGIN(ReadInclude); }
1184<ModuleImport>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1185<ModuleImport>. { yyextra->code->codify(yytext); }
1186<ModuleImport>\n {
codifyLines(yyscanner,yytext); }
1188<Body>{SCOPENAME}/{BN}*[:;,)\]] {
1195 yyextra->name+=yytext;
1197<Body>{ID}("."{ID})+/{BN}+ {
1198 if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
1202 yyextra->name+=yytext;
1209<Body>"export"/{B}* {
1210 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1215<Body>{SCOPENAME}/{B}* {
1222 yyextra->name+=yytext;
1224<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* {
1225 yyextra->code->codify(yytext);
1226 uint32_t s=0;
while (s<(uint32_t)yyleng && !
isId(yytext[s])) s++;
1227 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1230 yyextra->name=std::move(varname);
1232<Body>{SCOPETNAME}{B}*"<"[^\n\/\-\.\{\">]*">"/{BN}*"(" |
1233<Body>{SCOPETNAME}/{BN}*"(" {
1240 yyextra->bracketCount=0;
1241 yyextra->args.clear();
1242 yyextra->name+=yytext;
1245<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} {
1247 uint32_t i=(uint32_t)text.
find(
'R');
1248 yyextra->code->codify(text.
left(i+1));
1250 yyextra->code->codify(yytext+i+1);
1251 yyextra->lastStringContext=YY_START;
1252 yyextra->inForEachExpression =
FALSE;
QCString extractBeginRawStringDelimiter(const char *rawStart)
1256<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit,ClassVar,OldStyleArgs>\" {
1258 yyextra->code->codify(yytext);
1259 yyextra->lastStringContext=YY_START;
1260 yyextra->inForEachExpression =
FALSE;
1261 BEGIN( SkipString );
1263<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{NUMBER} {
1264 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1265 yyextra->code->codify(yytext);
1267<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
1269 yyextra->code->codify(yytext);
1270 yyextra->lastStringContext=YY_START;
1271 yyextra->inForEachExpression =
FALSE;
1272 BEGIN( SkipStringS );
1274<SkipString>[^\"\\\r\n]{1,100} {
1275 yyextra->code->codify(yytext);
1277<SkipStringS>[^\'\\\r\n]{1,100} {
1278 yyextra->code->codify(yytext);
1280<SkipString,SkipStringS>{CPPC}|{CCS} {
1281 yyextra->code->codify(yytext);
1284 yyextra->code->codify(yytext);
1285 if (yyextra->lastStringContext!=SkipCPP)
1289 BEGIN( yyextra->lastStringContext );
1292 yyextra->code->codify(yytext);
1294 BEGIN( yyextra->lastStringContext );
1296<SkipString,SkipStringS>\\. {
1297 yyextra->code->codify(yytext);
1299<RawString>{RAWEND} {
1300 yyextra->code->codify(yytext);
1303 BEGIN( yyextra->lastStringContext );
QCString extractEndRawStringDelimiter(const char *rawEnd)
1306<RawString>[^)\n]+ { yyextra->code->codify(yytext); }
1307<RawString>. { yyextra->code->codify(yytext); }
1309<SkipVerbString>[^"\n]+ {
1310 yyextra->code->codify(yytext);
1312<SkipVerbString>\"\" {
1313 yyextra->code->codify(yytext);
1316 yyextra->code->codify(yytext);
1318 BEGIN( yyextra->lastVerbStringContext );
1321 yyextra->code->codify(yytext);
1327 yyextra->code->codify(yytext);
1328 yyextra->name.clear();yyextra->type.clear();
1331 if (yyextra->insideTemplate)
1333 yyextra->sharpCount++;
1335 yyextra->code->codify(yytext);
1338 if (yyextra->insideTemplate)
1340 if (--yyextra->sharpCount<=0)
1342 yyextra->insideTemplate=
FALSE;
1345 yyextra->code->codify(yytext);
1347<Body,MemberCall,MemberCall2,FuncCall,OldStyleArgs>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
1349 yyextra->code->codify(yytext);
1357 yyextra->code->codify(yytext);
1358 yyextra->memCallContext = YY_START;
1359 BEGIN( MemberCall );
1361<MemberCall>{SCOPETNAME}/{BN}*"(" {
1362 if (yyextra->theCallContext.getScope().globalDef())
1369 yyextra->name.clear();
1375 yyextra->name.clear();
1377 yyextra->type.clear();
1378 if (yyextra->memCallContext==Body)
1384 BEGIN(yyextra->memCallContext);
1387<MemberCall>{SCOPENAME}/{B}* {
1388 if (yyextra->theCallContext.getScope().globalDef())
1390 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1396 yyextra->name.clear();
1400 DBG_CTX((stderr,
"no class context!\n"));
1403 yyextra->name.clear();
1405 yyextra->type.clear();
1406 BEGIN(yyextra->memCallContext);
1409 if (yyextra->insideObjC && *yytext==
'[')
1411 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
1413 yyextra->contextMap.clear();
1414 yyextra->nameMap.clear();
1415 yyextra->objectMap.clear();
1416 yyextra->wordMap.clear();
1417 yyextra->commentMap.clear();
1418 yyextra->currentCtxId = 0;
1419 yyextra->currentNameId = 0;
1420 yyextra->currentObjId = 0;
1421 yyextra->currentCtx =
nullptr;
1422 yyextra->braceCount = 0;
1428 if (*yytext!=
'{') yyextra->code->codify(yytext);
1429 yyextra->saveName = yyextra->name;
1430 yyextra->saveType = yyextra->type;
1431 if (*yytext!=
'[' && !yyextra->type.isEmpty())
1438 addVariable(yyscanner,yyextra->type,yyextra->name);
1440 yyextra->name.clear();
1442 if (*yytext==
';' || *yytext==
'=' || *yytext==
'{')
1444 yyextra->type.clear();
1445 yyextra->name.clear();
1447 else if (*yytext==
'[')
1449 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1451 yyextra->args.clear();
1452 yyextra->parmType.clear();
1453 yyextra->parmName.clear();
1461<Body,FuncCall,BodyVar>"{" {
1462 yyextra->theVarContext.pushScope();
1463 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1464 yyextra->bracketCount = 0;
1467 if (yyextra->type.find(
"enum ")!=-1)
1469 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1475 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1479 if (yyextra->searchingForBody)
1481 yyextra->searchingForBody=
FALSE;
1482 yyextra->insideBody=
TRUE;
1484 yyextra->code->codify(yytext);
1485 if (yyextra->insideBody)
1487 yyextra->bodyCurlyCount++;
1489 yyextra->type.clear();
1490 yyextra->name.clear();
1493<ObjCCall,ObjCMName>"["|"{" {
1495 yyextra->currentCtx->format+=*yytext;
1499<ObjCCall,ObjCMName>"]"|"}" {
1500 yyextra->currentCtx->format+=*yytext;
1503 if (yyextra->currentCtx==
nullptr)
1507 auto it = yyextra->contextMap.find(0);
1508 if (it!=yyextra->contextMap.end())
1510 ctx = it->second.get();
1517<ObjCCall,ObjCMName>{CPPC}.* {
1518 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1520<ObjCCall,ObjCMName>{CCS} {
1521 yyextra->lastObjCCallContext = YY_START;
1522 yyextra->currentCtx->comment.str(yytext);
1523 BEGIN(ObjCCallComment);
1525<ObjCCallComment>{CCE} {
1526 yyextra->currentCtx->comment << yytext;
1527 yyextra->currentCtx->format+=
escapeComment(yyscanner,yyextra->currentCtx->comment.str());
1528 BEGIN(yyextra->lastObjCCallContext);
1530<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
1531<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
1532<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
1533<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
1534<ObjCCall>{ID}({B}*"."{B}*{ID})* {
1535 yyextra->currentCtx->format+=
escapeObject(yyscanner,yytext);
1536 if (yyextra->braceCount==0)
1538 yyextra->currentCtx->objectTypeOrName=yytext;
1539 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1543<ObjCMName>{ID}/{BN}*"]" {
1544 if (yyextra->braceCount==0 &&
1545 yyextra->currentCtx->methodName.isEmpty())
1547 yyextra->currentCtx->methodName=yytext;
1548 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1552 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1555<ObjCMName>{ID}/{BN}*":" {
1556 if (yyextra->braceCount==0)
1558 yyextra->currentCtx->methodName+=yytext;
1559 yyextra->currentCtx->methodName+=
":";
1561 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1563<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1564<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1565<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1566 BEGIN(yyextra->lastStringContext);
1568<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1569<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1570 yyextra->lastStringContext=YY_START;
1573<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+=
"$$"; }
1574<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
1575<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
1576<ObjCSkipStr>"@"/"\"" {
1577 yyextra->currentCtx->format+=yytext;
1579<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext); }
1580<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
1581<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
1584 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1585 yyextra->code->codify(yytext);
1587 yyextra->name = yyextra->saveName;
1588 yyextra->type = yyextra->saveType;
1591 yyextra->code->codify(yytext);
1593<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1594 yyextra->code->codify(yytext);
1596<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1601 yyextra->code->codify(yytext);
1604<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1606 yyextra->parmName=yytext;
1608 yyextra->code->codify(yytext);
1611<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1612 if (yyextra->lang!=SrcLangExt::Slice)
1619 yyextra->parmName=yytext;
1621 yyextra->code->codify(yytext);
1625<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1627 yyextra->parmName=yytext;
1629 yyextra->code->codify(yytext);
1632<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1635 yyextra->parmName=yytext;
1637 yyextra->code->codify(yytext);
1640<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1646 yyextra->parmName=yytext;
1650 yyextra->code->codify(yytext);
1651 yyextra->inForEachExpression =
FALSE;
1654<MemberCall2,FuncCall>, {
1655 yyextra->code->codify(yytext);
1656 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1657 yyextra->parmType.clear();yyextra->parmName.clear();
1659<MemberCall2,FuncCall>"{" {
1660 if (yyextra->bracketCount>0)
1662 yyextra->code->codify(yytext);
1663 yyextra->skipInlineInitContext=YY_START;
1664 yyextra->curlyCount=0;
1672<InlineInit>"{" { yyextra->curlyCount++;
1673 yyextra->code->codify(yytext);
1676 yyextra->code->codify(yytext);
1677 if (--yyextra->curlyCount<=0)
1679 BEGIN(yyextra->skipInlineInitContext);
1686 yyextra->code->codify(yytext);
1688<MemberCall2,FuncCall>"(" {
1689 yyextra->parmType.clear();yyextra->parmName.clear();
1690 yyextra->code->codify(yytext);
1691 yyextra->bracketCount++;
1692 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1693 if (YY_START==FuncCall && !yyextra->insideBody)
1695 yyextra->theVarContext.pushScope();
1698<MemberCall2,FuncCall>{OPERATOR} {
1705 yyextra->parmType.clear();yyextra->parmName.clear();
1707 yyextra->code->codify(yytext);
1709<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1712 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1713 if (yyextra->parmType.isEmpty())
1715 yyextra->parmType=yyextra->parmName;
1716 yyextra->parmName.clear();
1718 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1722 yyextra->parmType = yyextra->parmName;
1723 yyextra->parmName.clear();
1724 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1726 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1727 yyextra->inForEachExpression =
FALSE;
1729 yyextra->code->codify(yytext);
1730 if (--yyextra->bracketCount<=0)
1732 if (yyextra->name.isEmpty())
1742<MemberCall,MemberCall2,FuncCall>[;:] {
1744 if (yyextra->bracketCount<=0)
1751 yyextra->code->codify(yytext);
1754<CallEnd>[ \t\n]* {
codifyLines(yyscanner,yytext); }
1757 yyextra->bracketCount=0;
1758 if (*yytext==
';') yyextra->searchingForBody=
FALSE;
1759 if (!yyextra->type.isEmpty())
1761 DBG_CTX((stderr,
"add variable yyextra->type=%s yyextra->name=%s)\n",
qPrint(yyextra->type),
qPrint(yyextra->name)));
1762 addVariable(yyscanner,yyextra->type,yyextra->name);
1764 yyextra->parmType.clear();yyextra->parmName.clear();
1766 if (*yytext==
';' || yyextra->insideBody)
1768 if (!yyextra->insideBody)
1770 yyextra->theVarContext.popScope();
1772 yyextra->name.clear();yyextra->type.clear();
1777 yyextra->bracketCount=0;
1781<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1786<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1787 if (yyextra->insideBody)
1789 yyextra->theVarContext.pushScope();
1791 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1793 yyextra->parmType.clear();yyextra->parmName.clear();
1794 int index = yyextra->name.findRev(
"::");
1795 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1799 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1805 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1811 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1816 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1819 yytext[yyleng-1]=
'\0';
1821 if (!cv.stripWhiteSpace().isEmpty())
1831 yyextra->code->codify(
"{");
1832 if (yyextra->searchingForBody)
1834 yyextra->searchingForBody=
FALSE;
1835 yyextra->insideBody=
TRUE;
1837 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1838 yyextra->type.clear(); yyextra->name.clear();
static NamespaceDefMutable * globalScope
QCString & prepend(const char *s)
1843 yyextra->code->codify(yytext);
1845 yyextra->inFunctionTryBlock=
TRUE;
1847<CallEnd>"requires" {
1849 yyextra->code->codify(yytext);
1853 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1859 yyextra->parmName=yytext;
1861 BEGIN(OldStyleArgs);
1865 yyextra->parmName=yytext;
1869 yyextra->code->codify(yytext);
1870 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1871 if (*yytext==
';') yyextra->parmType.clear();
1872 yyextra->parmName.clear();
1874<CallEnd,OldStyleArgs>"#" {
1876 yyextra->lastSkipCppContext = Body;
1877 yyextra->code->codify(yytext);
1882 if (!yyextra->insideBody)
1884 yyextra->theVarContext.popScope();
1886 yyextra->name.clear();yyextra->args.clear();
1887 yyextra->parmType.clear();yyextra->parmName.clear();
1891 yyextra->code->codify(yytext);
1892 yyextra->type.clear(); yyextra->name.clear();
1896 yyextra->code->codify(yytext);
1897 if (yyextra->searchingForBody)
1899 yyextra->searchingForBody=
FALSE;
1900 yyextra->insideBody=
TRUE;
1902 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1903 if (yyextra->name.find(
"::")!=-1)
1905 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1911 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1914 yyextra->type.clear(); yyextra->name.clear();
1917<SkipInits>{ID}{B}*"{" {
1919 int bracketPos = text.
find(
'{');
1920 int spacePos = text.
find(
' ');
1921 int len = spacePos==-1 ? bracketPos : spacePos;
1923 yyextra->code->codify(yytext+len);
1931<FuncCall>{ID}/("."|"->") {
1932 yyextra->name=yytext;
1934 BEGIN( MemberCall2 );
1936<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1937 yyextra->code->codify(yytext);
1938 uint32_t s=0;
while (!
isId(yytext[s])) s++;
1939 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1940 yyextra->name=((
QCString)yytext).mid(s,e-s+1);
1941 BEGIN( MemberCall2 );
1943<MemberCall2>{ID}/([ \t\n]*"(") {
1944 if (!yyextra->args.isEmpty())
1948 yyextra->args.clear();
1951<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1953 yyextra->name=yytext;
1955 BEGIN( MemberCall2 );
1957<MemberCall2>"->"|"." {
1962 yyextra->code->codify(yytext);
1963 yyextra->memCallContext = YY_START;
1964 BEGIN( MemberCall );
1966<SkipComment>{CCS}("!"?){CCE} {
1967 yyextra->code->codify(yytext);
1969 BEGIN( yyextra->lastCContext ) ;
1971<SkipComment>{CPPC}|{CCS} {
1972 yyextra->code->codify(yytext);
1974<SkipComment>[^*\/\n]+ {
1975 yyextra->code->codify(yytext);
1977<SkipComment>[ \t]*{CCE} {
1978 yyextra->code->codify(yytext);
1980 if (yyextra->lastCContext==SkipCPP)
1984 BEGIN( yyextra->lastCContext ) ;
1986<SkipCxxComment>[^\r\n]*"\\"[\r]?\n {
1989<SkipCxxComment>[^\r\n]+ {
1990 yyextra->code->codify(yytext);
1996 BEGIN( yyextra->lastCContext ) ;
1999 yyextra->code->codify(yytext);
2001<MemberCall>[^a-z_A-Z0-9(\n] {
2002 yyextra->code->codify(yytext);
2003 yyextra->type.clear();
2004 yyextra->name.clear();
2005 BEGIN(yyextra->memCallContext);
2007<*>\n({B}*{CPPC}[!/][^\n]*\n)+ {
2008 if (YY_START==SkipCPP) REJECT;
2013 if (YY_START==SkipCxxComment)
2015 BEGIN( yyextra->lastCContext ) ;
2020 BEGIN( yyextra->lastSkipCppContext ) ;
2023<*>\n{B}*{CPPC}"@"[{}].*\n {
2028 if (YY_START==SkipCxxComment)
2030 BEGIN( yyextra->lastCContext ) ;
2033<*>\n{B}*{CCS}"@"[{}] {
2035 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2037 yyextra->lastCContext = YY_START ;
2043<*>^{B}*{CPPC}"@"[{}].*\n {
2049<*>^{B}*{CCS}"@"[{}] {
2051 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2053 yyextra->lastCContext = YY_START ;
2056 yyextra->code->codify(yytext);
2059<*>^{B}*{CPPC}[!/][^\n]* {
2064<*>{CPPC}[!/][^\n]* {
2065 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2070<*>\n{B}*{CCS}[!*]/{NCOMM} {
2072 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2074 yyextra->lastCContext = YY_START ;
2080<*>^{B}*{CCS}"*"[*]+/[^/] {
2082 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2084 yyextra->lastCContext = YY_START ;
2088 yyextra->code->codify(yytext);
#define Config_getBool(name)
2091<*>^{B}*{CCS}[!*]/{NCOMM} {
2093 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2095 yyextra->lastCContext = YY_START ;
2098 yyextra->code->codify(yytext);
2101<*>{CCS}[!*]/{NCOMM} {
2102 if (YY_START==SkipString) REJECT;
2104 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2106 yyextra->lastCContext = YY_START ;
2109 yyextra->code->codify(yytext);
2112<*>{CCS}("!"?){CCE} {
2113 if (YY_START==SkipString) REJECT;
2116 yyextra->code->codify(yytext);
2119<SkipComment>[^\*\n]+ {
2120 yyextra->code->codify(yytext);
2124 yyextra->code->codify(yytext);
2126 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2128 yyextra->lastCContext = YY_START ;
2130 BEGIN( SkipComment ) ;
2134 yyextra->code->codify(yytext);
2135 yyextra->lastVerbStringContext=YY_START;
2136 BEGIN(SkipVerbString);
2140 yyextra->code->codify(yytext);
2141 yyextra->lastCContext = YY_START ;
2142 BEGIN( SkipCxxComment ) ;
2145 if (yytext[0]==
'(') yyextra->bracketCount++;
2146 yyextra->code->codify(yytext);
2147 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2150 if (yytext[0]==
')') yyextra->bracketCount--;
2151 yyextra->code->codify(yytext);
2152 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2158 yyextra->code->codify(yytext);
2161 yyextra->code->codify(yytext);
2178 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2186 DBG_CTX((stderr,
"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n",
2187 qPrint(ltype),
qPrint(lname),yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>"));
2188 auto it = yyextra->codeClassMap.find(ltype.
str());
2189 if (it!=yyextra->codeClassMap.end())
2192 yyextra->theVarContext.addVariable(lname,std::move(it->second));
2196 auto findVariableType = [&yyscanner,&yyg,<ype,&lname,&name](
const Definition *d) ->
const ClassDef *
2198 const ClassDef *varDef = yyextra->symbolResolver.resolveClass(d,ltype,
true);
2205 else if ((i=ltype.find(
'<'))!=-1)
2212 const ClassDef *varDef = findVariableType(yyextra->currentDefinition);
2213 if (varDef==
nullptr)
2215 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2217 varDef = findVariableType(namespaceDef);
2221 if (varDef==
nullptr)
2223 if (!yyextra->theVarContext.atGlobalScope())
2227 DBG_CTX((stderr,
"** addVariable: dummy context for '%s'\n",
qPrint(lname)));
2232 DBG_CTX((stderr,
"** addVariable: not adding variable!\n"));
2243 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2244 yyextra->scopeNameLengthStack.push_back(
int(yyextra->scopeName.length()));
2245 if (yyextra->scopeName.isEmpty() ||
leftScopeMatch(s,yyextra->scopeName))
2247 yyextra->scopeName = s;
2251 yyextra->scopeName +=
"::";
2252 yyextra->scopeName += s;
2261 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2262 if (!yyextra->scopeNameLengthStack.empty())
2264 int length = yyextra->scopeNameLengthStack.back();
2265 yyextra->scopeNameLengthStack.pop_back();
2266 yyextra->scopeName.resize(length);
2272 DBG_CTX((stderr,
"popScope() result: '%s'\n",
qPrint(yyextra->scopeName)));
2277 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2280 if (yyextra->searchCtx)
2301 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2307 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
2308 if (ts!=-1 && te!=-1 && te>ts)
2313 while (!yyextra->scopeNameLengthStack.empty())
2317 yyextra->scopeName.clear();
2319 while ((i=n.
find(
"::"))!=-1)
2325 DBG_CTX((stderr,
"--->New class scope '%s'\n",
qPrint(yyextra->scopeName)));
2330 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2331 while (!yyextra->foldStack.empty())
2333 const Definition *dd = yyextra->foldStack.back();
2336 yyextra->code->endFold();
2338 yyextra->foldStack.pop_back();
2353 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2362 if (endLine!=-1 && startLine!=endLine &&
2370 (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
2378 yyextra->code->startFold(yyextra->yyLineNr,
"",
"");
2382 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2386 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2391 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2395 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2397 yyextra->foldStack.push_back(d);
2409 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2411 if (yyextra->sourceFileDef && yyextra->lineNumbers)
2417 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
2419 DBG_CTX((stderr,
"%s:startCodeLine(%d)=%p\n",
qPrint(yyextra->sourceFileDef->name()),yyextra->yyLineNr,(
void*)d));
2420 if (!yyextra->includeCodeFragment && d)
2422 yyextra->currentDefinition = d;
2423 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
2424 yyextra->insideBody =
FALSE;
2425 yyextra->searchingForBody =
TRUE;
2427 yyextra->type.
clear();
2428 yyextra->name.clear();
2429 yyextra->args.clear();
2430 yyextra->parmType.clear();
2431 yyextra->parmName.clear();
2432 DBG_CTX((stderr,
"Real scope: '%s'\n",
qPrint(yyextra->realScope)));
2433 yyextra->bodyCurlyCount = 0;
2435 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
2436 if (yyextra->currentMemberDef)
2439 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
2440 yyextra->currentMemberDef->getOutputFileBase(),
2441 yyextra->currentMemberDef->anchor(),
2442 yyextra->yyLineNr,!yyextra->includeCodeFragment);
2450 QCString(),yyextra->yyLineNr,!yyextra->includeCodeFragment);
2462 !yyextra->includeCodeFragment);
2465 DBG_CTX((stderr,
"startCodeLine(%d)\n",yyextra->yyLineNr));
2466 yyextra->code->startCodeLine(yyextra->yyLineNr);
2467 yyextra->insideCodeLine =
true;
2468 if (yyextra->currentFontClass)
2470 yyextra->code->startFontClass(yyextra->currentFontClass);
2478 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2479 DBG_CTX((stderr,
"endCodeLine(%d)\n",yyextra->yyLineNr));
2481 yyextra->code->endCodeLine();
2482 yyextra->insideCodeLine =
false;
2487 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2488 const char * fc = yyextra->currentFontClass;
2489 if (yyextra->insideCodeLine)
2493 if (yyextra->yyLineNr<yyextra->inputLines)
2495 yyextra->currentFontClass = fc;
2505 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2506 DBG_CTX((stderr,
"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,
qPrint(text)));
2508 const char *p=text.
data(),*sp=p;
2514 while ((c=*p++) && c!=
'\n');
2517 yyextra->yyLineNr++;
2518 size_t l =
static_cast<size_t>(p-sp-1);
2519 yyextra->code->codify(
QCString(sp,l));
2524 yyextra->code->codify(sp);
2533 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2534 if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
2552 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2554 yyextra->tooltipManager.addTooltip(d);
2559 if (!sourceTooltips)
2564 const char *p=text.
data();
2569 while ((c=*p++) && c!=
'\n') { }
2572 yyextra->yyLineNr++;
2588 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2589 if (yyextra->name==
"const") { yyextra->name.clear();
return; }
2590 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2591 yyextra->type += yyextra->name ;
2592 yyextra->name.clear() ;
2593 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2594 yyextra->type += yyextra->args ;
2595 yyextra->args.clear() ;
2600 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2601 if (yyextra->parmName==
"const") { yyextra->parmName.clear();
return; }
2602 if (!yyextra->parmType.isEmpty()) yyextra->parmType +=
' ' ;
2603 yyextra->parmType += yyextra->parmName ;
2604 yyextra->parmName.clear() ;
2610 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2611 if (yyextra->sourceFileDef && !name.
isEmpty())
2616 yyextra->theUsingContext.emplace(name.
str(),nd);
2623 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2626 yyextra->parmName = a.name;
2627 yyextra->parmType = a.type;
2628 int i = yyextra->parmType.find(
'*');
2629 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2630 i = yyextra->parmType.find(
'&');
2631 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2632 yyextra->parmType.stripPrefix(
"const ");
2633 yyextra->parmType=yyextra->parmType.stripWhiteSpace();
2634 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
2640 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2641 DBG_CTX((stderr,
"stripClassName(scope=%s,type=%s) scopeName=%s\n",
2649 QCString clName=className+templSpec;
2651 if (!yyextra->scopeName.isEmpty())
2653 cd=yyextra->symbolResolver.resolveClass(d,yyextra->scopeName+
"::"+clName,
true);
2657 cd=yyextra->symbolResolver.resolveClass(d,clName,
true);
2659 DBG_CTX((stderr,
"stripClass trying '%s' = %p\n",
qPrint(clName),(
void*)cd));
2672 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2673 DBG_CTX((stderr,
"setCallContextForVar(%s) yyextra->scopeName=%s\n",
qPrint(name),
qPrint(yyextra->scopeName)));
2675 int scopeEnd = name.
findRev(
"::");
2682 if (mcd && !locName.
isEmpty())
2695 if (mnd && !locName.
isEmpty())
2711 DBG_CTX((stderr,
"local variable?\n"));
2715 yyextra->theCallContext.setScope(*mcv);
2720 DBG_CTX((stderr,
"class member? scope=%s\n",
qPrint(yyextra->scopeName)));
2730 if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=
CLASSBLOCK)
2747 const std::unique_ptr<MemberDef> &md=mn->
front();
2748 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2755 else if (mn->
size()>1)
2757 for (
const auto &md : *mn)
2766 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2769 DBG_CTX((stderr,
"returning member %s in source file %s\n",
qPrint(md->name()),
qPrint(yyextra->sourceFileDef->name())));
2781 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2782 const Definition *d = yyextra->theCallContext.getScope().globalDef();
2805 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2806 DBG_CTX((stderr,
"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",
qPrint(c),
qPrint(m),varOnly));
2811 DBG_CTX((stderr,
"scopeNameLengthStack.size()=%zu\n",yyextra->scopeNameLengthStack.size()));
2812 if (!result.
found && !yyextra->scopeNameLengthStack.empty() && c==yyextra->scopeName)
2814 QCString localName = yyextra->scopeName.
mid(yyextra->scopeNameLengthStack[0]+2);
2815 auto it = yyextra->codeClassMap.
find(localName.
str());
2816 if (it!=yyextra->codeClassMap.end())
2823 DBG_CTX((stderr,
"trying lookup via base class %s\n",
qPrint(bcName)));
2826 if (result.
found)
break;
2836 if (yyextra->exampleBlock)
2840 anchor.
sprintf(
"a%d",yyextra->anchorCount);
2842 qPrint(yyextra->exampleFile)));
2844 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
2847 yyextra->anchorCount++;
2861 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n",
2862 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,yyextra->insideBody));
2864 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
2865 yyextra->insideBody && yyextra->collectXRefs)
2887 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2888 DBG_CTX((stderr,
"getLink(%s,%s) yyextra->curClassName=%s\n",
2894 if (!yyextra->curClassName.isEmpty())
2897 c.
prepend(yyextra->curClassName);
2911 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2913 if (!scopeName.
isEmpty() && scopeName[0]==
'~')
2915 scopeName=scopeName.
mid(1);
2919 yyextra->code->codify(
"~");
2922 if (yyextra->insideProtocolList)
2926 if (yyextra->lang==SrcLangExt::PHP)
2930 else if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
2934 if (yyextra->currentDefinition==
nullptr && !yyextra->scopeName.isEmpty())
2936 scopeName = yyextra->scopeName+
"::"+scopeName;
2942 DBG_CTX((stderr,
"generateClassOrGlobalLink(name=%s) yyextra->scopeName=%s scopeName=%s\n",
qPrint(scName),
qPrint(yyextra->scopeName),
qPrint(scopeName)));
2943 if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(scopeName))==
nullptr)
2945 int i=scopeName.
find(
'<');
2947 if (i!=-1) bareName = bareName.
left(i);
2949 auto checkForSymbol = [&yyg,&bareName,&scopeName](
const Definition *
parent,
2952 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,scopeName,
QCString(),
false,
true);
2953 DBG_CTX((stderr,
"non-local variable name=%s sym=%s!\n",
2954 qPrint(scopeName),sym_?
qPrint(sym_->name()):
"<none>"));
2955 if (sym_==
nullptr && !bareName.
isEmpty())
2958 if (bareName!=scopeName)
2960 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,bareName,
QCString(),
false,
true);
2964 const Definition *d = yyextra->currentDefinition;
2965 DBG_CTX((stderr,
"d=%s yyextra->sourceFileDef=%s\n",d?
qPrint(d->
name()):
"<none>",yyextra->sourceFileDef?
qPrint(yyextra->sourceFileDef->name()):
"<none>"));
2966 checkForSymbol(d,sym);
2975 checkForSymbol(nd,sym);
2983 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2985 checkForSymbol(namespaceDef,sym);
3007 DBG_CTX((stderr,
"is found as a type sym=%s nd=%s\n",
3012 if (
getLink(yyscanner,yyextra->scopeName,scName,ol,scName,varOnly))
3020 DBG_CTX((stderr,
"local variable!\n"));
3024 yyextra->theCallContext.setScope(*lcd);
3035 DBG_CTX((stderr,
"is a local variable sym=%p!\n",(
void*)sym));
3037 yyextra->isPrefixedWithThis =
FALSE;
3042 if (yyextra->exampleBlock)
3046 anchor.
sprintf(
"_a%d",yyextra->anchorCount);
3047 DBG_CTX((stderr,
"addExampleClass(%s,%s,%s)\n",
qPrint(anchor),
qPrint(yyextra->exampleName),
3048 qPrint(yyextra->exampleFile)));
3052 if (cdm && cdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3055 yyextra->anchorCount++;
3061 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3064 yyextra->anchorCount++;
3078 yyextra->currentMemberDef && yyextra->collectXRefs)
3087 DBG_CTX((stderr,
"class %s not linkable! cd=%p typeOnly=%d\n",
qPrint(scName),(
void*)sym,typeOnly));
3088 if (!isLocal && (md || (!sym && !typeOnly)))
3093 DBG_CTX((stderr,
"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%s\n",
qPrint(scName),(
void*)md,yyextra->currentDefinition ?
qPrint(yyextra->currentDefinition->name()) :
"<none>"));
3094 if (md && yyextra->currentDefinition)
3096 DBG_CTX((stderr,
"%s accessible from %s? %d md->getOuterScope=%s\n",
3097 qPrint(md->name()),
qPrint(yyextra->currentDefinition->name()),
3098 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md),
3099 qPrint(md->getOuterScope()->name())));
3102 if (md && yyextra->currentDefinition &&
3103 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md)==-1)
3110 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()));
3111 if (md->isLinkable())
3115 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3125 DBG_CTX((stderr,
"not found!\n"));
3136 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3140 DBG_CTX((stderr,
"type='%s' args='%s' class=%s\n",
3144 if (yyextra->exampleBlock)
3148 anchor.
sprintf(
"a%d",yyextra->anchorCount);
3150 qPrint(yyextra->exampleFile)));
3152 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3155 yyextra->anchorCount++;
3169 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",
3170 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,(
void*)xmd,yyextra->insideBody));
3172 if (xmd->templateMaster()) xmd = xmd->templateMaster();
3174 if (xmd->isLinkable())
3177 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
3178 yyextra->insideBody && yyextra->collectXRefs)
3198 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3203 DBG_CTX((stderr,
"generateClassMemberLink(class=%s,member=%s)=%p\n",
qPrint(def->
name()),
qPrint(memName),(
void*)xmd));
3241 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3242 DBG_CTX((stderr,
"generateMemberLink(object=%s,mem=%s) classScope=%s\n",
3245 if (varName.
isEmpty())
return;
3253 DBG_CTX((stderr,
"Class found!\n"));
3256 DBG_CTX((stderr,
"Found result!\n"));
3263 if (
getLink(yyscanner,bcName,memName,ol))
3265 DBG_CTX((stderr,
"Found result!\n"));
3274 const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->scopeName,
true);
3277 DBG_CTX((stderr,
"Found class %s for variable '%s'\n",
qPrint(yyextra->scopeName),
qPrint(varName)));
3291 for (
const auto &vmd : *vmn)
3293 if (vmd->getClassDef()==jcd)
3295 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3308 DBG_CTX((stderr,
"There is a variable with name '%s'\n",
qPrint(varName)));
3309 for (
const auto &vmd : *vmn)
3311 if (vmd->getClassDef()==vcd)
3313 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3332 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3335 DBG_CTX((stderr,
"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,
qPrint(name),
qPrint(yyextra->scopeName)));
3336 if (!
getLink(yyscanner,yyextra->scopeName,name,ol,varName))
3344 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3346 QCString locScope=yyextra->scopeName;
3348 if (yyextra->lang==SrcLangExt::PHP && locFunc.
startsWith(
"self::")) locFunc=locFunc.
mid(4);
3351 QCString funcWithFullScope=locFunc;
3356 if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() &&
3357 funcName==yyextra->currentMemberDef->localName() &&
3358 yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr &&
3382 funcScope=locFunc.
left(i);
3384 int ts=locScope.
find(
'<');
3386 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3387 if (ts!=-1 && te!=-1 && te>ts)
3392 ts=funcScope.
find(
'<');
3394 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3395 if (ts!=-1 && te!=-1 && te>ts)
3398 funcScope=funcScope.
left(ts)+funcScope.
right(funcScope.
length()-te-1);
3402 funcWithScope = funcScope+
"::"+locFunc;
3405 fullScope=locScope+
"::"+funcScope;
3410 funcWithFullScope = locScope+
"::"+funcWithScope;
3416 auto it = yyextra->codeClassMap.find(fullScope.
str());
3417 if (it!=yyextra->codeClassMap.end())
3424 if (
getLink(yyscanner,bcName,locFunc,ol,funcName))
3433 if (!locScope.
isEmpty() && fullScope!=locScope)
3435 auto it = yyextra->codeClassMap.find(locScope.
str());
3436 if (it!=yyextra->codeClassMap.end())
3443 if (
getLink(yyscanner,bcName,funcWithScope,ol,funcName))
3451 if (!
getLink(yyscanner,locScope,funcWithScope,ol,funcName))
3462 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3463 const char *p=yyextra->inputString;
3469 if (c==
'\n') count++;
3471 if (p>yyextra->inputString && *(p-1)!=
'\n')
3480 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3481 if (yyextra->currentFontClass)
3483 yyextra->code->endFontClass();
3484 yyextra->currentFontClass=
nullptr;
3486 if (specialComment && yyextra->insideSpecialComment)
3488 yyextra->code->endSpecialComment();
3489 yyextra->insideSpecialComment =
false;
3495 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3499 yyextra->code->startSpecialComment();
3500 yyextra->insideSpecialComment =
true;
3502 yyextra->code->startFontClass(s);
3503 yyextra->currentFontClass=s;
3511 if (ctx==
nullptr)
return;
3512 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3516 DBG_CTX((stderr,
"writeObjCMethodCall(%s) obj=%s method=%s\n",
3525 DBG_CTX((stderr,
" object is local variable\n"));
3533 DBG_CTX((stderr,
" class=%p method=%p\n",(
void*)cd,(
void*)ctx->
method));
3544 char skipChar =
' ';
3569 yyextra->code->codify(
"$");
3577 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3579 int refId=refIdStr.
toInt();
3580 auto it = yyextra->nameMap.find(refId);
3581 if (it!=yyextra->nameMap.end())
3587 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3599 DBG_CTX((stderr,
"Invalid name: id=%d\n",refId));
3606 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3608 int refId=refIdStr.
toInt();
3609 auto it = yyextra->objectMap.find(refId);
3610 if (it!=yyextra->objectMap.end())
3615 if (yyextra->currentDefinition &&
3632 else if (
object==
"super")
3634 if (yyextra->currentDefinition &&
3661 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3674 int dotPos=
object.find(
'.',pp);
3675 int len =
static_cast<int>(
object.length());
3676 if (dotPos==-1) dotPos=len;
3677 const Definition *scope = yyextra->currentDefinition;
3684 if (fragmentStripped==
"self")
3697 const Definition *symbol = yyextra->symbolResolver.resolveSymbol(scope,fragmentStripped,
QCString(),
false,
true);
3703 ctx->
method = yyextra->symbolResolver.getTypedef();
3727 dotPos=
object.find(
'.',pp);
3728 if (dotPos==-1) dotPos=len;
3737 else if (ctx->
method==
nullptr)
3740 DBG_CTX((stderr,
"yyextra->currentDefinition=%p\n",(
void*)yyextra->currentDefinition));
3741 if (yyextra->currentDefinition &&
3762 DBG_CTX((stderr,
"Invalid object: id=%d\n",refId));
3769 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3771 int refId=refIdStr.
toInt();
3772 auto it = yyextra->contextMap.find(refId);
3773 if (it!=yyextra->contextMap.end())
3788 if (mn && mn->
size()==1)
3806 DBG_CTX((stderr,
"Invalid context: id=%d\n",refId));
3813 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3815 int refId=refIdStr.
toInt();
3816 auto it = yyextra->wordMap.find(refId);
3817 if (it!=yyextra->wordMap.end())
3820 bool isKeyword = word==
"self";
3836 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3838 int refId=refIdStr.
toInt();
3839 auto it = yyextra->commentMap.find(refId);
3840 if (it!=yyextra->commentMap.end())
3854 else if (c==
'\'' || c ==
'"')
3871 DBG_CTX((stderr,
"}=(type='%s',name='%s')",
3881 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3883 result.
sprintf(
"$n%d",yyextra->currentNameId);
3884 yyextra->nameMap.emplace(yyextra->currentNameId,s);
3885 yyextra->currentNameId++;
3891 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3893 result.
sprintf(
"$o%d",yyextra->currentObjId);
3894 yyextra->objectMap.emplace(yyextra->currentObjId,s);
3895 yyextra->currentObjId++;
3901 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3903 result.
sprintf(
"$w%d",yyextra->currentWordId);
3904 yyextra->wordMap.emplace(yyextra->currentWordId,s);
3905 yyextra->currentWordId++;
3911 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3913 result.
sprintf(
"$d%d",yyextra->currentCommentId);
3914 yyextra->commentMap.emplace(yyextra->currentCommentId,s);
3915 yyextra->currentCommentId++;
3921 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3922 static const std::unordered_set<std::string> non_cpp_keywords = {
3923 "__assume",
"__super",
"abstract",
"function",
3924 "gcnew",
"gcroot",
"generic",
"get",
3925 "internal",
"null",
"pin_ptr",
"raise",
3926 "remove",
"self",
"set",
"transient",
3929 static const std::unordered_set<std::string> non_java_keywords = {
3930 "alignas",
"alignof",
"and",
"and_eq",
"asm",
3931 "atomic_cancel",
"atomic_commit",
"atomic_noexcept",
"auto",
"bitand",
3932 "bitor",
"bool",
"char8_t",
"char16_t",
"char32_t",
3933 "compl",
"concept",
"consteval",
"constexpr",
"constinit",
3934 "const_cast",
"co_await",
"co_return",
"co_yield",
"decltype",
3935 "delete",
"dynamic_cast",
"explicit",
"export",
"extern",
3936 "friend",
"inline",
"mutable",
"namespace",
"noexcept",
3937 "not",
"not_eq",
"nullptr",
"operator",
"or",
3938 "or_eq",
"reflexpr",
"register",
"reinterpret_cast",
"requires",
3939 "signed",
"sizeof",
"static_assert",
"_Static_assert",
"static_cast",
"struct",
3940 "template",
"thread_local",
"typedef",
"typeid",
"typename",
3941 "union",
"unsigned",
"using",
"virtual",
"wchar_t",
3942 "xor",
"xor_eq",
"override",
"sealed"
3944 bool retval =
false;
3945 switch (yyextra->lang)
3947 case SrcLangExt::Cpp:
3948 retval = (non_cpp_keywords.find(keyword) != non_cpp_keywords.end());
3950 case SrcLangExt::Java:
3951 retval = (non_java_keywords.find(keyword) != non_java_keywords.end());
3964 if (i==-1)
return FALSE;
3966 return kw==
"const_cast" || kw==
"static_cast" || kw==
"dynamic_cast" || kw==
"reinterpret_cast";
3971 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3972 yy_size_t inputPosition = yyextra->inputPosition;
3973 const char *s = yyextra->inputString + inputPosition;
3975 while( c < max_size && *s )
3980 yyextra->inputPosition += c;
3987 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3988 if (yyextra->currentCtx)
3990 yyextra->currentCtx->format+=
QCString().
sprintf(
"$c%d",yyextra->currentCtxId);
3991 if (yyextra->braceCount==0 && YY_START==ObjCCall)
3993 yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1);
3994 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
3996 yyextra->contextStack.push(yyextra->currentCtx);
4000 DBG_CTX((stderr,
"Trying to save NULL context!\n"));
4002 auto newCtx = std::make_unique<ObjCCallCtx>();
4003 newCtx->id = yyextra->currentCtxId;
4004 newCtx->lexState = YY_START;
4005 newCtx->braceCount = yyextra->braceCount;
4006 newCtx->objectType =
nullptr;
4007 newCtx->objectVar =
nullptr;
4008 newCtx->method =
nullptr;
4009 DBG_CTX((stderr,
"save state=%d\n",YY_START));
4010 yyextra->currentCtx = newCtx.get();
4011 yyextra->contextMap.emplace(yyextra->currentCtxId,std::move(newCtx));
4012 yyextra->braceCount = 0;
4013 yyextra->currentCtxId++;
4018 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4019 DBG_CTX((stderr,
"restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState));
4020 BEGIN(yyextra->currentCtx->lexState);
4021 yyextra->braceCount = yyextra->currentCtx->braceCount;
4022 if (!yyextra->contextStack.empty())
4024 yyextra->currentCtx = yyextra->contextStack.top();
4025 yyextra->contextStack.pop();
4029 yyextra->currentCtx =
nullptr;
4030 DBG_CTX((stderr,
"Trying to pop context while yyextra->contextStack is empty!\n"));
4042 codeYYlex_init_extra(&
p->state,&
p->yyscanner);
4051 codeYYlex_destroy(
p->yyscanner);
4056 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4057 DBG_CTX((stderr,
"***CodeParser::reset()\n"));
4058 yyextra->theVarContext.clear();
4059 while (!yyextra->scopeNameLengthStack.empty()) yyextra->scopeNameLengthStack.pop_back();
4060 yyextra->codeClassMap.clear();
4061 yyextra->curClassBases.clear();
4062 yyextra->anchorCount = 0;
4063 yyextra->insideCodeLine =
false;
4068 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4069 yyextra->insideCodeLine = inp;
4074 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4075 return yyextra->insideCodeLine;
4082 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4083 DBG_CTX((stderr,
"***parseCode() exBlock=%d exName=%s fd=%p scopeName=%s searchCtx=%s\n",
4093 yyextra->code = &od;
4094 yyextra->inputString = s.
data();
4097 yyextra->inputPosition = 0;
4098 codeYYrestart(
nullptr,yyscanner);
4099 yyextra->currentFontClass =
nullptr;
4100 yyextra->searchCtx = options.
searchCtx();
4102 yyextra->inFunctionTryBlock =
FALSE;
4103 yyextra->symbolResolver.setFileScope(options.
fileDef());
4104 yyextra->foldStack.clear();
4105 yyextra->insideSpecialComment =
false;
4108 yyextra->curlyCount = 0;
4109 yyextra->bodyCurlyCount = 0;
4110 yyextra->bracketCount = 0;
4111 yyextra->sharpCount = 0;
4112 yyextra->insideTemplate =
FALSE;
4113 yyextra->theCallContext.clear();
4114 while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
4115 yyextra->scopeName = scopeName;
4117 yyextra->exampleBlock = options.
isExample();
4119 yyextra->sourceFileDef = options.
fileDef();
4121 if (options.
fileDef()==
nullptr)
4125 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
4127 yyextra->lang = lang;
4128 yyextra->insideObjC = lang==SrcLangExt::ObjC;
4129 if (yyextra->sourceFileDef)
4134 yyextra->currentMemberDef =
nullptr;
4135 yyextra->searchingForBody = options.
isExample();
4136 yyextra->insideBody =
FALSE;
4137 yyextra->bracketCount = 0;
4138 if (!yyextra->exampleName.isEmpty())
4141 DBG_CTX((stderr,
"yyextra->exampleFile=%s\n",
qPrint(yyextra->exampleFile)));
4145 if (!yyextra->insideCodeLine)
4149 yyextra->type.clear();
4150 yyextra->name.clear();
4151 yyextra->args.clear();
4152 yyextra->parmName.clear();
4153 yyextra->parmType.clear();
4156 codeYYlex(yyscanner);
4157 yyextra->lexInit=
TRUE;
4158 if (yyextra->insideCodeLine)
4164 while (!yyextra->foldStack.empty())
4166 yyextra->code->endFold();
4167 yyextra->foldStack.pop_back();
4170 if (yyextra->exampleFileDef)
4173 yyextra->exampleFileDef.reset();
4174 yyextra->sourceFileDef=
nullptr;
4177 yyextra->tooltipManager.writeTooltips(od);
void resetCodeParserState() override
Resets the state of the code parser.
void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool stripCodeComments, const CodeParserOptions &options) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
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.
Options to configure the code parser.
const Definition * searchCtx() const
const FileDef * fileDef() const
const MemberDef * memberDef() const
bool showLineNumbers() const
bool inlineFragment() const
QCString exampleName() const
bool collectXRefs() const
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)