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 T * find(const std::string &key) const
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}*"(" {
1365 if (yyextra->theCallContext.getScope().globalDef())
1372 yyextra->name.clear();
1378 yyextra->name.clear();
1380 yyextra->type.clear();
1381 if (yyextra->memCallContext==Body)
1387 BEGIN(yyextra->memCallContext);
1390<MemberCall>{SCOPENAME}/{B}* {
1391 if (yyextra->theCallContext.getScope().globalDef())
1393 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1399 yyextra->name.clear();
1403 DBG_CTX((stderr,
"no class context!\n"));
1406 yyextra->name.clear();
1408 yyextra->type.clear();
1409 BEGIN(yyextra->memCallContext);
1412 if (yyextra->insideObjC && *yytext==
'[')
1414 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
1416 yyextra->contextMap.clear();
1417 yyextra->nameMap.clear();
1418 yyextra->objectMap.clear();
1419 yyextra->wordMap.clear();
1420 yyextra->commentMap.clear();
1421 yyextra->currentCtxId = 0;
1422 yyextra->currentNameId = 0;
1423 yyextra->currentObjId = 0;
1424 yyextra->currentCtx =
nullptr;
1425 yyextra->braceCount = 0;
1431 if (*yytext!=
'{') yyextra->code->codify(yytext);
1432 yyextra->saveName = yyextra->name;
1433 yyextra->saveType = yyextra->type;
1434 if (*yytext!=
'[' && !yyextra->type.isEmpty())
1441 addVariable(yyscanner,yyextra->type,yyextra->name);
1443 yyextra->name.clear();
1445 if (*yytext==
';' || *yytext==
'=' || *yytext==
'{')
1447 yyextra->type.clear();
1448 yyextra->name.clear();
1450 else if (*yytext==
'[')
1452 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1454 yyextra->args.clear();
1455 yyextra->parmType.clear();
1456 yyextra->parmName.clear();
1464<Body,FuncCall,BodyVar>"{" {
1465 yyextra->theVarContext.pushScope();
1466 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1467 yyextra->bracketCount = 0;
1470 if (yyextra->type.find(
"enum ")!=-1)
1472 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1478 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1482 if (yyextra->searchingForBody)
1484 yyextra->searchingForBody=
FALSE;
1485 yyextra->insideBody=
TRUE;
1487 yyextra->code->codify(yytext);
1488 if (yyextra->insideBody)
1490 yyextra->bodyCurlyCount++;
1492 yyextra->type.clear();
1493 yyextra->name.clear();
1496<ObjCCall,ObjCMName>"["|"{" {
1498 yyextra->currentCtx->format+=*yytext;
1502<ObjCCall,ObjCMName>"]"|"}" {
1503 yyextra->currentCtx->format+=*yytext;
1506 if (yyextra->currentCtx==
nullptr)
1510 auto it = yyextra->contextMap.find(0);
1511 if (it!=yyextra->contextMap.end())
1513 ctx = it->second.get();
1520<ObjCCall,ObjCMName>{CPPC}.* {
1521 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1523<ObjCCall,ObjCMName>{CCS} {
1524 yyextra->lastObjCCallContext = YY_START;
1525 yyextra->currentCtx->comment.str(yytext);
1526 BEGIN(ObjCCallComment);
1528<ObjCCallComment>{CCE} {
1529 yyextra->currentCtx->comment << yytext;
1530 yyextra->currentCtx->format+=
escapeComment(yyscanner,yyextra->currentCtx->comment.str());
1531 BEGIN(yyextra->lastObjCCallContext);
1533<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
1534<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
1535<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
1536<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
1537<ObjCCall>{ID}({B}*"."{B}*{ID})* {
1538 yyextra->currentCtx->format+=
escapeObject(yyscanner,yytext);
1539 if (yyextra->braceCount==0)
1541 yyextra->currentCtx->objectTypeOrName=yytext;
1542 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1546<ObjCMName>{ID}/{BN}*"]" {
1547 if (yyextra->braceCount==0 &&
1548 yyextra->currentCtx->methodName.isEmpty())
1550 yyextra->currentCtx->methodName=yytext;
1551 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1555 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1558<ObjCMName>{ID}/{BN}*":" {
1559 if (yyextra->braceCount==0)
1561 yyextra->currentCtx->methodName+=yytext;
1562 yyextra->currentCtx->methodName+=
":";
1564 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1566<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1567<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1568<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1569 BEGIN(yyextra->lastStringContext);
1571<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1572<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1573 yyextra->lastStringContext=YY_START;
1576<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+=
"$$"; }
1577<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
1578<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
1579<ObjCSkipStr>"@"/"\"" {
1580 yyextra->currentCtx->format+=yytext;
1582<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext); }
1583<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
1584<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
1587 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1588 yyextra->code->codify(yytext);
1590 yyextra->name = yyextra->saveName;
1591 yyextra->type = yyextra->saveType;
1594 yyextra->code->codify(yytext);
1596<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1597 yyextra->code->codify(yytext);
1599<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1604 yyextra->code->codify(yytext);
1607<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1609 yyextra->parmName=yytext;
1611 yyextra->code->codify(yytext);
1614<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1615 if (yyextra->lang!=SrcLangExt::Slice)
1622 yyextra->parmName=yytext;
1624 yyextra->code->codify(yytext);
1628<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1630 yyextra->parmName=yytext;
1632 yyextra->code->codify(yytext);
1635<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1638 yyextra->parmName=yytext;
1640 yyextra->code->codify(yytext);
1643<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1649 yyextra->parmName=yytext;
1653 yyextra->code->codify(yytext);
1654 yyextra->inForEachExpression =
FALSE;
1657<MemberCall2,FuncCall>, {
1658 yyextra->code->codify(yytext);
1659 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1660 yyextra->parmType.clear();yyextra->parmName.clear();
1662<MemberCall2,FuncCall>"{" {
1663 if (yyextra->bracketCount>0)
1665 yyextra->code->codify(yytext);
1666 yyextra->skipInlineInitContext=YY_START;
1667 yyextra->curlyCount=0;
1675<InlineInit>"{" { yyextra->curlyCount++;
1676 yyextra->code->codify(yytext);
1679 yyextra->code->codify(yytext);
1680 if (--yyextra->curlyCount<=0)
1682 BEGIN(yyextra->skipInlineInitContext);
1689 yyextra->code->codify(yytext);
1691<MemberCall2,FuncCall>"(" {
1692 yyextra->parmType.clear();yyextra->parmName.clear();
1693 yyextra->code->codify(yytext);
1694 yyextra->bracketCount++;
1695 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1696 if (YY_START==FuncCall && !yyextra->insideBody)
1698 yyextra->theVarContext.pushScope();
1701<MemberCall2,FuncCall>{OPERATOR} {
1708 yyextra->parmType.clear();yyextra->parmName.clear();
1710 yyextra->code->codify(yytext);
1712<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1715 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1716 if (yyextra->parmType.isEmpty())
1718 yyextra->parmType=yyextra->parmName;
1719 yyextra->parmName.clear();
1721 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1725 yyextra->parmType = yyextra->parmName;
1726 yyextra->parmName.clear();
1727 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1729 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1730 yyextra->inForEachExpression =
FALSE;
1732 yyextra->code->codify(yytext);
1733 if (--yyextra->bracketCount<=0)
1735 if (yyextra->name.isEmpty())
1745<MemberCall,MemberCall2,FuncCall>[;:] {
1747 if (yyextra->bracketCount<=0)
1754 yyextra->code->codify(yytext);
1757<CallEnd>[ \t\n]* {
codifyLines(yyscanner,yytext); }
1760 yyextra->bracketCount=0;
1761 if (*yytext==
';') yyextra->searchingForBody=
FALSE;
1762 if (!yyextra->type.isEmpty())
1764 DBG_CTX((stderr,
"add variable yyextra->type=%s yyextra->name=%s)\n",
qPrint(yyextra->type),
qPrint(yyextra->name)));
1765 addVariable(yyscanner,yyextra->type,yyextra->name);
1767 yyextra->parmType.clear();yyextra->parmName.clear();
1769 if (*yytext==
';' || yyextra->insideBody)
1771 if (!yyextra->insideBody)
1773 yyextra->theVarContext.popScope();
1775 yyextra->name.clear();yyextra->type.clear();
1780 yyextra->bracketCount=0;
1785 if (yyextra->lang!=SrcLangExt::CSharp || yyextra->insideBody)
1791 yyextra->code->codify(
"=>");
1795<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1800<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1801 if (yyextra->insideBody)
1803 yyextra->theVarContext.pushScope();
1805 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1807 yyextra->parmType.clear();yyextra->parmName.clear();
1808 int index = yyextra->name.findRev(
"::");
1809 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1813 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1819 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1825 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1830 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1833 yytext[yyleng-1]=
'\0';
1835 if (!cv.stripWhiteSpace().isEmpty())
1845 yyextra->code->codify(
"{");
1846 if (yyextra->searchingForBody)
1848 yyextra->searchingForBody=
FALSE;
1849 yyextra->insideBody=
TRUE;
1851 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1852 yyextra->type.clear(); yyextra->name.clear();
static NamespaceDefMutable * globalScope
QCString & prepend(const char *s)
1857 yyextra->code->codify(yytext);
1859 yyextra->inFunctionTryBlock=
TRUE;
1861<CallEnd>"requires" {
1863 yyextra->code->codify(yytext);
1867 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1873 yyextra->parmName=yytext;
1875 BEGIN(OldStyleArgs);
1879 yyextra->parmName=yytext;
1883 yyextra->code->codify(yytext);
1884 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1885 if (*yytext==
';') yyextra->parmType.clear();
1886 yyextra->parmName.clear();
1888<CallEnd,OldStyleArgs>"#" {
1890 yyextra->lastSkipCppContext = Body;
1891 yyextra->code->codify(yytext);
1896 if (!yyextra->insideBody)
1898 yyextra->theVarContext.popScope();
1900 yyextra->name.clear();yyextra->args.clear();
1901 yyextra->parmType.clear();yyextra->parmName.clear();
1905 yyextra->code->codify(yytext);
1906 yyextra->type.clear(); yyextra->name.clear();
1910 yyextra->code->codify(yytext);
1911 if (yyextra->searchingForBody)
1913 yyextra->searchingForBody=
FALSE;
1914 yyextra->insideBody=
TRUE;
1916 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1917 if (yyextra->name.find(
"::")!=-1)
1919 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1925 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1928 yyextra->type.clear(); yyextra->name.clear();
1931<SkipInits>{ID}{B}*"{" {
1933 int bracketPos = text.
find(
'{');
1934 int spacePos = text.
find(
' ');
1935 int len = spacePos==-1 ? bracketPos : spacePos;
1937 yyextra->code->codify(yytext+len);
1945<FuncCall>{ID}/("."|"->") {
1946 yyextra->name=yytext;
1948 BEGIN( MemberCall2 );
1950<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1951 yyextra->code->codify(yytext);
1952 uint32_t s=0;
while (!
isId(yytext[s])) s++;
1953 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1954 yyextra->name=((
QCString)yytext).mid(s,e-s+1);
1955 BEGIN( MemberCall2 );
1957<MemberCall2>{ID}/([ \t\n]*"(") {
1958 if (!yyextra->args.isEmpty())
1962 yyextra->args.clear();
1965<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1967 yyextra->name=yytext;
1969 BEGIN( MemberCall2 );
1971<MemberCall2>"->"|"." {
1976 yyextra->code->codify(yytext);
1977 yyextra->memCallContext = YY_START;
1978 BEGIN( MemberCall );
1980<SkipComment>{CCS}("!"?){CCE} {
1981 yyextra->code->codify(yytext);
1983 BEGIN( yyextra->lastCContext ) ;
1985<SkipComment>{CPPC}|{CCS} {
1986 yyextra->code->codify(yytext);
1988<SkipComment>[^*\/\n]+ {
1989 yyextra->code->codify(yytext);
1991<SkipComment>[ \t]*{CCE} {
1992 yyextra->code->codify(yytext);
1994 if (yyextra->lastCContext==SkipCPP)
1998 BEGIN( yyextra->lastCContext ) ;
2000<SkipCxxComment>[^\r\n]*"\\"[\r]?\n {
2003<SkipCxxComment>[^\r\n]+ {
2004 yyextra->code->codify(yytext);
2010 BEGIN( yyextra->lastCContext ) ;
2013 yyextra->code->codify(yytext);
2015<MemberCall>[^a-z_A-Z0-9(\n] {
2016 yyextra->code->codify(yytext);
2017 yyextra->type.clear();
2018 yyextra->name.clear();
2019 BEGIN(yyextra->memCallContext);
2021<*>\n({B}*{CPPC}[!/][^\n]*\n)+ {
2022 if (YY_START==SkipCPP) REJECT;
2027 if (YY_START==SkipCxxComment)
2029 BEGIN( yyextra->lastCContext ) ;
2034 BEGIN( yyextra->lastSkipCppContext ) ;
2037<*>\n{B}*{CPPC}"@"[{}].*\n {
2042 if (YY_START==SkipCxxComment)
2044 BEGIN( yyextra->lastCContext ) ;
2047<*>\n{B}*{CCS}"@"[{}] {
2049 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2051 yyextra->lastCContext = YY_START ;
2057<*>^{B}*{CPPC}"@"[{}].*\n {
2063<*>^{B}*{CCS}"@"[{}] {
2065 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2067 yyextra->lastCContext = YY_START ;
2070 yyextra->code->codify(yytext);
2073<*>^{B}*{CPPC}[!/][^\n]* {
2078<*>{CPPC}[!/][^\n]* {
2079 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2084<*>\n{B}*{CCS}[!*]/{NCOMM} {
2086 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2088 yyextra->lastCContext = YY_START ;
2094<*>^{B}*{CCS}"*"[*]+/[^/] {
2096 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2098 yyextra->lastCContext = YY_START ;
2102 yyextra->code->codify(yytext);
#define Config_getBool(name)
2105<*>^{B}*{CCS}[!*]/{NCOMM} {
2107 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2109 yyextra->lastCContext = YY_START ;
2112 yyextra->code->codify(yytext);
2115<*>{CCS}[!*]/{NCOMM} {
2116 if (YY_START==SkipString) REJECT;
2118 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2120 yyextra->lastCContext = YY_START ;
2123 yyextra->code->codify(yytext);
2126<*>{CCS}("!"?){CCE} {
2127 if (YY_START==SkipString) REJECT;
2130 yyextra->code->codify(yytext);
2133<SkipComment>[^\*\n]+ {
2134 yyextra->code->codify(yytext);
2138 yyextra->code->codify(yytext);
2140 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2142 yyextra->lastCContext = YY_START ;
2144 BEGIN( SkipComment ) ;
2148 yyextra->code->codify(yytext);
2149 yyextra->lastVerbStringContext=YY_START;
2150 BEGIN(SkipVerbString);
2154 yyextra->code->codify(yytext);
2155 yyextra->lastCContext = YY_START ;
2156 BEGIN( SkipCxxComment ) ;
2159 if (yytext[0]==
'(') yyextra->bracketCount++;
2160 yyextra->code->codify(yytext);
2161 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2164 if (yytext[0]==
')') yyextra->bracketCount--;
2165 yyextra->code->codify(yytext);
2166 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2172 yyextra->code->codify(yytext);
2175 yyextra->code->codify(yytext);
2192 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2200 DBG_CTX((stderr,
"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n",
2201 qPrint(ltype),
qPrint(lname),yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>"));
2202 auto it = yyextra->codeClassMap.find(ltype.
str());
2203 if (it!=yyextra->codeClassMap.end())
2206 yyextra->theVarContext.addVariable(lname,std::move(it->second));
2210 auto findVariableType = [&yyscanner,&yyg,<ype,&lname,&name](
const Definition *d) ->
const ClassDef *
2212 const ClassDef *varDef = yyextra->symbolResolver.resolveClass(d,ltype,
true);
2219 else if ((i=ltype.find(
'<'))!=-1)
2226 const ClassDef *varDef = findVariableType(yyextra->currentDefinition);
2227 if (varDef==
nullptr)
2229 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2231 varDef = findVariableType(namespaceDef);
2235 if (varDef==
nullptr)
2237 if (!yyextra->theVarContext.atGlobalScope())
2241 DBG_CTX((stderr,
"** addVariable: dummy context for '%s'\n",
qPrint(lname)));
2246 DBG_CTX((stderr,
"** addVariable: not adding variable!\n"));
2257 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2258 yyextra->scopeNameLengthStack.push_back(
int(yyextra->scopeName.length()));
2259 if (yyextra->scopeName.isEmpty() ||
leftScopeMatch(s,yyextra->scopeName))
2261 yyextra->scopeName = s;
2265 yyextra->scopeName +=
"::";
2266 yyextra->scopeName += s;
2275 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2276 if (!yyextra->scopeNameLengthStack.empty())
2278 int length = yyextra->scopeNameLengthStack.back();
2279 yyextra->scopeNameLengthStack.pop_back();
2280 yyextra->scopeName.resize(length);
2286 DBG_CTX((stderr,
"popScope() result: '%s'\n",
qPrint(yyextra->scopeName)));
2291 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2294 if (yyextra->searchCtx)
2315 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2321 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
2322 if (ts!=-1 && te!=-1 && te>ts)
2327 while (!yyextra->scopeNameLengthStack.empty())
2331 yyextra->scopeName.clear();
2333 while ((i=n.
find(
"::"))!=-1)
2339 DBG_CTX((stderr,
"--->New class scope '%s'\n",
qPrint(yyextra->scopeName)));
2344 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2345 while (!yyextra->foldStack.empty())
2347 const Definition *dd = yyextra->foldStack.back();
2350 yyextra->code->endFold();
2352 yyextra->foldStack.pop_back();
2367 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2376 if (endLine!=-1 && startLine!=endLine &&
2384 (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
2392 yyextra->code->startFold(yyextra->yyLineNr,
"",
"");
2396 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2400 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2405 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2409 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2411 yyextra->foldStack.push_back(d);
2423 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2425 if (yyextra->sourceFileDef && yyextra->lineNumbers)
2431 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
2433 DBG_CTX((stderr,
"%s:startCodeLine(%d)=%p\n",
qPrint(yyextra->sourceFileDef->name()),yyextra->yyLineNr,(
void*)d));
2434 if (!yyextra->includeCodeFragment && d)
2436 yyextra->currentDefinition = d;
2437 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
2438 yyextra->insideBody =
FALSE;
2439 yyextra->searchingForBody =
TRUE;
2441 yyextra->type.
clear();
2442 yyextra->name.clear();
2443 yyextra->args.clear();
2444 yyextra->parmType.clear();
2445 yyextra->parmName.clear();
2446 DBG_CTX((stderr,
"Real scope: '%s'\n",
qPrint(yyextra->realScope)));
2447 yyextra->bodyCurlyCount = 0;
2449 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
2450 if (yyextra->currentMemberDef)
2453 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
2454 yyextra->currentMemberDef->getOutputFileBase(),
2455 yyextra->currentMemberDef->anchor(),
2456 yyextra->yyLineNr,!yyextra->includeCodeFragment);
2464 QCString(),yyextra->yyLineNr,!yyextra->includeCodeFragment);
2476 !yyextra->includeCodeFragment);
2479 DBG_CTX((stderr,
"startCodeLine(%d)\n",yyextra->yyLineNr));
2480 yyextra->code->startCodeLine(yyextra->yyLineNr);
2481 yyextra->insideCodeLine =
true;
2482 if (yyextra->currentFontClass)
2484 yyextra->code->startFontClass(yyextra->currentFontClass);
2492 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2493 DBG_CTX((stderr,
"endCodeLine(%d)\n",yyextra->yyLineNr));
2495 yyextra->code->endCodeLine();
2496 yyextra->insideCodeLine =
false;
2501 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2502 const char * fc = yyextra->currentFontClass;
2503 if (yyextra->insideCodeLine)
2507 if (yyextra->yyLineNr<yyextra->inputLines)
2509 yyextra->currentFontClass = fc;
2519 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2520 DBG_CTX((stderr,
"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,
qPrint(text)));
2522 const char *p=text.
data(),*sp=p;
2528 while ((c=*p++) && c!=
'\n');
2531 yyextra->yyLineNr++;
2532 size_t l =
static_cast<size_t>(p-sp-1);
2533 yyextra->code->codify(
QCString(sp,l));
2538 yyextra->code->codify(sp);
2547 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2548 if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
2566 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2568 yyextra->tooltipManager.addTooltip(d);
2573 if (!sourceTooltips)
2578 const char *p=text.
data();
2583 while ((c=*p++) && c!=
'\n') { }
2586 yyextra->yyLineNr++;
2602 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2603 if (yyextra->name==
"const") { yyextra->name.clear();
return; }
2604 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2605 yyextra->type += yyextra->name ;
2606 yyextra->name.clear() ;
2607 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2608 yyextra->type += yyextra->args ;
2609 yyextra->args.clear() ;
2614 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2615 if (yyextra->parmName==
"const") { yyextra->parmName.clear();
return; }
2616 if (!yyextra->parmType.isEmpty()) yyextra->parmType +=
' ' ;
2617 yyextra->parmType += yyextra->parmName ;
2618 yyextra->parmName.clear() ;
2624 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2625 if (yyextra->sourceFileDef && !name.
isEmpty())
2630 yyextra->theUsingContext.emplace(name.
str(),nd);
2637 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2640 yyextra->parmName = a.name;
2641 yyextra->parmType = a.type;
2642 int i = yyextra->parmType.find(
'*');
2643 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2644 i = yyextra->parmType.find(
'&');
2645 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2646 yyextra->parmType.stripPrefix(
"const ");
2647 yyextra->parmType=yyextra->parmType.stripWhiteSpace();
2648 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
2654 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2655 DBG_CTX((stderr,
"stripClassName(scope=%s,type=%s) scopeName=%s\n",
2663 QCString clName=className+templSpec;
2665 if (!yyextra->scopeName.isEmpty())
2667 cd=yyextra->symbolResolver.resolveClass(d,yyextra->scopeName+
"::"+clName,
true);
2671 cd=yyextra->symbolResolver.resolveClass(d,clName,
true);
2673 DBG_CTX((stderr,
"stripClass trying '%s' = %p\n",
qPrint(clName),(
void*)cd));
2685 if (name.
isEmpty())
return nullptr;
2686 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2687 DBG_CTX((stderr,
"setCallContextForVar(%s) yyextra->scopeName=%s\n",
qPrint(name),
qPrint(yyextra->scopeName)));
2689 int scopeEnd = name.
findRev(
"::");
2696 if (mcd && !locName.
isEmpty())
2709 if (mnd && !locName.
isEmpty())
2725 DBG_CTX((stderr,
"local variable?\n"));
2729 yyextra->theCallContext.setScope(*mcv);
2734 DBG_CTX((stderr,
"class member? scope=%s\n",
qPrint(yyextra->scopeName)));
2744 if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=
CLASSBLOCK)
2761 const std::unique_ptr<MemberDef> &md=mn->
front();
2762 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2769 else if (mn->
size()>1)
2771 for (
const auto &md : *mn)
2780 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2783 DBG_CTX((stderr,
"returning member %s in source file %s\n",
qPrint(md->name()),
qPrint(yyextra->sourceFileDef->name())));
2795 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2796 const Definition *d = yyextra->theCallContext.getScope().globalDef();
2819 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2820 DBG_CTX((stderr,
"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",
qPrint(c),
qPrint(m),varOnly));
2825 DBG_CTX((stderr,
"scopeNameLengthStack.size()=%zu\n",yyextra->scopeNameLengthStack.size()));
2826 if (!result.
found && !yyextra->scopeNameLengthStack.empty() && c==yyextra->scopeName)
2828 QCString localName = yyextra->scopeName.
mid(yyextra->scopeNameLengthStack[0]+2);
2829 auto it = yyextra->codeClassMap.
find(localName.
str());
2830 if (it!=yyextra->codeClassMap.end())
2837 DBG_CTX((stderr,
"trying lookup via base class %s\n",
qPrint(bcName)));
2840 if (result.
found)
break;
2850 if (yyextra->exampleBlock)
2854 anchor.
sprintf(
"a%d",yyextra->anchorCount);
2856 qPrint(yyextra->exampleFile)));
2858 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
2861 yyextra->anchorCount++;
2875 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n",
2876 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,yyextra->insideBody));
2878 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
2879 yyextra->insideBody && yyextra->collectXRefs)
2901 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2902 DBG_CTX((stderr,
"getLink(%s,%s) yyextra->curClassName=%s\n",
2908 if (!yyextra->curClassName.isEmpty())
2911 c.
prepend(yyextra->curClassName);
2925 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2927 if (!scopeName.
isEmpty() && scopeName[0]==
'~')
2929 scopeName=scopeName.
mid(1);
2933 yyextra->code->codify(
"~");
2936 if (yyextra->insideProtocolList)
2940 if (yyextra->lang==SrcLangExt::PHP)
2944 else if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
2948 if (yyextra->currentDefinition==
nullptr && !yyextra->scopeName.isEmpty())
2950 scopeName = yyextra->scopeName+
"::"+scopeName;
2956 DBG_CTX((stderr,
"generateClassOrGlobalLink(name=%s) yyextra->scopeName=%s scopeName=%s\n",
qPrint(scName),
qPrint(yyextra->scopeName),
qPrint(scopeName)));
2957 if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(scopeName))==
nullptr)
2959 int i=scopeName.
find(
'<');
2961 if (i!=-1) bareName = bareName.
left(i);
2963 auto checkForSymbol = [&yyg,&bareName,&scopeName](
const Definition *
parent,
2966 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,scopeName,
QCString(),
false,
true);
2967 DBG_CTX((stderr,
"non-local variable name=%s sym=%s!\n",
2968 qPrint(scopeName),sym_?
qPrint(sym_->name()):
"<none>"));
2969 if (sym_==
nullptr && !bareName.
isEmpty())
2972 if (bareName!=scopeName)
2974 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,bareName,
QCString(),
false,
true);
2978 const Definition *d = yyextra->currentDefinition;
2979 DBG_CTX((stderr,
"d=%s yyextra->sourceFileDef=%s\n",d?
qPrint(d->
name()):
"<none>",yyextra->sourceFileDef?
qPrint(yyextra->sourceFileDef->name()):
"<none>"));
2980 checkForSymbol(d,sym);
2989 checkForSymbol(nd,sym);
2997 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2999 checkForSymbol(namespaceDef,sym);
3021 DBG_CTX((stderr,
"is found as a type sym=%s nd=%s\n",
3026 if (
getLink(yyscanner,yyextra->scopeName,scName,ol,scName,varOnly))
3034 DBG_CTX((stderr,
"local variable!\n"));
3038 yyextra->theCallContext.setScope(*lcd);
3049 DBG_CTX((stderr,
"is a local variable sym=%p!\n",(
void*)sym));
3051 yyextra->isPrefixedWithThis =
FALSE;
3056 if (yyextra->exampleBlock)
3060 anchor.
sprintf(
"_a%d",yyextra->anchorCount);
3061 DBG_CTX((stderr,
"addExampleClass(%s,%s,%s)\n",
qPrint(anchor),
qPrint(yyextra->exampleName),
3062 qPrint(yyextra->exampleFile)));
3066 if (cdm && cdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3069 yyextra->anchorCount++;
3075 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3078 yyextra->anchorCount++;
3091 yyextra->currentMemberDef && yyextra->collectXRefs)
3105 DBG_CTX((stderr,
"class %s not linkable! cd=%p typeOnly=%d\n",
qPrint(scName),(
void*)sym,typeOnly));
3106 if (!isLocal && (md || (!sym && !typeOnly)))
3111 DBG_CTX((stderr,
"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%s\n",
qPrint(scName),(
void*)md,yyextra->currentDefinition ?
qPrint(yyextra->currentDefinition->name()) :
"<none>"));
3112 if (md && yyextra->currentDefinition)
3114 DBG_CTX((stderr,
"%s accessible from %s? %d md->getOuterScope=%s\n",
3115 qPrint(md->name()),
qPrint(yyextra->currentDefinition->name()),
3116 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md),
3117 qPrint(md->getOuterScope()->name())));
3120 if (md && yyextra->currentDefinition &&
3121 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md)==-1)
3128 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()));
3129 if (md->isLinkable())
3133 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3143 DBG_CTX((stderr,
"not found!\n"));
3154 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3158 DBG_CTX((stderr,
"type='%s' args='%s' class=%s\n",
3162 if (yyextra->exampleBlock)
3166 anchor.
sprintf(
"a%d",yyextra->anchorCount);
3168 qPrint(yyextra->exampleFile)));
3170 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3173 yyextra->anchorCount++;
3187 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",
3188 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,(
void*)xmd,yyextra->insideBody));
3190 if (xmd->templateMaster()) xmd = xmd->templateMaster();
3192 if (xmd->isLinkable())
3195 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
3196 yyextra->insideBody && yyextra->collectXRefs)
3216 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3221 DBG_CTX((stderr,
"generateClassMemberLink(class=%s,member=%s)=%p\n",
qPrint(def->
name()),
qPrint(memName),(
void*)xmd));
3259 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3260 DBG_CTX((stderr,
"generateMemberLink(object=%s,mem=%s) classScope=%s\n",
3263 if (varName.
isEmpty())
return;
3271 DBG_CTX((stderr,
"Class found!\n"));
3274 DBG_CTX((stderr,
"Found result!\n"));
3281 if (
getLink(yyscanner,bcName,memName,ol))
3283 DBG_CTX((stderr,
"Found result!\n"));
3292 const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->scopeName,
true);
3295 DBG_CTX((stderr,
"Found class %s for variable '%s'\n",
qPrint(yyextra->scopeName),
qPrint(varName)));
3309 for (
const auto &vmd : *vmn)
3311 if (vmd->getClassDef()==jcd)
3313 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3326 DBG_CTX((stderr,
"There is a variable with name '%s'\n",
qPrint(varName)));
3327 for (
const auto &vmd : *vmn)
3329 if (vmd->getClassDef()==vcd)
3331 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3350 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3353 DBG_CTX((stderr,
"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,
qPrint(name),
qPrint(yyextra->scopeName)));
3354 if (!
getLink(yyscanner,yyextra->scopeName,name,ol,varName))
3362 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3364 QCString locScope=yyextra->scopeName;
3366 if (yyextra->lang==SrcLangExt::PHP && locFunc.
startsWith(
"self::")) locFunc=locFunc.
mid(4);
3369 QCString funcWithFullScope=locFunc;
3374 if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() &&
3375 funcName==yyextra->currentMemberDef->localName() &&
3376 yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr &&
3400 funcScope=locFunc.
left(i);
3402 int ts=locScope.
find(
'<');
3404 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3405 if (ts!=-1 && te!=-1 && te>ts)
3410 ts=funcScope.
find(
'<');
3412 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3413 if (ts!=-1 && te!=-1 && te>ts)
3416 funcScope=funcScope.
left(ts)+funcScope.
right(funcScope.
length()-te-1);
3420 funcWithScope = funcScope+
"::"+locFunc;
3423 fullScope=locScope+
"::"+funcScope;
3428 funcWithFullScope = locScope+
"::"+funcWithScope;
3434 auto it = yyextra->codeClassMap.find(fullScope.
str());
3435 if (it!=yyextra->codeClassMap.end())
3442 if (
getLink(yyscanner,bcName,locFunc,ol,funcName))
3451 if (!locScope.
isEmpty() && fullScope!=locScope)
3453 auto it = yyextra->codeClassMap.find(locScope.
str());
3454 if (it!=yyextra->codeClassMap.end())
3461 if (
getLink(yyscanner,bcName,funcWithScope,ol,funcName))
3469 if (!
getLink(yyscanner,locScope,funcWithScope,ol,funcName))
3480 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3481 const char *p=yyextra->inputString;
3487 if (c==
'\n') count++;
3489 if (p>yyextra->inputString && *(p-1)!=
'\n')
3498 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3499 if (yyextra->currentFontClass)
3501 yyextra->code->endFontClass();
3502 yyextra->currentFontClass=
nullptr;
3504 if (specialComment && yyextra->insideSpecialComment)
3506 yyextra->code->endSpecialComment();
3507 yyextra->insideSpecialComment =
false;
3513 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3517 yyextra->code->startSpecialComment();
3518 yyextra->insideSpecialComment =
true;
3520 yyextra->code->startFontClass(s);
3521 yyextra->currentFontClass=s;
3529 if (ctx==
nullptr)
return;
3530 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3534 DBG_CTX((stderr,
"writeObjCMethodCall(%s) obj=%s method=%s\n",
3543 DBG_CTX((stderr,
" object is local variable\n"));
3551 DBG_CTX((stderr,
" class=%p method=%p\n",(
void*)cd,(
void*)ctx->
method));
3562 char skipChar =
' ';
3587 yyextra->code->codify(
"$");
3595 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3597 int refId=refIdStr.
toInt();
3598 auto it = yyextra->nameMap.find(refId);
3599 if (it!=yyextra->nameMap.end())
3605 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3617 DBG_CTX((stderr,
"Invalid name: id=%d\n",refId));
3624 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3626 int refId=refIdStr.
toInt();
3627 auto it = yyextra->objectMap.find(refId);
3628 if (it!=yyextra->objectMap.end())
3633 if (yyextra->currentDefinition &&
3650 else if (
object==
"super")
3652 if (yyextra->currentDefinition &&
3679 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3692 int dotPos=
object.find(
'.',pp);
3693 int len =
static_cast<int>(
object.length());
3694 if (dotPos==-1) dotPos=len;
3695 const Definition *scope = yyextra->currentDefinition;
3702 if (fragmentStripped==
"self")
3715 const Definition *symbol = yyextra->symbolResolver.resolveSymbol(scope,fragmentStripped,
QCString(),
false,
true);
3721 ctx->
method = yyextra->symbolResolver.getTypedef();
3745 dotPos=
object.find(
'.',pp);
3746 if (dotPos==-1) dotPos=len;
3755 else if (ctx->
method==
nullptr)
3758 DBG_CTX((stderr,
"yyextra->currentDefinition=%p\n",(
void*)yyextra->currentDefinition));
3759 if (yyextra->currentDefinition &&
3780 DBG_CTX((stderr,
"Invalid object: id=%d\n",refId));
3787 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3789 int refId=refIdStr.
toInt();
3790 auto it = yyextra->contextMap.find(refId);
3791 if (it!=yyextra->contextMap.end())
3806 if (mn && mn->
size()==1)
3824 DBG_CTX((stderr,
"Invalid context: id=%d\n",refId));
3831 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3833 int refId=refIdStr.
toInt();
3834 auto it = yyextra->wordMap.find(refId);
3835 if (it!=yyextra->wordMap.end())
3838 bool isKeyword = word==
"self";
3854 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3856 int refId=refIdStr.
toInt();
3857 auto it = yyextra->commentMap.find(refId);
3858 if (it!=yyextra->commentMap.end())
3872 else if (c==
'\'' || c ==
'"')
3889 DBG_CTX((stderr,
"}=(type='%s',name='%s')",
3899 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3901 result.
sprintf(
"$n%d",yyextra->currentNameId);
3902 yyextra->nameMap.emplace(yyextra->currentNameId,s);
3903 yyextra->currentNameId++;
3909 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3911 result.
sprintf(
"$o%d",yyextra->currentObjId);
3912 yyextra->objectMap.emplace(yyextra->currentObjId,s);
3913 yyextra->currentObjId++;
3919 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3921 result.
sprintf(
"$w%d",yyextra->currentWordId);
3922 yyextra->wordMap.emplace(yyextra->currentWordId,s);
3923 yyextra->currentWordId++;
3929 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3931 result.
sprintf(
"$d%d",yyextra->currentCommentId);
3932 yyextra->commentMap.emplace(yyextra->currentCommentId,s);
3933 yyextra->currentCommentId++;
3939 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3940 static const std::unordered_set<std::string> non_cpp_keywords = {
3941 "__assume",
"__super",
"abstract",
"function",
3942 "gcnew",
"gcroot",
"generic",
"get",
3943 "internal",
"null",
"pin_ptr",
"raise",
3944 "remove",
"self",
"set",
"transient",
3947 static const std::unordered_set<std::string> non_java_keywords = {
3948 "alignas",
"alignof",
"and",
"and_eq",
"asm",
3949 "atomic_cancel",
"atomic_commit",
"atomic_noexcept",
"auto",
"bitand",
3950 "bitor",
"bool",
"char8_t",
"char16_t",
"char32_t",
3951 "compl",
"concept",
"consteval",
"constexpr",
"constinit",
3952 "const_cast",
"co_await",
"co_return",
"co_yield",
"decltype",
3953 "delete",
"dynamic_cast",
"explicit",
"export",
"extern",
3954 "friend",
"inline",
"mutable",
"namespace",
"noexcept",
3955 "not",
"not_eq",
"nullptr",
"operator",
"or",
3956 "or_eq",
"reflexpr",
"register",
"reinterpret_cast",
"requires",
3957 "signed",
"sizeof",
"static_assert",
"_Static_assert",
"static_cast",
"struct",
3958 "template",
"thread_local",
"typedef",
"typeid",
"typename",
3959 "union",
"unsigned",
"using",
"virtual",
"wchar_t",
3960 "xor",
"xor_eq",
"override",
"sealed"
3962 bool retval =
false;
3963 switch (yyextra->lang)
3965 case SrcLangExt::Cpp:
3966 retval = (non_cpp_keywords.find(keyword) != non_cpp_keywords.end());
3968 case SrcLangExt::Java:
3969 retval = (non_java_keywords.find(keyword) != non_java_keywords.end());
3982 if (i==-1)
return FALSE;
3984 return kw==
"const_cast" || kw==
"static_cast" || kw==
"dynamic_cast" || kw==
"reinterpret_cast";
3989 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3990 yy_size_t inputPosition = yyextra->inputPosition;
3991 const char *s = yyextra->inputString + inputPosition;
3993 while( c < max_size && *s )
3998 yyextra->inputPosition += c;
4005 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4006 if (yyextra->currentCtx)
4008 yyextra->currentCtx->format+=
QCString().
sprintf(
"$c%d",yyextra->currentCtxId);
4009 if (yyextra->braceCount==0 && YY_START==ObjCCall)
4011 yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1);
4012 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
4014 yyextra->contextStack.push(yyextra->currentCtx);
4018 DBG_CTX((stderr,
"Trying to save NULL context!\n"));
4020 auto newCtx = std::make_unique<ObjCCallCtx>();
4021 newCtx->id = yyextra->currentCtxId;
4022 newCtx->lexState = YY_START;
4023 newCtx->braceCount = yyextra->braceCount;
4024 newCtx->objectType =
nullptr;
4025 newCtx->objectVar =
nullptr;
4026 newCtx->method =
nullptr;
4027 DBG_CTX((stderr,
"save state=%d\n",YY_START));
4028 yyextra->currentCtx = newCtx.get();
4029 yyextra->contextMap.emplace(yyextra->currentCtxId,std::move(newCtx));
4030 yyextra->braceCount = 0;
4031 yyextra->currentCtxId++;
4036 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4037 DBG_CTX((stderr,
"restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState));
4038 BEGIN(yyextra->currentCtx->lexState);
4039 yyextra->braceCount = yyextra->currentCtx->braceCount;
4040 if (!yyextra->contextStack.empty())
4042 yyextra->currentCtx = yyextra->contextStack.top();
4043 yyextra->contextStack.pop();
4047 yyextra->currentCtx =
nullptr;
4048 DBG_CTX((stderr,
"Trying to pop context while yyextra->contextStack is empty!\n"));
4060 codeYYlex_init_extra(&
p->state,&
p->yyscanner);
4069 codeYYlex_destroy(
p->yyscanner);
4074 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4075 DBG_CTX((stderr,
"***CodeParser::reset()\n"));
4076 yyextra->theVarContext.clear();
4077 while (!yyextra->scopeNameLengthStack.empty()) yyextra->scopeNameLengthStack.pop_back();
4078 yyextra->codeClassMap.clear();
4079 yyextra->curClassBases.clear();
4080 yyextra->anchorCount = 0;
4081 yyextra->insideCodeLine =
false;
4086 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4087 yyextra->insideCodeLine = inp;
4092 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4093 return yyextra->insideCodeLine;
4100 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4101 DBG_CTX((stderr,
"***parseCode() exBlock=%d exName=%s fd=%p scopeName=%s searchCtx=%s\n",
4111 yyextra->code = &od;
4112 yyextra->inputString = s.
data();
4115 yyextra->inputPosition = 0;
4116 codeYYrestart(
nullptr,yyscanner);
4117 yyextra->currentFontClass =
nullptr;
4118 yyextra->searchCtx = options.
searchCtx();
4120 yyextra->inFunctionTryBlock =
FALSE;
4121 yyextra->symbolResolver.setFileScope(options.
fileDef());
4122 yyextra->foldStack.clear();
4123 yyextra->insideSpecialComment =
false;
4126 yyextra->curlyCount = 0;
4127 yyextra->bodyCurlyCount = 0;
4128 yyextra->bracketCount = 0;
4129 yyextra->sharpCount = 0;
4130 yyextra->insideTemplate =
FALSE;
4131 yyextra->theCallContext.clear();
4132 while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
4133 yyextra->scopeName = scopeName;
4135 yyextra->exampleBlock = options.
isExample();
4137 yyextra->sourceFileDef = options.
fileDef();
4139 if (options.
fileDef()==
nullptr)
4143 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
4145 yyextra->lang = lang;
4146 yyextra->insideObjC = lang==SrcLangExt::ObjC;
4147 if (yyextra->sourceFileDef)
4152 yyextra->currentMemberDef =
nullptr;
4153 yyextra->searchingForBody = options.
isExample();
4154 yyextra->insideBody =
FALSE;
4155 yyextra->bracketCount = 0;
4156 if (!yyextra->exampleName.isEmpty())
4159 DBG_CTX((stderr,
"yyextra->exampleFile=%s\n",
qPrint(yyextra->exampleFile)));
4163 if (!yyextra->insideCodeLine)
4167 yyextra->type.clear();
4168 yyextra->name.clear();
4169 yyextra->args.clear();
4170 yyextra->parmName.clear();
4171 yyextra->parmType.clear();
4174 codeYYlex(yyscanner);
4175 yyextra->lexInit=
TRUE;
4176 if (yyextra->insideCodeLine)
4182 while (!yyextra->foldStack.empty())
4184 yyextra->code->endFold();
4185 yyextra->foldStack.pop_back();
4188 if (yyextra->exampleFileDef)
4191 yyextra->exampleFileDef.reset();
4192 yyextra->sourceFileDef=
nullptr;
4195 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
void addWord(const QCString &word, bool hiPriority)
void setCurrentDoc(const Definition *ctx, const QCString &anchor, bool isSourceFile)
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)