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;
260#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 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.
271ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
273SCOPENAME ("::"{BN}*)?({ID}{BN}*{SEP}{BN}*)*("~"{BN}*)?{ID}
274TEMPLIST "<"[^\"\}\{\(\)\/\n>]*">"
275SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID})
276SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+
277KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property")
279KEYWORD ("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"))
280FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally")
281FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try")
282TYPEKW ("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")
283TYPEKWSL ("LocalObject"|"Object"|"Value")
284CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast")
285CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'"))
286ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++"
287ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|="
288LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"|"<=>"
289BITOP "&"|"|"|"^"|"<<"|">>"|"~"
290OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
291RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
292RAWEND ")"[^ \t\(\)\\]{0,16}\"
293MODULE_ID ({ID}".")*{ID}
299DECIMAL_INTEGER [1-9][0-9']*[0-9]?[uU]?[lL]?[lL]?
300HEXADECIMAL_INTEGER "0"[xX][0-9a-zA-Z']+[0-9a-zA-Z]?
301OCTAL_INTEGER "0"[0-7][0-7']+[0-7]?
302BINARY_INTEGER "0"[bB][01][01']*[01]?
303INTEGER_NUMBER {DECIMAL_INTEGER}|{HEXADECIMAL_INTEGER}|{OCTAL_INTEGER}|{BINARY_INTEGER}
307DIGIT_SEQ [0-9][0-9']*[0-9]?
308FRAC_CONST {DIGIT_SEQ}"."|{DIGIT_SEQ}?"."{DIGIT_SEQ}
309FP_EXP [eE][+-]?{DIGIT_SEQ}
310DEC_FP1 {FRAC_CONST}{FP_EXP}?{FP_SUF}?
311DEC_FP2 {DIGIT_SEQ}{FP_EXP}{FP_SUF}
313HEX_DIGIT_SEQ [0-9a-fA-F][0-9a-fA-F']*[0-9a-fA-F]?
314HEX_FRAC_CONST {HEX_DIGIT_SEQ}"."|{HEX_DIGIT_SEQ}?"."{HEX_DIGIT_SEQ}
315BIN_EXP [pP][+-]?{DIGIT_SEQ}
316HEX_FP1 "0"[xX]{HEX_FRAC_CONST}{BIN_EXP}{FP_SUF}?
317HEX_FP2 "0"[xX]{HEX_DIGIT_SEQ}{BIN_EXP}{FP_SUF}?
319FLOAT_DECIMAL {DEC_FP1}|{DEC_FP2}
320FLOAT_HEXADECIMAL {HEX_FP1}|{HEX_FP2}
321FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL}
322NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
335ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"sealed"|"override"))*
356%x CppCliTypeModifierFollowup
381<Body>^([ \t]*"#"[ \t]*("include"|"import")[ \t]*)("<"|"\"") {
383 yyextra->code->codify(yytext);
384 BEGIN( ReadInclude );
386<Body>("@interface"|"@implementation"|"@protocol")[ \t\n]+ {
387 yyextra->insideObjC=
TRUE;
391 if (!yyextra->insideTemplate)
394<Body>(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") {
395 if (yyextra->insideTemplate) REJECT;
401<Body>"property"|"event"/{BN}* {
402 if (yyextra->insideTemplate) REJECT;
407<Body>("partial"{B}+)?("class"|"struct"|"union"|"namespace"|"interface"){B}+ {
411 if (!yyextra->insideTemplate)
414<Body>("package")[ \t\n]+ {
418 BEGIN( PackageName );
421 if (!yyextra->insideObjC) REJECT;
425<Body,ClassVar,Bases>"-"|"+" {
426 if (!yyextra->insideObjC || yyextra->insideBody)
428 yyextra->code->codify(yytext);
432 DBG_CTX((stderr,
"Start of Objective-C method!\n"));
433 yyextra->code->codify(yytext);
438 yyextra->code->codify(yytext);
442 yyextra->code->codify(yytext);
443 BEGIN(ObjCParamType);
445<ObjCParams,ObjCMethod>";"|"{" {
446 yyextra->code->codify(yytext);
449 if (yyextra->searchingForBody)
451 yyextra->searchingForBody=
FALSE;
452 yyextra->insideBody=
TRUE;
454 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
455 if (!yyextra->curClassName.isEmpty())
457 pushScope(yyscanner,yyextra->curClassName);
458 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
462 yyextra->type.clear();
463 yyextra->name.clear();
466<ObjCParams>{ID}{B}*":" {
467 yyextra->code->codify(yytext);
469<ObjCParamType>{TYPEKW} {
471 yyextra->code->codify(yytext);
473 yyextra->parmType=yytext;
477 yyextra->parmType=yytext;
480 yyextra->code->codify(yytext);
484 yyextra->code->codify(yytext);
485 yyextra->parmName=yytext;
486 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
487 yyextra->parmType.clear();yyextra->parmName.clear();
489<ObjCMethod,ObjCParams,ObjCParamType>{ID} {
492<ObjCMethod,ObjCParams,ObjCParamType>. {
493 yyextra->code->codify(yytext);
495<ObjCMethod,ObjCParams,ObjCParamType>\n {
498<ReadInclude>[^\n\">]+/(">"|"\"") {
509 DBG_CTX((stderr,
"===== yes %s is ambiguous\n",yytext));
511 if (!name.isEmpty() && yyextra->sourceFileDef)
517 auto it = std::find_if(fn->begin(),
519 [&sfd=yyextra->sourceFileDef]
521 { return sfd->isIncluded(lfd->absFilePath()); });
522 found = it!=fn->end();
538 yyextra->code->codify(yytext);
540 char c=(char)yyinput(yyscanner);
543 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)
547<Body,Bases>^[ \t]*"#" {
549 yyextra->lastSkipCppContext = YY_START;
550 yyextra->code->codify(yytext);
554 yyextra->code->codify(yytext);
555 yyextra->lastStringContext=YY_START;
556 BEGIN( SkipString ) ;
559 yyextra->code->codify(yytext);
561<SkipCPP>[^\n\/\\\"]+ {
562 yyextra->code->codify(yytext);
567<SkipCPP>{CPPC}/[^/!] {
570<Body,FuncCall,MemberCall,MemberCall2>"}" {
571 yyextra->theVarContext.popScope();
572 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
573 yyextra->type.clear();
574 yyextra->name.clear();
576 if (!yyextra->scopeStack.empty())
578 int scope = yyextra->scopeStack.top();
579 yyextra->scopeStack.pop();
587 yyextra->code->codify(yytext);
589 DBG_CTX((stderr,
"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount));
590 if (--yyextra->bodyCurlyCount<=0)
592 yyextra->insideBody=
FALSE;
593 yyextra->currentMemberDef=
nullptr;
594 if (yyextra->currentDefinition)
595 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
599<Body,ClassVar>"@end" {
600 DBG_CTX((stderr,
"End of objc scope fd=%s\n",
qPrint(yyextra->sourceFileDef->name())));
601 if (yyextra->sourceFileDef)
603 const FileDef *fd=yyextra->sourceFileDef;
606 DBG_CTX((stderr,
"insideObjC=%d\n",yyextra->insideObjC));
610 yyextra->insideObjC =
FALSE;
612 if (yyextra->insideBody)
614 yyextra->theVarContext.popScope();
616 if (!yyextra->scopeStack.empty())
618 int scope = yyextra->scopeStack.top();
619 yyextra->scopeStack.pop();
626 yyextra->insideBody=
FALSE;
630 yyextra->code->codify(yytext);
633 yyextra->currentMemberDef=
nullptr;
634 if (yyextra->currentDefinition)
635 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
virtual const QCString & name() const =0
bool endsWith(const char *s) const
638<ClassName,ClassVar>";" {
639 if (yyextra->lang==SrcLangExt::CSharp)
641 yyextra->code->codify(yytext);
642 yyextra->skipCodify =
true;
647 yyextra->code->codify(yytext);
648 yyextra->searchingForBody=
FALSE;
652<ClassName,ClassVar>[*&^%]+ {
653 yyextra->type=yyextra->curClassName;
654 yyextra->name.clear();
655 yyextra->code->codify(yytext);
658<ClassName>"__declspec"{B}*"("{B}*{ID}{B}*")" {
660 yyextra->code->codify(yytext);
663<ClassName>{ID}("."{ID})* |
664<ClassName>{ID}("::"{ID})* {
665 if (yyextra->lang==SrcLangExt::CSharp)
666 yyextra->curClassName=
substitute(yytext,
".",
"::");
668 yyextra->curClassName=yytext;
670 if (yyextra->curClassName==
"alignas")
673 yyextra->code->codify(yytext);
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
684 yyextra->bracketCount=1;
685 yyextra->code->codify(yytext);
688<AlignAs>\n { yyextra->yyLineNr++;
691<AlignAs>. { yyextra->code->codify(yytext); }
692<AlignAsEnd>"(" { yyextra->code->codify(yytext);
693 yyextra->bracketCount++;
696 yyextra->code->codify(yytext);
697 if (--yyextra->bracketCount<=0)
702<AlignAsEnd>\n { yyextra->yyLineNr++;
705<AlignAsEnd>. { yyextra->code->codify(yytext); }
706<ClassName>{ID}("\\"{ID})* {
707 yyextra->curClassName=
substitute(yytext,
"\\",
"::");
709 pushScope(yyscanner,yyextra->curClassName);
714<ClassName>{ID}{B}*"("{ID}")" {
717 pushScope(yyscanner,yyextra->curClassName);
QCString removeRedundantWhiteSpace(const QCString &s)
722<PackageName>{ID}("."{ID})* {
723 yyextra->curClassName=
substitute(yytext,
".",
"::");
724 DBG_CTX((stderr,
"found package: %s\n",
qPrint(yyextra->curClassName)));
732<ClassVar>("extends"|"implements") {
736 yyextra->curClassBases.clear();
739<ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") {
740 DBG_CTX((stderr,
"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,
qPrint(yyextra->curClassName)));
744 BEGIN( CppCliTypeModifierFollowup );
747 yyextra->type = yyextra->curClassName;
748 yyextra->name = yytext;
749 if (yyextra->insideBody)
751 addVariable(yyscanner,yyextra->type,yyextra->name);
755<ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*":"{B}* {
757 yyextra->curClassBases.clear();
760<PackageName>[ \t]*";" |
761<Bases>^{Bopt}/"@"{ID} |
762<Bases,ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*"{"{B}* {
763 yyextra->theVarContext.pushScope();
764 if (!yyextra->skipCodify) yyextra->code->codify(yytext);
765 yyextra->skipCodify =
false;
766 if (YY_START==ClassVar && yyextra->curClassName.isEmpty())
768 yyextra->curClassName = yyextra->name;
770 if (yyextra->searchingForBody)
772 yyextra->searchingForBody=
FALSE;
773 yyextra->insideBody=
TRUE;
775 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
776 if (!yyextra->curClassName.isEmpty())
778 DBG_CTX((stderr,
"** scope stack push CLASSBLOCK\n"));
780 pushScope(yyscanner,yyextra->curClassName);
781 DBG_CTX((stderr,
"***** yyextra->curClassName=%s\n",
qPrint(yyextra->curClassName)));
782 if (yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->curClassName,
true)==
nullptr)
784 DBG_CTX((stderr,
"Adding new class %s\n",
qPrint(yyextra->curClassName)));
787 for (
const auto &s : yyextra->curClassBases)
790 auto it = yyextra->codeClassMap.find(s);
791 if (it!=yyextra->codeClassMap.end())
795 if (bcd==
nullptr) bcd=yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,s,
true);
796 if (bcd && bcd->
name()!=yyextra->curClassName)
798 var.localDef()->insertBaseClass(bcd->
name());
801 yyextra->codeClassMap.emplace(yyextra->curClassName.str(),std::move(var));
807 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
810 yyextra->curClassName.clear();
811 yyextra->curClassBases.clear();
ClassDef * toClassDef(Definition *d)
814<Bases>"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" {
816 yyextra->code->codify(yytext);
819<Bases>{SEP}?({ID}{SEP})*{ID} {
820 DBG_CTX((stderr,
"%s:addBase(%s)\n",
qPrint(yyextra->curClassName),yytext));
821 yyextra->curClassBases.emplace_back(yytext);
825 yyextra->code->codify(yytext);
826 if (!yyextra->insideObjC)
828 yyextra->sharpCount=1;
833 yyextra->insideProtocolList=
TRUE;
837 yyextra->code->codify(yytext);
838 yyextra->insideProtocolList=
FALSE;
841 yyextra->code->codify(yytext);
842 ++yyextra->sharpCount;
845 yyextra->code->codify(yytext);
846 if (--yyextra->sharpCount<=0)
850 yyextra->code->codify(yytext);
851 yyextra->lastStringContext=YY_START;
855 yyextra->code->codify(yytext);
856 yyextra->lastStringContext=YY_START;
860 yyextra->code->codify(yytext);
861 yyextra->sharpCount=1;
865 yyextra->code->codify(yytext);
866 ++yyextra->sharpCount;
869 yyextra->code->codify(yytext);
870 if (--yyextra->sharpCount<=0)
876 yyextra->code->codify(yytext);
880<Body>{SCOPEPREFIX}?"operator"{B}*"()"{Bopt}/"(" {
883 yyextra->bracketCount=0;
884 yyextra->args.clear();
885 yyextra->name+=yytext;
888<Body>{SCOPEPREFIX}?"operator"/"(" {
891 yyextra->bracketCount=0;
892 yyextra->args.clear();
893 yyextra->name+=yytext;
896<Body>{SCOPEPREFIX}?"operator"[^a-z_A-Z0-9\(\n]+/"(" {
899 yyextra->bracketCount=0;
900 yyextra->args.clear();
901 yyextra->name+=yytext;
904<Body,TemplDecl>("template"|"generic")/([^a-zA-Z0-9]) {
908 yyextra->insideTemplate=
TRUE;
909 yyextra->sharpCount=0;
911<Body>"concept"{BN}+ {
917<Body>"using"{BN}+"namespace"{BN}+ {
929<Body>"module"/{B}*[:;]? {
930 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
931 if (!yyextra->type.isEmpty() || !yyextra->name.isEmpty()) REJECT;
937<Body>"import"/{B}*[<":]? {
938 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
944<ConceptName>{ID}("::"{ID})* {
947<ConceptName>"=" {
codifyLines(yyscanner,yytext); BEGIN(Body); }
948<UsingName>{ID}(("::"|"."){ID})* {
953<UsingName>\n {
codifyLines(yyscanner,yytext); BEGIN(Body); }
954<UsingName>. {
codifyLines(yyscanner,yytext); BEGIN(Body); }
955<Body,FuncCall>"$"?"this"("->"|".") { yyextra->code->codify(yytext);
956 yyextra->isPrefixedWithThis =
TRUE;
958<Body>{KEYWORD}/([^a-z_A-Z0-9]) {
959 if (yyextra->lang==SrcLangExt::Java &&
qstrcmp(
"internal",yytext) ==0) REJECT;
964 if (text==
"typedef" || text.
find(
"enum ")!=-1)
967 yyextra->name+=yytext;
int find(char c, int index=0, bool cs=TRUE) const
int qstrcmp(const char *str1, const char *str2)
971<Body>{KEYWORD}/{B}* {
977<Body>{KEYWORD}/{BN}*"(" {
982 yyextra->name.clear();yyextra->type.clear();
984<FuncCall>"in"/{BN}* {
985 if (!yyextra->inForEachExpression) REJECT;
990 yyextra->theVarContext.popScope();
991 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
992 yyextra->theVarContext.pushScope();
993 yyextra->name.clear();yyextra->type.clear();
995<Body>{FLOWKW}/{BN}*"(" {
999 yyextra->name.clear();yyextra->type.clear();
1000 yyextra->inForEachExpression = (
qstrcmp(yytext,
"for each")==0 ||
qstrcmp(yytext,
"foreach")==0);
1003<Body>{FLOWCONDITION}/{BN}*"(" {
1008 yyextra->name.clear();yyextra->type.clear();
1009 yyextra->inForEachExpression = (strcmp(yytext,
"for each")==0 || strcmp(yytext,
"foreach")==0);
1012<Body>{FLOWKW}/([^a-z_A-Z0-9]) {
1016 if (yyextra->inFunctionTryBlock && (
qstrcmp(yytext,
"catch")==0 ||
qstrcmp(yytext,
"finally")==0))
1018 yyextra->inFunctionTryBlock=
FALSE;
1021<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1026 if (yyextra->inFunctionTryBlock && (strcmp(yytext,
"catch")==0 || strcmp(yytext,
"finally")==0))
1028 yyextra->inFunctionTryBlock=
FALSE;
1031<Body>{FLOWKW}/{B}* {
1036<Body>{FLOWCONDITION}/{B}* {
1043 yyextra->code->codify(yytext);
1044 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1045 yyextra->bracketCount--;
1046 yyextra->parmType = yyextra->name;
1049<Body>"\\)"|"\\(" {
1050 yyextra->code->codify(yytext);
1052<Body>[\\|\)\+\-\/\%\~\!] {
1053 yyextra->code->codify(yytext);
1054 yyextra->name.clear();yyextra->type.clear();
1057 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1058 yyextra->bracketCount--;
1059 if (yyextra->bracketCount<=0)
1065<Body,TemplDecl,ObjCMethod>{TYPEKW}/{B}* {
1067 yyextra->code->codify(yytext);
1070 yyextra->name+=yytext;
1072<Body,TemplDecl,ObjCMethod>{TYPEKWSL}/{B}* {
1073 if (yyextra->lang!=SrcLangExt::Slice)
1080 yyextra->code->codify(yytext);
1083 yyextra->name+=yytext;
1086<Body>"generic"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1088 yyextra->code->codify(yytext);
1090 yyextra->sharpCount=0;
1093<Body>"template"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1095 yyextra->code->codify(yytext);
1097 yyextra->sharpCount=0;
1100<TemplDecl>"class"|"typename" {
1106 yyextra->code->codify(yytext);
1107 yyextra->sharpCount++;
1110 yyextra->code->codify(yytext);
1111 yyextra->sharpCount--;
1112 if (yyextra->sharpCount<=0)
1121 BEGIN( yyextra->lastTemplCastContext );
1123<TemplCast>{ID}("::"{ID})* {
1126<TemplCast>("const"|"volatile"){B}* {
1134<Body,MemberCall2,FuncCall>{CASTKW}{B}*"<" {
1138 yyextra->lastTemplCastContext = YY_START;
1141<Body>"$this->"{SCOPENAME}/{BN}*[;,)\]] {
1144 yyextra->name+=yytext+7;
1146<Body,TemplCast>{SCOPENAME}{B}*"<"[^\n\/\-\.\{\">\(']*">"{ENDIDopt}/{B}* {
1153 yyextra->name+=yytext;
1155<ModuleName,ModuleImport>{MODULE_ID}({BN}*":"{BN}*{MODULE_ID})? {
1157 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
1174<ModuleName>":"{BN}+"private" {
1176 int i=text.
find(
'p');
1182<ModuleName>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1183<ModuleName>. { yyextra->code->codify(yytext); }
1185<ModuleImport>["<] { yyextra->code->codify(yytext); BEGIN(ReadInclude); }
1186<ModuleImport>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1187<ModuleImport>. { yyextra->code->codify(yytext); }
1188<ModuleImport>\n {
codifyLines(yyscanner,yytext); }
1190<Body>{SCOPENAME}/{BN}*[:;,)\]] {
1197 yyextra->name+=yytext;
1199<Body>{ID}("."{ID})+/{BN}+ {
1200 if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
1204 yyextra->name+=yytext;
1211<Body>"export"/{B}* {
1212 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1217<Body>{SCOPENAME}/{B}* {
1224 yyextra->name+=yytext;
1226<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* {
1227 yyextra->code->codify(yytext);
1228 uint32_t s=0;
while (s<(uint32_t)yyleng && !
isId(yytext[s])) s++;
1229 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1232 yyextra->name=std::move(varname);
1234<Body>{SCOPETNAME}{B}*"<"[^\n\/\-\.\{\">]*">"/{BN}*"(" |
1235<Body>{SCOPETNAME}/{BN}*"(" {
1242 yyextra->bracketCount=0;
1243 yyextra->args.clear();
1244 yyextra->name+=yytext;
1247<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} {
1249 uint32_t i=(uint32_t)text.
find(
'R');
1250 yyextra->code->codify(text.
left(i+1));
1252 yyextra->code->codify(yytext+i+1);
1253 yyextra->lastStringContext=YY_START;
1254 yyextra->inForEachExpression =
FALSE;
QCString extractBeginRawStringDelimiter(const char *rawStart)
1258<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit,ClassVar,OldStyleArgs>\" {
1260 yyextra->code->codify(yytext);
1261 yyextra->lastStringContext=YY_START;
1262 yyextra->inForEachExpression =
FALSE;
1263 BEGIN( SkipString );
1265<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{NUMBER} {
1266 if (yyextra->lang!=SrcLangExt::Cpp) REJECT;
1267 yyextra->code->codify(yytext);
1269<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
1271 yyextra->code->codify(yytext);
1272 yyextra->lastStringContext=YY_START;
1273 yyextra->inForEachExpression =
FALSE;
1274 BEGIN( SkipStringS );
1276<SkipString>[^\"\\\r\n]{1,100} {
1277 yyextra->code->codify(yytext);
1279<SkipStringS>[^\'\\\r\n]{1,100} {
1280 yyextra->code->codify(yytext);
1282<SkipString,SkipStringS>{CPPC}|{CCS} {
1283 yyextra->code->codify(yytext);
1286 yyextra->code->codify(yytext);
1287 if (yyextra->lastStringContext!=SkipCPP)
1291 BEGIN( yyextra->lastStringContext );
1294 yyextra->code->codify(yytext);
1296 BEGIN( yyextra->lastStringContext );
1298<SkipString,SkipStringS>\\. {
1299 yyextra->code->codify(yytext);
1301<RawString>{RAWEND} {
1302 yyextra->code->codify(yytext);
1305 BEGIN( yyextra->lastStringContext );
QCString extractEndRawStringDelimiter(const char *rawEnd)
1308<RawString>[^)\n]+ { yyextra->code->codify(yytext); }
1309<RawString>. { yyextra->code->codify(yytext); }
1311<SkipVerbString>[^"\n]+ {
1312 yyextra->code->codify(yytext);
1314<SkipVerbString>\"\" {
1315 yyextra->code->codify(yytext);
1318 yyextra->code->codify(yytext);
1320 BEGIN( yyextra->lastVerbStringContext );
1323 yyextra->code->codify(yytext);
1329 yyextra->code->codify(yytext);
1330 yyextra->name.clear();yyextra->type.clear();
1333 if (yyextra->insideTemplate)
1335 yyextra->sharpCount++;
1337 yyextra->code->codify(yytext);
1340 if (yyextra->insideTemplate)
1342 if (--yyextra->sharpCount<=0)
1344 yyextra->insideTemplate=
FALSE;
1347 yyextra->code->codify(yytext);
1349<Body,MemberCall,MemberCall2,FuncCall,OldStyleArgs>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
1351 yyextra->code->codify(yytext);
1359 yyextra->code->codify(yytext);
1360 yyextra->memCallContext = YY_START;
1361 BEGIN( MemberCall );
1363<MemberCall>{SCOPETNAME}/{BN}*"(" {
1364 if (yyextra->theCallContext.getScope().globalDef())
1371 yyextra->name.clear();
1377 yyextra->name.clear();
1379 yyextra->type.clear();
1380 if (yyextra->memCallContext==Body)
1386 BEGIN(yyextra->memCallContext);
1389<MemberCall>{SCOPENAME}/{B}* {
1390 if (yyextra->theCallContext.getScope().globalDef())
1392 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1398 yyextra->name.clear();
1402 DBG_CTX((stderr,
"no class context!\n"));
1405 yyextra->name.clear();
1407 yyextra->type.clear();
1408 BEGIN(yyextra->memCallContext);
1411 if (yyextra->insideObjC && *yytext==
'[')
1413 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
1415 yyextra->contextMap.clear();
1416 yyextra->nameMap.clear();
1417 yyextra->objectMap.clear();
1418 yyextra->wordMap.clear();
1419 yyextra->commentMap.clear();
1420 yyextra->currentCtxId = 0;
1421 yyextra->currentNameId = 0;
1422 yyextra->currentObjId = 0;
1423 yyextra->currentCtx =
nullptr;
1424 yyextra->braceCount = 0;
1430 if (*yytext!=
'{') yyextra->code->codify(yytext);
1431 yyextra->saveName = yyextra->name;
1432 yyextra->saveType = yyextra->type;
1433 if (*yytext!=
'[' && !yyextra->type.isEmpty())
1440 addVariable(yyscanner,yyextra->type,yyextra->name);
1442 yyextra->name.clear();
1444 if (*yytext==
';' || *yytext==
'=' || *yytext==
'{')
1446 yyextra->type.clear();
1447 yyextra->name.clear();
1449 else if (*yytext==
'[')
1451 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1453 yyextra->args.clear();
1454 yyextra->parmType.clear();
1455 yyextra->parmName.clear();
1463<Body,FuncCall,BodyVar>"{" {
1464 yyextra->theVarContext.pushScope();
1465 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1466 yyextra->bracketCount = 0;
1469 if (yyextra->type.find(
"enum ")!=-1)
1471 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1477 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1481 if (yyextra->searchingForBody)
1483 yyextra->searchingForBody=
FALSE;
1484 yyextra->insideBody=
TRUE;
1486 yyextra->code->codify(yytext);
1487 if (yyextra->insideBody)
1489 yyextra->bodyCurlyCount++;
1491 yyextra->type.clear();
1492 yyextra->name.clear();
1495<ObjCCall,ObjCMName>"["|"{" {
1497 yyextra->currentCtx->format+=*yytext;
1501<ObjCCall,ObjCMName>"]"|"}" {
1502 yyextra->currentCtx->format+=*yytext;
1505 if (yyextra->currentCtx==
nullptr)
1509 auto it = yyextra->contextMap.find(0);
1510 if (it!=yyextra->contextMap.end())
1512 ctx = it->second.get();
1519<ObjCCall,ObjCMName>{CPPC}.* {
1520 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1522<ObjCCall,ObjCMName>{CCS} {
1523 yyextra->lastObjCCallContext = YY_START;
1524 yyextra->currentCtx->comment.str(yytext);
1525 BEGIN(ObjCCallComment);
1527<ObjCCallComment>{CCE} {
1528 yyextra->currentCtx->comment << yytext;
1529 yyextra->currentCtx->format+=
escapeComment(yyscanner,yyextra->currentCtx->comment.str());
1530 BEGIN(yyextra->lastObjCCallContext);
1532<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
1533<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
1534<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
1535<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
1536<ObjCCall>{ID}({B}*"."{B}*{ID})* {
1537 yyextra->currentCtx->format+=
escapeObject(yyscanner,yytext);
1538 if (yyextra->braceCount==0)
1540 yyextra->currentCtx->objectTypeOrName=yytext;
1541 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1545<ObjCMName>{ID}/{BN}*"]" {
1546 if (yyextra->braceCount==0 &&
1547 yyextra->currentCtx->methodName.isEmpty())
1549 yyextra->currentCtx->methodName=yytext;
1550 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1554 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1557<ObjCMName>{ID}/{BN}*":" {
1558 if (yyextra->braceCount==0)
1560 yyextra->currentCtx->methodName+=yytext;
1561 yyextra->currentCtx->methodName+=
":";
1563 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1565<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1566<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1567<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1568 BEGIN(yyextra->lastStringContext);
1570<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1571<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1572 yyextra->lastStringContext=YY_START;
1575<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+=
"$$"; }
1576<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
1577<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
1578<ObjCSkipStr>"@"/"\"" {
1579 yyextra->currentCtx->format+=yytext;
1581<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext); }
1582<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
1583<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
1586 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1587 yyextra->code->codify(yytext);
1589 yyextra->name = yyextra->saveName;
1590 yyextra->type = yyextra->saveType;
1593 yyextra->code->codify(yytext);
1595<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1596 yyextra->code->codify(yytext);
1598<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1603 yyextra->code->codify(yytext);
1606<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1608 yyextra->parmName=yytext;
1610 yyextra->code->codify(yytext);
1613<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1614 if (yyextra->lang!=SrcLangExt::Slice)
1621 yyextra->parmName=yytext;
1623 yyextra->code->codify(yytext);
1627<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1629 yyextra->parmName=yytext;
1631 yyextra->code->codify(yytext);
1634<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1637 yyextra->parmName=yytext;
1639 yyextra->code->codify(yytext);
1642<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1648 yyextra->parmName=yytext;
1652 yyextra->code->codify(yytext);
1653 yyextra->inForEachExpression =
FALSE;
1656<MemberCall2,FuncCall>, {
1657 yyextra->code->codify(yytext);
1658 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1659 yyextra->parmType.clear();yyextra->parmName.clear();
1661<MemberCall2,FuncCall>"{" {
1662 if (yyextra->bracketCount>0)
1664 yyextra->code->codify(yytext);
1665 yyextra->skipInlineInitContext=YY_START;
1666 yyextra->curlyCount=0;
1674<InlineInit>"{" { yyextra->curlyCount++;
1675 yyextra->code->codify(yytext);
1678 yyextra->code->codify(yytext);
1679 if (--yyextra->curlyCount<=0)
1681 BEGIN(yyextra->skipInlineInitContext);
1688 yyextra->code->codify(yytext);
1690<MemberCall2,FuncCall>"(" {
1691 yyextra->parmType.clear();yyextra->parmName.clear();
1692 yyextra->code->codify(yytext);
1693 yyextra->bracketCount++;
1694 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1695 if (YY_START==FuncCall && !yyextra->insideBody)
1697 yyextra->theVarContext.pushScope();
1700<MemberCall2,FuncCall>{OPERATOR} {
1707 yyextra->parmType.clear();yyextra->parmName.clear();
1709 yyextra->code->codify(yytext);
1711<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1714 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1715 if (yyextra->parmType.isEmpty())
1717 yyextra->parmType=yyextra->parmName;
1718 yyextra->parmName.clear();
1720 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1724 yyextra->parmType = yyextra->parmName;
1725 yyextra->parmName.clear();
1726 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1728 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1729 yyextra->inForEachExpression =
FALSE;
1731 yyextra->code->codify(yytext);
1732 if (--yyextra->bracketCount<=0)
1734 if (yyextra->name.isEmpty())
1744<MemberCall,MemberCall2,FuncCall>[;:] {
1746 if (yyextra->bracketCount<=0)
1753 yyextra->code->codify(yytext);
1756<CallEnd>[ \t\n]* {
codifyLines(yyscanner,yytext); }
1759 yyextra->bracketCount=0;
1760 if (*yytext==
';') yyextra->searchingForBody=
FALSE;
1761 if (!yyextra->type.isEmpty())
1763 DBG_CTX((stderr,
"add variable yyextra->type=%s yyextra->name=%s)\n",
qPrint(yyextra->type),
qPrint(yyextra->name)));
1764 addVariable(yyscanner,yyextra->type,yyextra->name);
1766 yyextra->parmType.clear();yyextra->parmName.clear();
1768 if (*yytext==
';' || yyextra->insideBody)
1770 if (!yyextra->insideBody)
1772 yyextra->theVarContext.popScope();
1774 yyextra->name.clear();yyextra->type.clear();
1779 yyextra->bracketCount=0;
1783<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1788<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1789 if (yyextra->insideBody)
1791 yyextra->theVarContext.pushScope();
1793 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1795 yyextra->parmType.clear();yyextra->parmName.clear();
1796 int index = yyextra->name.findRev(
"::");
1797 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1801 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1807 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1813 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1818 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1821 yytext[yyleng-1]=
'\0';
1823 if (!cv.stripWhiteSpace().isEmpty())
1833 yyextra->code->codify(
"{");
1834 if (yyextra->searchingForBody)
1836 yyextra->searchingForBody=
FALSE;
1837 yyextra->insideBody=
TRUE;
1839 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1840 yyextra->type.clear(); yyextra->name.clear();
static NamespaceDefMutable * globalScope
QCString & prepend(const char *s)
1845 yyextra->code->codify(yytext);
1847 yyextra->inFunctionTryBlock=
TRUE;
1849<CallEnd>"requires" {
1851 yyextra->code->codify(yytext);
1855 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1861 yyextra->parmName=yytext;
1863 BEGIN(OldStyleArgs);
1867 yyextra->parmName=yytext;
1871 yyextra->code->codify(yytext);
1872 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1873 if (*yytext==
';') yyextra->parmType.clear();
1874 yyextra->parmName.clear();
1876<CallEnd,OldStyleArgs>"#" {
1878 yyextra->lastSkipCppContext = Body;
1879 yyextra->code->codify(yytext);
1884 if (!yyextra->insideBody)
1886 yyextra->theVarContext.popScope();
1888 yyextra->name.clear();yyextra->args.clear();
1889 yyextra->parmType.clear();yyextra->parmName.clear();
1893 yyextra->code->codify(yytext);
1894 yyextra->type.clear(); yyextra->name.clear();
1898 yyextra->code->codify(yytext);
1899 if (yyextra->searchingForBody)
1901 yyextra->searchingForBody=
FALSE;
1902 yyextra->insideBody=
TRUE;
1904 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1905 if (yyextra->name.find(
"::")!=-1)
1907 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1913 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1916 yyextra->type.clear(); yyextra->name.clear();
1919<SkipInits>{ID}{B}*"{" {
1921 int bracketPos = text.
find(
'{');
1922 int spacePos = text.
find(
' ');
1923 int len = spacePos==-1 ? bracketPos : spacePos;
1925 yyextra->code->codify(yytext+len);
1933<FuncCall>{ID}/("."|"->") {
1934 yyextra->name=yytext;
1936 BEGIN( MemberCall2 );
1938<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1939 yyextra->code->codify(yytext);
1940 uint32_t s=0;
while (!
isId(yytext[s])) s++;
1941 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1942 yyextra->name=((
QCString)yytext).mid(s,e-s+1);
1943 BEGIN( MemberCall2 );
1945<MemberCall2>{ID}/([ \t\n]*"(") {
1946 if (!yyextra->args.isEmpty())
1950 yyextra->args.clear();
1953<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1955 yyextra->name=yytext;
1957 BEGIN( MemberCall2 );
1959<MemberCall2>"->"|"." {
1964 yyextra->code->codify(yytext);
1965 yyextra->memCallContext = YY_START;
1966 BEGIN( MemberCall );
1968<SkipComment>{CCS}("!"?){CCE} {
1969 yyextra->code->codify(yytext);
1971 BEGIN( yyextra->lastCContext ) ;
1973<SkipComment>{CPPC}|{CCS} {
1974 yyextra->code->codify(yytext);
1976<SkipComment>[^*\/\n]+ {
1977 yyextra->code->codify(yytext);
1979<SkipComment>[ \t]*{CCE} {
1980 yyextra->code->codify(yytext);
1982 if (yyextra->lastCContext==SkipCPP)
1986 BEGIN( yyextra->lastCContext ) ;
1988<SkipCxxComment>[^\r\n]*"\\"[\r]?\n {
1991<SkipCxxComment>[^\r\n]+ {
1992 yyextra->code->codify(yytext);
1998 BEGIN( yyextra->lastCContext ) ;
2001 yyextra->code->codify(yytext);
2003<MemberCall>[^a-z_A-Z0-9(\n] {
2004 yyextra->code->codify(yytext);
2005 yyextra->type.clear();
2006 yyextra->name.clear();
2007 BEGIN(yyextra->memCallContext);
2009<*>\n({B}*{CPPC}[!/][^\n]*\n)+ {
2010 if (YY_START==SkipCPP) REJECT;
2015 if (YY_START==SkipCxxComment)
2017 BEGIN( yyextra->lastCContext ) ;
2022 BEGIN( yyextra->lastSkipCppContext ) ;
2025<*>\n{B}*{CPPC}"@"[{}].*\n {
2030 if (YY_START==SkipCxxComment)
2032 BEGIN( yyextra->lastCContext ) ;
2035<*>\n{B}*{CCS}"@"[{}] {
2037 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2039 yyextra->lastCContext = YY_START ;
2045<*>^{B}*{CPPC}"@"[{}].*\n {
2051<*>^{B}*{CCS}"@"[{}] {
2053 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2055 yyextra->lastCContext = YY_START ;
2058 yyextra->code->codify(yytext);
2061<*>^{B}*{CPPC}[!/][^\n]* {
2066<*>{CPPC}[!/][^\n]* {
2067 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2072<*>\n{B}*{CCS}[!*]/{NCOMM} {
2074 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2076 yyextra->lastCContext = YY_START ;
2082<*>^{B}*{CCS}"*"[*]+/[^/] {
2084 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2086 yyextra->lastCContext = YY_START ;
2090 yyextra->code->codify(yytext);
#define Config_getBool(name)
2093<*>^{B}*{CCS}[!*]/{NCOMM} {
2095 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2097 yyextra->lastCContext = YY_START ;
2100 yyextra->code->codify(yytext);
2103<*>{CCS}[!*]/{NCOMM} {
2104 if (YY_START==SkipString) REJECT;
2106 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2108 yyextra->lastCContext = YY_START ;
2111 yyextra->code->codify(yytext);
2114<*>{CCS}("!"?){CCE} {
2115 if (YY_START==SkipString) REJECT;
2118 yyextra->code->codify(yytext);
2121<SkipComment>[^\*\n]+ {
2122 yyextra->code->codify(yytext);
2126 yyextra->code->codify(yytext);
2128 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2130 yyextra->lastCContext = YY_START ;
2132 BEGIN( SkipComment ) ;
2136 yyextra->code->codify(yytext);
2137 yyextra->lastVerbStringContext=YY_START;
2138 BEGIN(SkipVerbString);
2142 yyextra->code->codify(yytext);
2143 yyextra->lastCContext = YY_START ;
2144 BEGIN( SkipCxxComment ) ;
2147 if (yytext[0]==
'(') yyextra->bracketCount++;
2148 yyextra->code->codify(yytext);
2149 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2152 if (yytext[0]==
')') yyextra->bracketCount--;
2153 yyextra->code->codify(yytext);
2154 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2160 yyextra->code->codify(yytext);
2163 yyextra->code->codify(yytext);
2180 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2188 DBG_CTX((stderr,
"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n",
2189 qPrint(ltype),
qPrint(lname),yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>"));
2190 auto it = yyextra->codeClassMap.find(ltype.
str());
2191 if (it!=yyextra->codeClassMap.end())
2194 yyextra->theVarContext.addVariable(lname,std::move(it->second));
2198 auto findVariableType = [&yyscanner,&yyg,<ype,&lname,&name](
const Definition *d) ->
const ClassDef *
2200 const ClassDef *varDef = yyextra->symbolResolver.resolveClass(d,ltype,
true);
2207 else if ((i=ltype.find(
'<'))!=-1)
2214 const ClassDef *varDef = findVariableType(yyextra->currentDefinition);
2215 if (varDef==
nullptr)
2217 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2219 varDef = findVariableType(namespaceDef);
2223 if (varDef==
nullptr)
2225 if (!yyextra->theVarContext.atGlobalScope())
2229 DBG_CTX((stderr,
"** addVariable: dummy context for '%s'\n",
qPrint(lname)));
2234 DBG_CTX((stderr,
"** addVariable: not adding variable!\n"));
2245 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2246 yyextra->scopeNameLengthStack.push_back(
int(yyextra->scopeName.length()));
2247 if (yyextra->scopeName.isEmpty() ||
leftScopeMatch(s,yyextra->scopeName))
2249 yyextra->scopeName = s;
2253 yyextra->scopeName +=
"::";
2254 yyextra->scopeName += s;
2263 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2264 if (!yyextra->scopeNameLengthStack.empty())
2266 int length = yyextra->scopeNameLengthStack.back();
2267 yyextra->scopeNameLengthStack.pop_back();
2268 yyextra->scopeName.resize(length);
2274 DBG_CTX((stderr,
"popScope() result: '%s'\n",
qPrint(yyextra->scopeName)));
2279 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2282 if (yyextra->searchCtx)
2303 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2309 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
2310 if (ts!=-1 && te!=-1 && te>ts)
2315 while (!yyextra->scopeNameLengthStack.empty())
2319 yyextra->scopeName.clear();
2321 while ((i=n.
find(
"::"))!=-1)
2327 DBG_CTX((stderr,
"--->New class scope '%s'\n",
qPrint(yyextra->scopeName)));
2332 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2333 while (!yyextra->foldStack.empty())
2335 const Definition *dd = yyextra->foldStack.back();
2338 yyextra->code->endFold();
2340 yyextra->foldStack.pop_back();
2355 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2364 if (endLine!=-1 && startLine!=endLine &&
2372 (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
2380 yyextra->code->startFold(yyextra->yyLineNr,
"",
"");
2384 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2388 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2393 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2397 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2399 yyextra->foldStack.push_back(d);
2411 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2413 if (yyextra->sourceFileDef && yyextra->lineNumbers)
2419 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
2421 DBG_CTX((stderr,
"%s:startCodeLine(%d)=%p\n",
qPrint(yyextra->sourceFileDef->name()),yyextra->yyLineNr,(
void*)d));
2422 if (!yyextra->includeCodeFragment && d)
2424 yyextra->currentDefinition = d;
2425 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
2426 yyextra->insideBody =
FALSE;
2427 yyextra->searchingForBody =
TRUE;
2429 yyextra->type.
clear();
2430 yyextra->name.clear();
2431 yyextra->args.clear();
2432 yyextra->parmType.clear();
2433 yyextra->parmName.clear();
2434 DBG_CTX((stderr,
"Real scope: '%s'\n",
qPrint(yyextra->realScope)));
2435 yyextra->bodyCurlyCount = 0;
2437 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
2438 if (yyextra->currentMemberDef)
2441 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
2442 yyextra->currentMemberDef->getOutputFileBase(),
2443 yyextra->currentMemberDef->anchor(),
2444 yyextra->yyLineNr,!yyextra->includeCodeFragment);
2452 QCString(),yyextra->yyLineNr,!yyextra->includeCodeFragment);
2464 !yyextra->includeCodeFragment);
2467 DBG_CTX((stderr,
"startCodeLine(%d)\n",yyextra->yyLineNr));
2468 yyextra->code->startCodeLine(yyextra->yyLineNr);
2469 yyextra->insideCodeLine =
true;
2470 if (yyextra->currentFontClass)
2472 yyextra->code->startFontClass(yyextra->currentFontClass);
2480 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2481 DBG_CTX((stderr,
"endCodeLine(%d)\n",yyextra->yyLineNr));
2483 yyextra->code->endCodeLine();
2484 yyextra->insideCodeLine =
false;
2489 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2490 const char * fc = yyextra->currentFontClass;
2491 if (yyextra->insideCodeLine)
2495 if (yyextra->yyLineNr<yyextra->inputLines)
2497 yyextra->currentFontClass = fc;
2507 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2508 DBG_CTX((stderr,
"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,
qPrint(text)));
2510 const char *p=text.
data(),*sp=p;
2516 while ((c=*p++) && c!=
'\n');
2519 yyextra->yyLineNr++;
2520 size_t l =
static_cast<size_t>(p-sp-1);
2521 yyextra->code->codify(
QCString(sp,l));
2526 yyextra->code->codify(sp);
2535 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2536 if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
2554 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2556 yyextra->tooltipManager.addTooltip(d);
2561 if (!sourceTooltips)
2566 const char *p=text.
data();
2571 while ((c=*p++) && c!=
'\n') { }
2574 yyextra->yyLineNr++;
2590 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2591 if (yyextra->name==
"const") { yyextra->name.clear();
return; }
2592 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2593 yyextra->type += yyextra->name ;
2594 yyextra->name.clear() ;
2595 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2596 yyextra->type += yyextra->args ;
2597 yyextra->args.clear() ;
2602 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2603 if (yyextra->parmName==
"const") { yyextra->parmName.clear();
return; }
2604 if (!yyextra->parmType.isEmpty()) yyextra->parmType +=
' ' ;
2605 yyextra->parmType += yyextra->parmName ;
2606 yyextra->parmName.clear() ;
2612 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2613 if (yyextra->sourceFileDef && !name.
isEmpty())
2618 yyextra->theUsingContext.emplace(name.
str(),nd);
2625 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2628 yyextra->parmName = a.name;
2629 yyextra->parmType = a.type;
2630 int i = yyextra->parmType.find(
'*');
2631 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2632 i = yyextra->parmType.find(
'&');
2633 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2634 yyextra->parmType.stripPrefix(
"const ");
2635 yyextra->parmType=yyextra->parmType.stripWhiteSpace();
2636 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
2642 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2643 DBG_CTX((stderr,
"stripClassName(scope=%s,type=%s) scopeName=%s\n",
2651 QCString clName=className+templSpec;
2653 if (!yyextra->scopeName.isEmpty())
2655 cd=yyextra->symbolResolver.resolveClass(d,yyextra->scopeName+
"::"+clName,
true);
2659 cd=yyextra->symbolResolver.resolveClass(d,clName,
true);
2661 DBG_CTX((stderr,
"stripClass trying '%s' = %p\n",
qPrint(clName),(
void*)cd));
2673 if (name.
isEmpty())
return nullptr;
2674 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2675 DBG_CTX((stderr,
"setCallContextForVar(%s) yyextra->scopeName=%s\n",
qPrint(name),
qPrint(yyextra->scopeName)));
2677 int scopeEnd = name.
findRev(
"::");
2684 if (mcd && !locName.
isEmpty())
2697 if (mnd && !locName.
isEmpty())
2713 DBG_CTX((stderr,
"local variable?\n"));
2717 yyextra->theCallContext.setScope(*mcv);
2722 DBG_CTX((stderr,
"class member? scope=%s\n",
qPrint(yyextra->scopeName)));
2732 if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=
CLASSBLOCK)
2749 const std::unique_ptr<MemberDef> &md=mn->
front();
2750 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2757 else if (mn->
size()>1)
2759 for (
const auto &md : *mn)
2768 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2771 DBG_CTX((stderr,
"returning member %s in source file %s\n",
qPrint(md->name()),
qPrint(yyextra->sourceFileDef->name())));
2783 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2784 const Definition *d = yyextra->theCallContext.getScope().globalDef();
2807 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2808 DBG_CTX((stderr,
"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",
qPrint(c),
qPrint(m),varOnly));
2813 DBG_CTX((stderr,
"scopeNameLengthStack.size()=%zu\n",yyextra->scopeNameLengthStack.size()));
2814 if (!result.
found && !yyextra->scopeNameLengthStack.empty() && c==yyextra->scopeName)
2816 QCString localName = yyextra->scopeName.
mid(yyextra->scopeNameLengthStack[0]+2);
2817 auto it = yyextra->codeClassMap.
find(localName.
str());
2818 if (it!=yyextra->codeClassMap.end())
2825 DBG_CTX((stderr,
"trying lookup via base class %s\n",
qPrint(bcName)));
2828 if (result.
found)
break;
2838 if (yyextra->exampleBlock)
2842 anchor.
sprintf(
"a%d",yyextra->anchorCount);
2844 qPrint(yyextra->exampleFile)));
2846 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
2849 yyextra->anchorCount++;
2863 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n",
2864 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,yyextra->insideBody));
2866 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
2867 yyextra->insideBody && yyextra->collectXRefs)
2889 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2890 DBG_CTX((stderr,
"getLink(%s,%s) yyextra->curClassName=%s\n",
2896 if (!yyextra->curClassName.isEmpty())
2899 c.
prepend(yyextra->curClassName);
2913 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2915 if (!scopeName.
isEmpty() && scopeName[0]==
'~')
2917 scopeName=scopeName.
mid(1);
2921 yyextra->code->codify(
"~");
2924 if (yyextra->insideProtocolList)
2928 if (yyextra->lang==SrcLangExt::PHP)
2932 else if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
2936 if (yyextra->currentDefinition==
nullptr && !yyextra->scopeName.isEmpty())
2938 scopeName = yyextra->scopeName+
"::"+scopeName;
2944 DBG_CTX((stderr,
"generateClassOrGlobalLink(name=%s) yyextra->scopeName=%s scopeName=%s\n",
qPrint(scName),
qPrint(yyextra->scopeName),
qPrint(scopeName)));
2945 if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(scopeName))==
nullptr)
2947 int i=scopeName.
find(
'<');
2949 if (i!=-1) bareName = bareName.
left(i);
2951 auto checkForSymbol = [&yyg,&bareName,&scopeName](
const Definition *
parent,
2954 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,scopeName,
QCString(),
false,
true);
2955 DBG_CTX((stderr,
"non-local variable name=%s sym=%s!\n",
2956 qPrint(scopeName),sym_?
qPrint(sym_->name()):
"<none>"));
2957 if (sym_==
nullptr && !bareName.
isEmpty())
2960 if (bareName!=scopeName)
2962 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,bareName,
QCString(),
false,
true);
2966 const Definition *d = yyextra->currentDefinition;
2967 DBG_CTX((stderr,
"d=%s yyextra->sourceFileDef=%s\n",d?
qPrint(d->
name()):
"<none>",yyextra->sourceFileDef?
qPrint(yyextra->sourceFileDef->name()):
"<none>"));
2968 checkForSymbol(d,sym);
2977 checkForSymbol(nd,sym);
2985 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2987 checkForSymbol(namespaceDef,sym);
3009 DBG_CTX((stderr,
"is found as a type sym=%s nd=%s\n",
3014 if (
getLink(yyscanner,yyextra->scopeName,scName,ol,scName,varOnly))
3022 DBG_CTX((stderr,
"local variable!\n"));
3026 yyextra->theCallContext.setScope(*lcd);
3037 DBG_CTX((stderr,
"is a local variable sym=%p!\n",(
void*)sym));
3039 yyextra->isPrefixedWithThis =
FALSE;
3044 if (yyextra->exampleBlock)
3048 anchor.
sprintf(
"_a%d",yyextra->anchorCount);
3049 DBG_CTX((stderr,
"addExampleClass(%s,%s,%s)\n",
qPrint(anchor),
qPrint(yyextra->exampleName),
3050 qPrint(yyextra->exampleFile)));
3054 if (cdm && cdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3057 yyextra->anchorCount++;
3063 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3066 yyextra->anchorCount++;
3080 yyextra->currentMemberDef && yyextra->collectXRefs)
3089 DBG_CTX((stderr,
"class %s not linkable! cd=%p typeOnly=%d\n",
qPrint(scName),(
void*)sym,typeOnly));
3090 if (!isLocal && (md || (!sym && !typeOnly)))
3095 DBG_CTX((stderr,
"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%s\n",
qPrint(scName),(
void*)md,yyextra->currentDefinition ?
qPrint(yyextra->currentDefinition->name()) :
"<none>"));
3096 if (md && yyextra->currentDefinition)
3098 DBG_CTX((stderr,
"%s accessible from %s? %d md->getOuterScope=%s\n",
3099 qPrint(md->name()),
qPrint(yyextra->currentDefinition->name()),
3100 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md),
3101 qPrint(md->getOuterScope()->name())));
3104 if (md && yyextra->currentDefinition &&
3105 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md)==-1)
3112 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()));
3113 if (md->isLinkable())
3117 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3127 DBG_CTX((stderr,
"not found!\n"));
3138 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3142 DBG_CTX((stderr,
"type='%s' args='%s' class=%s\n",
3146 if (yyextra->exampleBlock)
3150 anchor.
sprintf(
"a%d",yyextra->anchorCount);
3152 qPrint(yyextra->exampleFile)));
3154 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3157 yyextra->anchorCount++;
3171 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",
3172 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,(
void*)xmd,yyextra->insideBody));
3174 if (xmd->templateMaster()) xmd = xmd->templateMaster();
3176 if (xmd->isLinkable())
3179 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
3180 yyextra->insideBody && yyextra->collectXRefs)
3200 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3205 DBG_CTX((stderr,
"generateClassMemberLink(class=%s,member=%s)=%p\n",
qPrint(def->
name()),
qPrint(memName),(
void*)xmd));
3243 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3244 DBG_CTX((stderr,
"generateMemberLink(object=%s,mem=%s) classScope=%s\n",
3247 if (varName.
isEmpty())
return;
3255 DBG_CTX((stderr,
"Class found!\n"));
3258 DBG_CTX((stderr,
"Found result!\n"));
3265 if (
getLink(yyscanner,bcName,memName,ol))
3267 DBG_CTX((stderr,
"Found result!\n"));
3276 const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->scopeName,
true);
3279 DBG_CTX((stderr,
"Found class %s for variable '%s'\n",
qPrint(yyextra->scopeName),
qPrint(varName)));
3293 for (
const auto &vmd : *vmn)
3295 if (vmd->getClassDef()==jcd)
3297 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3310 DBG_CTX((stderr,
"There is a variable with name '%s'\n",
qPrint(varName)));
3311 for (
const auto &vmd : *vmn)
3313 if (vmd->getClassDef()==vcd)
3315 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3334 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3337 DBG_CTX((stderr,
"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,
qPrint(name),
qPrint(yyextra->scopeName)));
3338 if (!
getLink(yyscanner,yyextra->scopeName,name,ol,varName))
3346 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3348 QCString locScope=yyextra->scopeName;
3350 if (yyextra->lang==SrcLangExt::PHP && locFunc.
startsWith(
"self::")) locFunc=locFunc.
mid(4);
3353 QCString funcWithFullScope=locFunc;
3358 if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() &&
3359 funcName==yyextra->currentMemberDef->localName() &&
3360 yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr &&
3372 if (i==-1) i=locFunc.
findRev(
"."),len=1;
3373 if (i==-1) i=locFunc.
findRev(
"\\"),len=1;
3376 funcScope=locFunc.
left(i);
3378 int ts=locScope.
find(
'<');
3380 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3381 if (ts!=-1 && te!=-1 && te>ts)
3386 ts=funcScope.
find(
'<');
3388 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3389 if (ts!=-1 && te!=-1 && te>ts)
3392 funcScope=funcScope.
left(ts)+funcScope.
right(funcScope.
length()-te-1);
3396 funcWithScope = funcScope+
"::"+locFunc;
3399 fullScope=locScope+
"::"+funcScope;
3404 funcWithFullScope = locScope+
"::"+funcWithScope;
3410 auto it = yyextra->codeClassMap.find(fullScope.
str());
3411 if (it!=yyextra->codeClassMap.end())
3418 if (
getLink(yyscanner,bcName,locFunc,ol,funcName))
3427 if (!locScope.
isEmpty() && fullScope!=locScope)
3429 auto it = yyextra->codeClassMap.find(locScope.
str());
3430 if (it!=yyextra->codeClassMap.end())
3437 if (
getLink(yyscanner,bcName,funcWithScope,ol,funcName))
3445 if (!
getLink(yyscanner,locScope,funcWithScope,ol,funcName))
3456 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3457 const char *p=yyextra->inputString;
3463 if (c==
'\n') count++;
3465 if (p>yyextra->inputString && *(p-1)!=
'\n')
3474 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3475 if (yyextra->currentFontClass)
3477 yyextra->code->endFontClass();
3478 yyextra->currentFontClass=
nullptr;
3480 if (specialComment && yyextra->insideSpecialComment)
3482 yyextra->code->endSpecialComment();
3483 yyextra->insideSpecialComment =
false;
3489 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3493 yyextra->code->startSpecialComment();
3494 yyextra->insideSpecialComment =
true;
3496 yyextra->code->startFontClass(s);
3497 yyextra->currentFontClass=s;
3505 if (ctx==
nullptr)
return;
3506 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3510 DBG_CTX((stderr,
"writeObjCMethodCall(%s) obj=%s method=%s\n",
3519 DBG_CTX((stderr,
" object is local variable\n"));
3527 DBG_CTX((stderr,
" class=%p method=%p\n",(
void*)cd,(
void*)ctx->
method));
3538 char skipChar =
' ';
3563 yyextra->code->codify(
"$");
3571 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3573 int refId=refIdStr.
toInt();
3574 auto it = yyextra->nameMap.find(refId);
3575 if (it!=yyextra->nameMap.end())
3581 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3593 DBG_CTX((stderr,
"Invalid name: id=%d\n",refId));
3600 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3602 int refId=refIdStr.
toInt();
3603 auto it = yyextra->objectMap.find(refId);
3604 if (it!=yyextra->objectMap.end())
3609 if (yyextra->currentDefinition &&
3626 else if (
object==
"super")
3628 if (yyextra->currentDefinition &&
3655 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3668 int dotPos=
object.find(
'.',pp);
3669 int len =
static_cast<int>(
object.length());
3670 if (dotPos==-1) dotPos=len;
3671 const Definition *scope = yyextra->currentDefinition;
3678 if (fragmentStripped==
"self")
3691 const Definition *symbol = yyextra->symbolResolver.resolveSymbol(scope,fragmentStripped,
QCString(),
false,
true);
3697 ctx->
method = yyextra->symbolResolver.getTypedef();
3721 dotPos=
object.find(
'.',pp);
3722 if (dotPos==-1) dotPos=len;
3731 else if (ctx->
method==
nullptr)
3734 DBG_CTX((stderr,
"yyextra->currentDefinition=%p\n",(
void*)yyextra->currentDefinition));
3735 if (yyextra->currentDefinition &&
3756 DBG_CTX((stderr,
"Invalid object: id=%d\n",refId));
3763 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3765 int refId=refIdStr.
toInt();
3766 auto it = yyextra->contextMap.find(refId);
3767 if (it!=yyextra->contextMap.end())
3782 if (mn && mn->
size()==1)
3800 DBG_CTX((stderr,
"Invalid context: id=%d\n",refId));
3807 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3809 int refId=refIdStr.
toInt();
3810 auto it = yyextra->wordMap.find(refId);
3811 if (it!=yyextra->wordMap.end())
3814 bool isKeyword = word==
"self";
3830 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3832 int refId=refIdStr.
toInt();
3833 auto it = yyextra->commentMap.find(refId);
3834 if (it!=yyextra->commentMap.end())
3848 else if (c==
'\'' || c ==
'"')
3865 DBG_CTX((stderr,
"}=(type='%s',name='%s')",
3875 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3877 result.
sprintf(
"$n%d",yyextra->currentNameId);
3878 yyextra->nameMap.emplace(yyextra->currentNameId,s);
3879 yyextra->currentNameId++;
3885 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3887 result.
sprintf(
"$o%d",yyextra->currentObjId);
3888 yyextra->objectMap.emplace(yyextra->currentObjId,s);
3889 yyextra->currentObjId++;
3895 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3897 result.
sprintf(
"$w%d",yyextra->currentWordId);
3898 yyextra->wordMap.emplace(yyextra->currentWordId,s);
3899 yyextra->currentWordId++;
3905 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3907 result.
sprintf(
"$d%d",yyextra->currentCommentId);
3908 yyextra->commentMap.emplace(yyextra->currentCommentId,s);
3909 yyextra->currentCommentId++;
3915 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3916 static const std::unordered_set<std::string> non_cpp_keywords = {
3917 "__assume",
"__super",
"abstract",
"function",
3918 "gcnew",
"gcroot",
"generic",
"get",
3919 "internal",
"null",
"pin_ptr",
"raise",
3920 "remove",
"self",
"set",
"transient",
3923 static const std::unordered_set<std::string> non_java_keywords = {
3924 "alignas",
"alignof",
"and",
"and_eq",
"asm",
3925 "atomic_cancel",
"atomic_commit",
"atomic_noexcept",
"auto",
"bitand",
3926 "bitor",
"bool",
"char8_t",
"char16_t",
"char32_t",
3927 "compl",
"concept",
"consteval",
"constexpr",
"constinit",
3928 "const_cast",
"co_await",
"co_return",
"co_yield",
"decltype",
3929 "delete",
"dynamic_cast",
"explicit",
"export",
"extern",
3930 "friend",
"inline",
"mutable",
"namespace",
"noexcept",
3931 "not",
"not_eq",
"nullptr",
"operator",
"or",
3932 "or_eq",
"reflexpr",
"register",
"reinterpret_cast",
"requires",
3933 "signed",
"sizeof",
"static_assert",
"_Static_assert",
"static_cast",
"struct",
3934 "template",
"thread_local",
"typedef",
"typeid",
"typename",
3935 "union",
"unsigned",
"using",
"virtual",
"wchar_t",
3936 "xor",
"xor_eq",
"override",
"sealed"
3938 bool retval =
false;
3939 switch (yyextra->lang)
3941 case SrcLangExt::Cpp:
3942 retval = (non_cpp_keywords.find(keyword) != non_cpp_keywords.end());
3944 case SrcLangExt::Java:
3945 retval = (non_java_keywords.find(keyword) != non_java_keywords.end());
3958 if (i==-1)
return FALSE;
3960 return kw==
"const_cast" || kw==
"static_cast" || kw==
"dynamic_cast" || kw==
"reinterpret_cast";
3965 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3966 yy_size_t inputPosition = yyextra->inputPosition;
3967 const char *s = yyextra->inputString + inputPosition;
3969 while( c < max_size && *s )
3974 yyextra->inputPosition += c;
3981 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3982 if (yyextra->currentCtx)
3984 yyextra->currentCtx->format+=
QCString().
sprintf(
"$c%d",yyextra->currentCtxId);
3985 if (yyextra->braceCount==0 && YY_START==ObjCCall)
3987 yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1);
3988 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
3990 yyextra->contextStack.push(yyextra->currentCtx);
3994 DBG_CTX((stderr,
"Trying to save NULL context!\n"));
3996 auto newCtx = std::make_unique<ObjCCallCtx>();
3997 newCtx->id = yyextra->currentCtxId;
3998 newCtx->lexState = YY_START;
3999 newCtx->braceCount = yyextra->braceCount;
4000 newCtx->objectType =
nullptr;
4001 newCtx->objectVar =
nullptr;
4002 newCtx->method =
nullptr;
4003 DBG_CTX((stderr,
"save state=%d\n",YY_START));
4004 yyextra->currentCtx = newCtx.get();
4005 yyextra->contextMap.emplace(yyextra->currentCtxId,std::move(newCtx));
4006 yyextra->braceCount = 0;
4007 yyextra->currentCtxId++;
4012 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4013 DBG_CTX((stderr,
"restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState));
4014 BEGIN(yyextra->currentCtx->lexState);
4015 yyextra->braceCount = yyextra->currentCtx->braceCount;
4016 if (!yyextra->contextStack.empty())
4018 yyextra->currentCtx = yyextra->contextStack.top();
4019 yyextra->contextStack.pop();
4023 yyextra->currentCtx =
nullptr;
4024 DBG_CTX((stderr,
"Trying to pop context while yyextra->contextStack is empty!\n"));
4036 codeYYlex_init_extra(&
p->state,&
p->yyscanner);
4045 codeYYlex_destroy(
p->yyscanner);
4050 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4051 DBG_CTX((stderr,
"***CodeParser::reset()\n"));
4052 yyextra->theVarContext.clear();
4053 while (!yyextra->scopeNameLengthStack.empty()) yyextra->scopeNameLengthStack.pop_back();
4054 yyextra->codeClassMap.clear();
4055 yyextra->curClassBases.clear();
4056 yyextra->anchorCount = 0;
4057 yyextra->insideCodeLine =
false;
4062 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4063 yyextra->insideCodeLine = inp;
4068 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4069 return yyextra->insideCodeLine;
4074 int startLine,
int endLine,
bool inlineFragment,
4079 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4080 DBG_CTX((stderr,
"***parseCode() exBlock=%d exName=%s fd=%p scopeName=%s searchCtx=%s\n",
4088 yyextra->code = &od;
4089 yyextra->inputString = s.
data();
4090 yyextra->fileName = fd ? fd->
fileName():
"";
4092 yyextra->inputPosition = 0;
4093 codeYYrestart(
nullptr,yyscanner);
4094 yyextra->currentFontClass =
nullptr;
4095 yyextra->searchCtx = searchCtx;
4096 yyextra->collectXRefs = collectXRefs;
4097 yyextra->inFunctionTryBlock =
FALSE;
4098 yyextra->symbolResolver.setFileScope(fd);
4099 yyextra->foldStack.clear();
4100 yyextra->insideSpecialComment =
false;
4103 yyextra->yyLineNr = startLine;
4105 yyextra->yyLineNr = 1;
4108 yyextra->inputLines = endLine+1;
4110 yyextra->inputLines = yyextra->yyLineNr +
countLines(yyscanner) - 1;
4112 yyextra->curlyCount = 0;
4113 yyextra->bodyCurlyCount = 0;
4114 yyextra->bracketCount = 0;
4115 yyextra->sharpCount = 0;
4116 yyextra->insideTemplate =
FALSE;
4117 yyextra->theCallContext.clear();
4118 while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
4119 yyextra->scopeName = scopeName;
4121 yyextra->exampleBlock = exBlock;
4122 yyextra->exampleName = exName;
4123 yyextra->sourceFileDef = fd;
4124 yyextra->lineNumbers = fd && showLineNumbers;
4129 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
4131 yyextra->lang = lang;
4132 yyextra->insideObjC = lang==SrcLangExt::ObjC;
4133 if (yyextra->sourceFileDef)
4138 yyextra->currentMemberDef =
nullptr;
4139 yyextra->searchingForBody = exBlock;
4140 yyextra->insideBody =
FALSE;
4141 yyextra->bracketCount = 0;
4142 if (!yyextra->exampleName.isEmpty())
4145 DBG_CTX((stderr,
"yyextra->exampleFile=%s\n",
qPrint(yyextra->exampleFile)));
4147 yyextra->includeCodeFragment = inlineFragment;
4148 DBG_CTX((stderr,
"** exBlock=%d exName=%s include=%d\n",exBlock,
qPrint(exName),inlineFragment));
4149 if (!yyextra->insideCodeLine)
4153 yyextra->type.clear();
4154 yyextra->name.clear();
4155 yyextra->args.clear();
4156 yyextra->parmName.clear();
4157 yyextra->parmType.clear();
4160 codeYYlex(yyscanner);
4161 yyextra->lexInit=
TRUE;
4162 if (yyextra->insideCodeLine)
4168 while (!yyextra->foldStack.empty())
4170 yyextra->code->endFold();
4171 yyextra->foldStack.pop_back();
4174 if (yyextra->exampleFileDef)
4177 yyextra->exampleFileDef.reset();
4178 yyextra->sourceFileDef=
nullptr;
4181 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)