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;
1784 if (yyextra->lang!=SrcLangExt::CSharp || yyextra->insideBody)
1790 yyextra->code->codify(
"=>");
1794<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1799<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1800 if (yyextra->insideBody)
1802 yyextra->theVarContext.pushScope();
1804 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1806 yyextra->parmType.clear();yyextra->parmName.clear();
1807 int index = yyextra->name.findRev(
"::");
1808 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1812 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1818 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1824 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1829 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1832 yytext[yyleng-1]=
'\0';
1834 if (!cv.stripWhiteSpace().isEmpty())
1844 yyextra->code->codify(
"{");
1845 if (yyextra->searchingForBody)
1847 yyextra->searchingForBody=
FALSE;
1848 yyextra->insideBody=
TRUE;
1850 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1851 yyextra->type.clear(); yyextra->name.clear();
static NamespaceDefMutable * globalScope
QCString & prepend(const char *s)
1856 yyextra->code->codify(yytext);
1858 yyextra->inFunctionTryBlock=
TRUE;
1860<CallEnd>"requires" {
1862 yyextra->code->codify(yytext);
1866 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1872 yyextra->parmName=yytext;
1874 BEGIN(OldStyleArgs);
1878 yyextra->parmName=yytext;
1882 yyextra->code->codify(yytext);
1883 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1884 if (*yytext==
';') yyextra->parmType.clear();
1885 yyextra->parmName.clear();
1887<CallEnd,OldStyleArgs>"#" {
1889 yyextra->lastSkipCppContext = Body;
1890 yyextra->code->codify(yytext);
1895 if (!yyextra->insideBody)
1897 yyextra->theVarContext.popScope();
1899 yyextra->name.clear();yyextra->args.clear();
1900 yyextra->parmType.clear();yyextra->parmName.clear();
1904 yyextra->code->codify(yytext);
1905 yyextra->type.clear(); yyextra->name.clear();
1909 yyextra->code->codify(yytext);
1910 if (yyextra->searchingForBody)
1912 yyextra->searchingForBody=
FALSE;
1913 yyextra->insideBody=
TRUE;
1915 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1916 if (yyextra->name.find(
"::")!=-1)
1918 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1924 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1927 yyextra->type.clear(); yyextra->name.clear();
1930<SkipInits>{ID}{B}*"{" {
1932 int bracketPos = text.
find(
'{');
1933 int spacePos = text.
find(
' ');
1934 int len = spacePos==-1 ? bracketPos : spacePos;
1936 yyextra->code->codify(yytext+len);
1944<FuncCall>{ID}/("."|"->") {
1945 yyextra->name=yytext;
1947 BEGIN( MemberCall2 );
1949<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1950 yyextra->code->codify(yytext);
1951 uint32_t s=0;
while (!
isId(yytext[s])) s++;
1952 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1953 yyextra->name=((
QCString)yytext).mid(s,e-s+1);
1954 BEGIN( MemberCall2 );
1956<MemberCall2>{ID}/([ \t\n]*"(") {
1957 if (!yyextra->args.isEmpty())
1961 yyextra->args.clear();
1964<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1966 yyextra->name=yytext;
1968 BEGIN( MemberCall2 );
1970<MemberCall2>"->"|"." {
1975 yyextra->code->codify(yytext);
1976 yyextra->memCallContext = YY_START;
1977 BEGIN( MemberCall );
1979<SkipComment>{CCS}("!"?){CCE} {
1980 yyextra->code->codify(yytext);
1982 BEGIN( yyextra->lastCContext ) ;
1984<SkipComment>{CPPC}|{CCS} {
1985 yyextra->code->codify(yytext);
1987<SkipComment>[^*\/\n]+ {
1988 yyextra->code->codify(yytext);
1990<SkipComment>[ \t]*{CCE} {
1991 yyextra->code->codify(yytext);
1993 if (yyextra->lastCContext==SkipCPP)
1997 BEGIN( yyextra->lastCContext ) ;
1999<SkipCxxComment>[^\r\n]*"\\"[\r]?\n {
2002<SkipCxxComment>[^\r\n]+ {
2003 yyextra->code->codify(yytext);
2009 BEGIN( yyextra->lastCContext ) ;
2012 yyextra->code->codify(yytext);
2014<MemberCall>[^a-z_A-Z0-9(\n] {
2015 yyextra->code->codify(yytext);
2016 yyextra->type.clear();
2017 yyextra->name.clear();
2018 BEGIN(yyextra->memCallContext);
2020<*>\n({B}*{CPPC}[!/][^\n]*\n)+ {
2021 if (YY_START==SkipCPP) REJECT;
2026 if (YY_START==SkipCxxComment)
2028 BEGIN( yyextra->lastCContext ) ;
2033 BEGIN( yyextra->lastSkipCppContext ) ;
2036<*>\n{B}*{CPPC}"@"[{}].*\n {
2041 if (YY_START==SkipCxxComment)
2043 BEGIN( yyextra->lastCContext ) ;
2046<*>\n{B}*{CCS}"@"[{}] {
2048 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2050 yyextra->lastCContext = YY_START ;
2056<*>^{B}*{CPPC}"@"[{}].*\n {
2062<*>^{B}*{CCS}"@"[{}] {
2064 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2066 yyextra->lastCContext = YY_START ;
2069 yyextra->code->codify(yytext);
2072<*>^{B}*{CPPC}[!/][^\n]* {
2077<*>{CPPC}[!/][^\n]* {
2078 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2083<*>\n{B}*{CCS}[!*]/{NCOMM} {
2085 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2087 yyextra->lastCContext = YY_START ;
2093<*>^{B}*{CCS}"*"[*]+/[^/] {
2095 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2097 yyextra->lastCContext = YY_START ;
2101 yyextra->code->codify(yytext);
#define Config_getBool(name)
2104<*>^{B}*{CCS}[!*]/{NCOMM} {
2106 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2108 yyextra->lastCContext = YY_START ;
2111 yyextra->code->codify(yytext);
2114<*>{CCS}[!*]/{NCOMM} {
2115 if (YY_START==SkipString) REJECT;
2117 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2119 yyextra->lastCContext = YY_START ;
2122 yyextra->code->codify(yytext);
2125<*>{CCS}("!"?){CCE} {
2126 if (YY_START==SkipString) REJECT;
2129 yyextra->code->codify(yytext);
2132<SkipComment>[^\*\n]+ {
2133 yyextra->code->codify(yytext);
2137 yyextra->code->codify(yytext);
2139 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2141 yyextra->lastCContext = YY_START ;
2143 BEGIN( SkipComment ) ;
2147 yyextra->code->codify(yytext);
2148 yyextra->lastVerbStringContext=YY_START;
2149 BEGIN(SkipVerbString);
2153 yyextra->code->codify(yytext);
2154 yyextra->lastCContext = YY_START ;
2155 BEGIN( SkipCxxComment ) ;
2158 if (yytext[0]==
'(') yyextra->bracketCount++;
2159 yyextra->code->codify(yytext);
2160 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2163 if (yytext[0]==
')') yyextra->bracketCount--;
2164 yyextra->code->codify(yytext);
2165 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2171 yyextra->code->codify(yytext);
2174 yyextra->code->codify(yytext);
2191 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2199 DBG_CTX((stderr,
"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n",
2200 qPrint(ltype),
qPrint(lname),yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>"));
2201 auto it = yyextra->codeClassMap.find(ltype.
str());
2202 if (it!=yyextra->codeClassMap.end())
2205 yyextra->theVarContext.addVariable(lname,std::move(it->second));
2209 auto findVariableType = [&yyscanner,&yyg,<ype,&lname,&name](
const Definition *d) ->
const ClassDef *
2211 const ClassDef *varDef = yyextra->symbolResolver.resolveClass(d,ltype,
true);
2218 else if ((i=ltype.find(
'<'))!=-1)
2225 const ClassDef *varDef = findVariableType(yyextra->currentDefinition);
2226 if (varDef==
nullptr)
2228 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2230 varDef = findVariableType(namespaceDef);
2234 if (varDef==
nullptr)
2236 if (!yyextra->theVarContext.atGlobalScope())
2240 DBG_CTX((stderr,
"** addVariable: dummy context for '%s'\n",
qPrint(lname)));
2245 DBG_CTX((stderr,
"** addVariable: not adding variable!\n"));
2256 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2257 yyextra->scopeNameLengthStack.push_back(
int(yyextra->scopeName.length()));
2258 if (yyextra->scopeName.isEmpty() ||
leftScopeMatch(s,yyextra->scopeName))
2260 yyextra->scopeName = s;
2264 yyextra->scopeName +=
"::";
2265 yyextra->scopeName += s;
2274 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2275 if (!yyextra->scopeNameLengthStack.empty())
2277 int length = yyextra->scopeNameLengthStack.back();
2278 yyextra->scopeNameLengthStack.pop_back();
2279 yyextra->scopeName.resize(length);
2285 DBG_CTX((stderr,
"popScope() result: '%s'\n",
qPrint(yyextra->scopeName)));
2290 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2293 if (yyextra->searchCtx)
2314 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2320 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
2321 if (ts!=-1 && te!=-1 && te>ts)
2326 while (!yyextra->scopeNameLengthStack.empty())
2330 yyextra->scopeName.clear();
2332 while ((i=n.
find(
"::"))!=-1)
2338 DBG_CTX((stderr,
"--->New class scope '%s'\n",
qPrint(yyextra->scopeName)));
2343 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2344 while (!yyextra->foldStack.empty())
2346 const Definition *dd = yyextra->foldStack.back();
2349 yyextra->code->endFold();
2351 yyextra->foldStack.pop_back();
2366 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2375 if (endLine!=-1 && startLine!=endLine &&
2383 (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
2391 yyextra->code->startFold(yyextra->yyLineNr,
"",
"");
2395 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2399 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2404 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2408 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2410 yyextra->foldStack.push_back(d);
2422 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2424 if (yyextra->sourceFileDef && yyextra->lineNumbers)
2430 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
2432 DBG_CTX((stderr,
"%s:startCodeLine(%d)=%p\n",
qPrint(yyextra->sourceFileDef->name()),yyextra->yyLineNr,(
void*)d));
2433 if (!yyextra->includeCodeFragment && d)
2435 yyextra->currentDefinition = d;
2436 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
2437 yyextra->insideBody =
FALSE;
2438 yyextra->searchingForBody =
TRUE;
2440 yyextra->type.
clear();
2441 yyextra->name.clear();
2442 yyextra->args.clear();
2443 yyextra->parmType.clear();
2444 yyextra->parmName.clear();
2445 DBG_CTX((stderr,
"Real scope: '%s'\n",
qPrint(yyextra->realScope)));
2446 yyextra->bodyCurlyCount = 0;
2448 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
2449 if (yyextra->currentMemberDef)
2452 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
2453 yyextra->currentMemberDef->getOutputFileBase(),
2454 yyextra->currentMemberDef->anchor(),
2455 yyextra->yyLineNr,!yyextra->includeCodeFragment);
2463 QCString(),yyextra->yyLineNr,!yyextra->includeCodeFragment);
2475 !yyextra->includeCodeFragment);
2478 DBG_CTX((stderr,
"startCodeLine(%d)\n",yyextra->yyLineNr));
2479 yyextra->code->startCodeLine(yyextra->yyLineNr);
2480 yyextra->insideCodeLine =
true;
2481 if (yyextra->currentFontClass)
2483 yyextra->code->startFontClass(yyextra->currentFontClass);
2491 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2492 DBG_CTX((stderr,
"endCodeLine(%d)\n",yyextra->yyLineNr));
2494 yyextra->code->endCodeLine();
2495 yyextra->insideCodeLine =
false;
2500 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2501 const char * fc = yyextra->currentFontClass;
2502 if (yyextra->insideCodeLine)
2506 if (yyextra->yyLineNr<yyextra->inputLines)
2508 yyextra->currentFontClass = fc;
2518 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2519 DBG_CTX((stderr,
"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,
qPrint(text)));
2521 const char *p=text.
data(),*sp=p;
2527 while ((c=*p++) && c!=
'\n');
2530 yyextra->yyLineNr++;
2531 size_t l =
static_cast<size_t>(p-sp-1);
2532 yyextra->code->codify(
QCString(sp,l));
2537 yyextra->code->codify(sp);
2546 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2547 if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
2565 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2567 yyextra->tooltipManager.addTooltip(d);
2572 if (!sourceTooltips)
2577 const char *p=text.
data();
2582 while ((c=*p++) && c!=
'\n') { }
2585 yyextra->yyLineNr++;
2601 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2602 if (yyextra->name==
"const") { yyextra->name.clear();
return; }
2603 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2604 yyextra->type += yyextra->name ;
2605 yyextra->name.clear() ;
2606 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2607 yyextra->type += yyextra->args ;
2608 yyextra->args.clear() ;
2613 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2614 if (yyextra->parmName==
"const") { yyextra->parmName.clear();
return; }
2615 if (!yyextra->parmType.isEmpty()) yyextra->parmType +=
' ' ;
2616 yyextra->parmType += yyextra->parmName ;
2617 yyextra->parmName.clear() ;
2623 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2624 if (yyextra->sourceFileDef && !name.
isEmpty())
2629 yyextra->theUsingContext.emplace(name.
str(),nd);
2636 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2639 yyextra->parmName = a.name;
2640 yyextra->parmType = a.type;
2641 int i = yyextra->parmType.find(
'*');
2642 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2643 i = yyextra->parmType.find(
'&');
2644 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2645 yyextra->parmType.stripPrefix(
"const ");
2646 yyextra->parmType=yyextra->parmType.stripWhiteSpace();
2647 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
2653 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2654 DBG_CTX((stderr,
"stripClassName(scope=%s,type=%s) scopeName=%s\n",
2662 QCString clName=className+templSpec;
2664 if (!yyextra->scopeName.isEmpty())
2666 cd=yyextra->symbolResolver.resolveClass(d,yyextra->scopeName+
"::"+clName,
true);
2670 cd=yyextra->symbolResolver.resolveClass(d,clName,
true);
2672 DBG_CTX((stderr,
"stripClass trying '%s' = %p\n",
qPrint(clName),(
void*)cd));
2684 if (name.
isEmpty())
return nullptr;
2685 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2686 DBG_CTX((stderr,
"setCallContextForVar(%s) yyextra->scopeName=%s\n",
qPrint(name),
qPrint(yyextra->scopeName)));
2688 int scopeEnd = name.
findRev(
"::");
2695 if (mcd && !locName.
isEmpty())
2708 if (mnd && !locName.
isEmpty())
2724 DBG_CTX((stderr,
"local variable?\n"));
2728 yyextra->theCallContext.setScope(*mcv);
2733 DBG_CTX((stderr,
"class member? scope=%s\n",
qPrint(yyextra->scopeName)));
2743 if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=
CLASSBLOCK)
2760 const std::unique_ptr<MemberDef> &md=mn->
front();
2761 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2768 else if (mn->
size()>1)
2770 for (
const auto &md : *mn)
2779 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2782 DBG_CTX((stderr,
"returning member %s in source file %s\n",
qPrint(md->name()),
qPrint(yyextra->sourceFileDef->name())));
2794 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2795 const Definition *d = yyextra->theCallContext.getScope().globalDef();
2818 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2819 DBG_CTX((stderr,
"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",
qPrint(c),
qPrint(m),varOnly));
2824 DBG_CTX((stderr,
"scopeNameLengthStack.size()=%zu\n",yyextra->scopeNameLengthStack.size()));
2825 if (!result.
found && !yyextra->scopeNameLengthStack.empty() && c==yyextra->scopeName)
2827 QCString localName = yyextra->scopeName.
mid(yyextra->scopeNameLengthStack[0]+2);
2828 auto it = yyextra->codeClassMap.
find(localName.
str());
2829 if (it!=yyextra->codeClassMap.end())
2836 DBG_CTX((stderr,
"trying lookup via base class %s\n",
qPrint(bcName)));
2839 if (result.
found)
break;
2849 if (yyextra->exampleBlock)
2853 anchor.
sprintf(
"a%d",yyextra->anchorCount);
2855 qPrint(yyextra->exampleFile)));
2857 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
2860 yyextra->anchorCount++;
2874 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n",
2875 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,yyextra->insideBody));
2877 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
2878 yyextra->insideBody && yyextra->collectXRefs)
2900 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2901 DBG_CTX((stderr,
"getLink(%s,%s) yyextra->curClassName=%s\n",
2907 if (!yyextra->curClassName.isEmpty())
2910 c.
prepend(yyextra->curClassName);
2924 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2926 if (!scopeName.
isEmpty() && scopeName[0]==
'~')
2928 scopeName=scopeName.
mid(1);
2932 yyextra->code->codify(
"~");
2935 if (yyextra->insideProtocolList)
2939 if (yyextra->lang==SrcLangExt::PHP)
2943 else if (yyextra->lang==SrcLangExt::CSharp || yyextra->lang==SrcLangExt::Java)
2947 if (yyextra->currentDefinition==
nullptr && !yyextra->scopeName.isEmpty())
2949 scopeName = yyextra->scopeName+
"::"+scopeName;
2955 DBG_CTX((stderr,
"generateClassOrGlobalLink(name=%s) yyextra->scopeName=%s scopeName=%s\n",
qPrint(scName),
qPrint(yyextra->scopeName),
qPrint(scopeName)));
2956 if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(scopeName))==
nullptr)
2958 int i=scopeName.
find(
'<');
2960 if (i!=-1) bareName = bareName.
left(i);
2962 auto checkForSymbol = [&yyg,&bareName,&scopeName](
const Definition *
parent,
2965 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,scopeName,
QCString(),
false,
true);
2966 DBG_CTX((stderr,
"non-local variable name=%s sym=%s!\n",
2967 qPrint(scopeName),sym_?
qPrint(sym_->name()):
"<none>"));
2968 if (sym_==
nullptr && !bareName.
isEmpty())
2971 if (bareName!=scopeName)
2973 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,bareName,
QCString(),
false,
true);
2977 const Definition *d = yyextra->currentDefinition;
2978 DBG_CTX((stderr,
"d=%s yyextra->sourceFileDef=%s\n",d?
qPrint(d->
name()):
"<none>",yyextra->sourceFileDef?
qPrint(yyextra->sourceFileDef->name()):
"<none>"));
2979 checkForSymbol(d,sym);
2988 checkForSymbol(nd,sym);
2996 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2998 checkForSymbol(namespaceDef,sym);
3020 DBG_CTX((stderr,
"is found as a type sym=%s nd=%s\n",
3025 if (
getLink(yyscanner,yyextra->scopeName,scName,ol,scName,varOnly))
3033 DBG_CTX((stderr,
"local variable!\n"));
3037 yyextra->theCallContext.setScope(*lcd);
3048 DBG_CTX((stderr,
"is a local variable sym=%p!\n",(
void*)sym));
3050 yyextra->isPrefixedWithThis =
FALSE;
3055 if (yyextra->exampleBlock)
3059 anchor.
sprintf(
"_a%d",yyextra->anchorCount);
3060 DBG_CTX((stderr,
"addExampleClass(%s,%s,%s)\n",
qPrint(anchor),
qPrint(yyextra->exampleName),
3061 qPrint(yyextra->exampleFile)));
3065 if (cdm && cdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3068 yyextra->anchorCount++;
3074 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3077 yyextra->anchorCount++;
3091 yyextra->currentMemberDef && yyextra->collectXRefs)
3100 DBG_CTX((stderr,
"class %s not linkable! cd=%p typeOnly=%d\n",
qPrint(scName),(
void*)sym,typeOnly));
3101 if (!isLocal && (md || (!sym && !typeOnly)))
3106 DBG_CTX((stderr,
"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%s\n",
qPrint(scName),(
void*)md,yyextra->currentDefinition ?
qPrint(yyextra->currentDefinition->name()) :
"<none>"));
3107 if (md && yyextra->currentDefinition)
3109 DBG_CTX((stderr,
"%s accessible from %s? %d md->getOuterScope=%s\n",
3110 qPrint(md->name()),
qPrint(yyextra->currentDefinition->name()),
3111 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md),
3112 qPrint(md->getOuterScope()->name())));
3115 if (md && yyextra->currentDefinition &&
3116 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md)==-1)
3123 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()));
3124 if (md->isLinkable())
3128 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3138 DBG_CTX((stderr,
"not found!\n"));
3149 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3153 DBG_CTX((stderr,
"type='%s' args='%s' class=%s\n",
3157 if (yyextra->exampleBlock)
3161 anchor.
sprintf(
"a%d",yyextra->anchorCount);
3163 qPrint(yyextra->exampleFile)));
3165 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3168 yyextra->anchorCount++;
3182 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",
3183 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,(
void*)xmd,yyextra->insideBody));
3185 if (xmd->templateMaster()) xmd = xmd->templateMaster();
3187 if (xmd->isLinkable())
3190 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
3191 yyextra->insideBody && yyextra->collectXRefs)
3211 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3216 DBG_CTX((stderr,
"generateClassMemberLink(class=%s,member=%s)=%p\n",
qPrint(def->
name()),
qPrint(memName),(
void*)xmd));
3254 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3255 DBG_CTX((stderr,
"generateMemberLink(object=%s,mem=%s) classScope=%s\n",
3258 if (varName.
isEmpty())
return;
3266 DBG_CTX((stderr,
"Class found!\n"));
3269 DBG_CTX((stderr,
"Found result!\n"));
3276 if (
getLink(yyscanner,bcName,memName,ol))
3278 DBG_CTX((stderr,
"Found result!\n"));
3287 const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->scopeName,
true);
3290 DBG_CTX((stderr,
"Found class %s for variable '%s'\n",
qPrint(yyextra->scopeName),
qPrint(varName)));
3304 for (
const auto &vmd : *vmn)
3306 if (vmd->getClassDef()==jcd)
3308 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3321 DBG_CTX((stderr,
"There is a variable with name '%s'\n",
qPrint(varName)));
3322 for (
const auto &vmd : *vmn)
3324 if (vmd->getClassDef()==vcd)
3326 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3345 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3348 DBG_CTX((stderr,
"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,
qPrint(name),
qPrint(yyextra->scopeName)));
3349 if (!
getLink(yyscanner,yyextra->scopeName,name,ol,varName))
3357 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3359 QCString locScope=yyextra->scopeName;
3361 if (yyextra->lang==SrcLangExt::PHP && locFunc.
startsWith(
"self::")) locFunc=locFunc.
mid(4);
3364 QCString funcWithFullScope=locFunc;
3369 if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() &&
3370 funcName==yyextra->currentMemberDef->localName() &&
3371 yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr &&
3395 funcScope=locFunc.
left(i);
3397 int ts=locScope.
find(
'<');
3399 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3400 if (ts!=-1 && te!=-1 && te>ts)
3405 ts=funcScope.
find(
'<');
3407 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3408 if (ts!=-1 && te!=-1 && te>ts)
3411 funcScope=funcScope.
left(ts)+funcScope.
right(funcScope.
length()-te-1);
3415 funcWithScope = funcScope+
"::"+locFunc;
3418 fullScope=locScope+
"::"+funcScope;
3423 funcWithFullScope = locScope+
"::"+funcWithScope;
3429 auto it = yyextra->codeClassMap.find(fullScope.
str());
3430 if (it!=yyextra->codeClassMap.end())
3437 if (
getLink(yyscanner,bcName,locFunc,ol,funcName))
3446 if (!locScope.
isEmpty() && fullScope!=locScope)
3448 auto it = yyextra->codeClassMap.find(locScope.
str());
3449 if (it!=yyextra->codeClassMap.end())
3456 if (
getLink(yyscanner,bcName,funcWithScope,ol,funcName))
3464 if (!
getLink(yyscanner,locScope,funcWithScope,ol,funcName))
3475 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3476 const char *p=yyextra->inputString;
3482 if (c==
'\n') count++;
3484 if (p>yyextra->inputString && *(p-1)!=
'\n')
3493 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3494 if (yyextra->currentFontClass)
3496 yyextra->code->endFontClass();
3497 yyextra->currentFontClass=
nullptr;
3499 if (specialComment && yyextra->insideSpecialComment)
3501 yyextra->code->endSpecialComment();
3502 yyextra->insideSpecialComment =
false;
3508 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3512 yyextra->code->startSpecialComment();
3513 yyextra->insideSpecialComment =
true;
3515 yyextra->code->startFontClass(s);
3516 yyextra->currentFontClass=s;
3524 if (ctx==
nullptr)
return;
3525 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3529 DBG_CTX((stderr,
"writeObjCMethodCall(%s) obj=%s method=%s\n",
3538 DBG_CTX((stderr,
" object is local variable\n"));
3546 DBG_CTX((stderr,
" class=%p method=%p\n",(
void*)cd,(
void*)ctx->
method));
3557 char skipChar =
' ';
3582 yyextra->code->codify(
"$");
3590 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3592 int refId=refIdStr.
toInt();
3593 auto it = yyextra->nameMap.find(refId);
3594 if (it!=yyextra->nameMap.end())
3600 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3612 DBG_CTX((stderr,
"Invalid name: id=%d\n",refId));
3619 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3621 int refId=refIdStr.
toInt();
3622 auto it = yyextra->objectMap.find(refId);
3623 if (it!=yyextra->objectMap.end())
3628 if (yyextra->currentDefinition &&
3645 else if (
object==
"super")
3647 if (yyextra->currentDefinition &&
3674 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3687 int dotPos=
object.find(
'.',pp);
3688 int len =
static_cast<int>(
object.length());
3689 if (dotPos==-1) dotPos=len;
3690 const Definition *scope = yyextra->currentDefinition;
3697 if (fragmentStripped==
"self")
3710 const Definition *symbol = yyextra->symbolResolver.resolveSymbol(scope,fragmentStripped,
QCString(),
false,
true);
3716 ctx->
method = yyextra->symbolResolver.getTypedef();
3740 dotPos=
object.find(
'.',pp);
3741 if (dotPos==-1) dotPos=len;
3750 else if (ctx->
method==
nullptr)
3753 DBG_CTX((stderr,
"yyextra->currentDefinition=%p\n",(
void*)yyextra->currentDefinition));
3754 if (yyextra->currentDefinition &&
3775 DBG_CTX((stderr,
"Invalid object: id=%d\n",refId));
3782 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3784 int refId=refIdStr.
toInt();
3785 auto it = yyextra->contextMap.find(refId);
3786 if (it!=yyextra->contextMap.end())
3801 if (mn && mn->
size()==1)
3819 DBG_CTX((stderr,
"Invalid context: id=%d\n",refId));
3826 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3828 int refId=refIdStr.
toInt();
3829 auto it = yyextra->wordMap.find(refId);
3830 if (it!=yyextra->wordMap.end())
3833 bool isKeyword = word==
"self";
3849 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3851 int refId=refIdStr.
toInt();
3852 auto it = yyextra->commentMap.find(refId);
3853 if (it!=yyextra->commentMap.end())
3867 else if (c==
'\'' || c ==
'"')
3884 DBG_CTX((stderr,
"}=(type='%s',name='%s')",
3894 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3896 result.
sprintf(
"$n%d",yyextra->currentNameId);
3897 yyextra->nameMap.emplace(yyextra->currentNameId,s);
3898 yyextra->currentNameId++;
3904 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3906 result.
sprintf(
"$o%d",yyextra->currentObjId);
3907 yyextra->objectMap.emplace(yyextra->currentObjId,s);
3908 yyextra->currentObjId++;
3914 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3916 result.
sprintf(
"$w%d",yyextra->currentWordId);
3917 yyextra->wordMap.emplace(yyextra->currentWordId,s);
3918 yyextra->currentWordId++;
3924 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3926 result.
sprintf(
"$d%d",yyextra->currentCommentId);
3927 yyextra->commentMap.emplace(yyextra->currentCommentId,s);
3928 yyextra->currentCommentId++;
3934 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3935 static const std::unordered_set<std::string> non_cpp_keywords = {
3936 "__assume",
"__super",
"abstract",
"function",
3937 "gcnew",
"gcroot",
"generic",
"get",
3938 "internal",
"null",
"pin_ptr",
"raise",
3939 "remove",
"self",
"set",
"transient",
3942 static const std::unordered_set<std::string> non_java_keywords = {
3943 "alignas",
"alignof",
"and",
"and_eq",
"asm",
3944 "atomic_cancel",
"atomic_commit",
"atomic_noexcept",
"auto",
"bitand",
3945 "bitor",
"bool",
"char8_t",
"char16_t",
"char32_t",
3946 "compl",
"concept",
"consteval",
"constexpr",
"constinit",
3947 "const_cast",
"co_await",
"co_return",
"co_yield",
"decltype",
3948 "delete",
"dynamic_cast",
"explicit",
"export",
"extern",
3949 "friend",
"inline",
"mutable",
"namespace",
"noexcept",
3950 "not",
"not_eq",
"nullptr",
"operator",
"or",
3951 "or_eq",
"reflexpr",
"register",
"reinterpret_cast",
"requires",
3952 "signed",
"sizeof",
"static_assert",
"_Static_assert",
"static_cast",
"struct",
3953 "template",
"thread_local",
"typedef",
"typeid",
"typename",
3954 "union",
"unsigned",
"using",
"virtual",
"wchar_t",
3955 "xor",
"xor_eq",
"override",
"sealed"
3957 bool retval =
false;
3958 switch (yyextra->lang)
3960 case SrcLangExt::Cpp:
3961 retval = (non_cpp_keywords.find(keyword) != non_cpp_keywords.end());
3963 case SrcLangExt::Java:
3964 retval = (non_java_keywords.find(keyword) != non_java_keywords.end());
3977 if (i==-1)
return FALSE;
3979 return kw==
"const_cast" || kw==
"static_cast" || kw==
"dynamic_cast" || kw==
"reinterpret_cast";
3984 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3985 yy_size_t inputPosition = yyextra->inputPosition;
3986 const char *s = yyextra->inputString + inputPosition;
3988 while( c < max_size && *s )
3993 yyextra->inputPosition += c;
4000 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4001 if (yyextra->currentCtx)
4003 yyextra->currentCtx->format+=
QCString().
sprintf(
"$c%d",yyextra->currentCtxId);
4004 if (yyextra->braceCount==0 && YY_START==ObjCCall)
4006 yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1);
4007 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
4009 yyextra->contextStack.push(yyextra->currentCtx);
4013 DBG_CTX((stderr,
"Trying to save NULL context!\n"));
4015 auto newCtx = std::make_unique<ObjCCallCtx>();
4016 newCtx->id = yyextra->currentCtxId;
4017 newCtx->lexState = YY_START;
4018 newCtx->braceCount = yyextra->braceCount;
4019 newCtx->objectType =
nullptr;
4020 newCtx->objectVar =
nullptr;
4021 newCtx->method =
nullptr;
4022 DBG_CTX((stderr,
"save state=%d\n",YY_START));
4023 yyextra->currentCtx = newCtx.get();
4024 yyextra->contextMap.emplace(yyextra->currentCtxId,std::move(newCtx));
4025 yyextra->braceCount = 0;
4026 yyextra->currentCtxId++;
4031 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4032 DBG_CTX((stderr,
"restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState));
4033 BEGIN(yyextra->currentCtx->lexState);
4034 yyextra->braceCount = yyextra->currentCtx->braceCount;
4035 if (!yyextra->contextStack.empty())
4037 yyextra->currentCtx = yyextra->contextStack.top();
4038 yyextra->contextStack.pop();
4042 yyextra->currentCtx =
nullptr;
4043 DBG_CTX((stderr,
"Trying to pop context while yyextra->contextStack is empty!\n"));
4055 codeYYlex_init_extra(&
p->state,&
p->yyscanner);
4064 codeYYlex_destroy(
p->yyscanner);
4069 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4070 DBG_CTX((stderr,
"***CodeParser::reset()\n"));
4071 yyextra->theVarContext.clear();
4072 while (!yyextra->scopeNameLengthStack.empty()) yyextra->scopeNameLengthStack.pop_back();
4073 yyextra->codeClassMap.clear();
4074 yyextra->curClassBases.clear();
4075 yyextra->anchorCount = 0;
4076 yyextra->insideCodeLine =
false;
4081 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4082 yyextra->insideCodeLine = inp;
4087 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4088 return yyextra->insideCodeLine;
4095 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4096 DBG_CTX((stderr,
"***parseCode() exBlock=%d exName=%s fd=%p scopeName=%s searchCtx=%s\n",
4106 yyextra->code = &od;
4107 yyextra->inputString = s.
data();
4110 yyextra->inputPosition = 0;
4111 codeYYrestart(
nullptr,yyscanner);
4112 yyextra->currentFontClass =
nullptr;
4113 yyextra->searchCtx = options.
searchCtx();
4115 yyextra->inFunctionTryBlock =
FALSE;
4116 yyextra->symbolResolver.setFileScope(options.
fileDef());
4117 yyextra->foldStack.clear();
4118 yyextra->insideSpecialComment =
false;
4121 yyextra->curlyCount = 0;
4122 yyextra->bodyCurlyCount = 0;
4123 yyextra->bracketCount = 0;
4124 yyextra->sharpCount = 0;
4125 yyextra->insideTemplate =
FALSE;
4126 yyextra->theCallContext.clear();
4127 while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
4128 yyextra->scopeName = scopeName;
4130 yyextra->exampleBlock = options.
isExample();
4132 yyextra->sourceFileDef = options.
fileDef();
4134 if (options.
fileDef()==
nullptr)
4138 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
4140 yyextra->lang = lang;
4141 yyextra->insideObjC = lang==SrcLangExt::ObjC;
4142 if (yyextra->sourceFileDef)
4147 yyextra->currentMemberDef =
nullptr;
4148 yyextra->searchingForBody = options.
isExample();
4149 yyextra->insideBody =
FALSE;
4150 yyextra->bracketCount = 0;
4151 if (!yyextra->exampleName.isEmpty())
4154 DBG_CTX((stderr,
"yyextra->exampleFile=%s\n",
qPrint(yyextra->exampleFile)));
4158 if (!yyextra->insideCodeLine)
4162 yyextra->type.clear();
4163 yyextra->name.clear();
4164 yyextra->args.clear();
4165 yyextra->parmName.clear();
4166 yyextra->parmType.clear();
4169 codeYYlex(yyscanner);
4170 yyextra->lexInit=
TRUE;
4171 if (yyextra->insideCodeLine)
4177 while (!yyextra->foldStack.empty())
4179 yyextra->code->endFold();
4180 yyextra->foldStack.pop_back();
4183 if (yyextra->exampleFileDef)
4186 yyextra->exampleFileDef.reset();
4187 yyextra->sourceFileDef=
nullptr;
4190 yyextra->tooltipManager.writeTooltips(od);
void resetCodeParserState() override
Resets the state of the code parser.
void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool stripCodeComments, const CodeParserOptions &options) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
void setInsideCodeLine(bool inp)
std::unique_ptr< Private > p
bool insideCodeLine() const
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual const MemberDef * getMemberByName(const QCString &) const =0
Returns the member with the given name.
virtual ClassDef * categoryOf() const =0
Returns the class of which this is a category (Objective-C only).
virtual FileDef * getFileDef() const =0
Returns the namespace this compound is in, or 0 if it has a global scope.
virtual bool addExample(const QCString &anchor, const QCString &name, const QCString &file)=0
static bool isFlagSet(const DebugMask mask)
virtual int getEndBodyLine() const =0
virtual DefType definitionType() const =0
virtual QCString anchor() const =0
virtual QCString briefDescriptionAsTooltip() const =0
virtual bool isLinkableInProject() const =0
virtual const Definition * findInnerCompound(const QCString &name) const =0
virtual int getStartDefLine() const =0
virtual QCString getReference() const =0
virtual QCString qualifiedName() const =0
virtual CodeSymbolType codeSymbolType() const =0
virtual QCString getOutputFileBase() const =0
virtual Definition * getOuterScope() const =0
static NamespaceLinkedMap * namespaceLinkedMap
static MemberNameLinkedMap * functionNameLinkedMap
static std::mutex countFlowKeywordsMutex
static MemberNameLinkedMap * memberNameLinkedMap
static SearchIndexIntf searchIndex
static std::mutex addExampleMutex
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
virtual QCString fileName() const =0
std::vector< QCString > baseClasses() const
virtual QCString typeString() const =0
virtual const ClassDef * getClassDef() const =0
virtual GroupDef * getGroupDef()=0
virtual const FileDef * getFileDef() const =0
virtual const ArgumentList & argumentList() const =0
virtual MemberDef * resolveAlias()=0
virtual bool isDefine() const =0
virtual bool isVariable() const =0
virtual QCString argsString() const =0
virtual bool isCallable() const =0
virtual void incrementFlowKeyWordCount()=0
virtual bool addExample(const QCString &anchor, const QCString &name, const QCString &file)=0
An abstract interface of a namespace symbol.
virtual const MemberDef * getMemberByName(const QCString &) const =0
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
void writeCodeAnchor(const QCString &name)
void stripCodeComments(bool b)
int toInt(bool *ok=nullptr, int base=10) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
bool startsWith(const char *s) const
char & at(size_t i)
Returns a reference to the character at index i.
bool isEmpty() const
Returns TRUE iff the string is empty.
const std::string & str() const
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
QCString right(size_t len) const
QCString & sprintf(const char *format,...)
int findRev(char c, int index=-1, bool cs=TRUE) const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
bool stripPrefix(const QCString &prefix)
const Definition * globalDef() const
ClassDefMutable * toClassDefMutable(Definition *d)
ClassDef * getClass(const QCString &n)
static void codeFolding(yyscan_t yyscanner, const Definition *d)
ConceptDef * getResolvedConcept(const Definition *d, const QCString &name)
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
void addDocCrossReference(const MemberDef *s, const MemberDef *d)
MemberDefMutable * toMemberDefMutable(Definition *d)
MemberDef * toMemberDef(Definition *d)
NamespaceDef * getResolvedNamespace(const QCString &name)
NamespaceDef * toNamespaceDef(Definition *d)
This class contains the information about the argument of a function or template.
Options to configure the code parser.
const Definition * searchCtx() const
const FileDef * fileDef() const
const MemberDef * memberDef() const
bool showLineNumbers() const
bool inlineFragment() const
QCString exampleName() const
bool collectXRefs() const
int extractClassNameFromType(const QCString &type, int &pos, QCString &name, QCString &templSpec, SrcLangExt lang)
bool leftScopeMatch(const QCString &scope, const QCString &name)
QCString removeAnonymousScopes(const QCString &str)
QCString convertNameToFile(const QCString &name, bool allowDots, bool allowUnderscore)
GetDefResult getDefs(const GetDefInput &input)