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
98 OutputCodeList *
code =
nullptr;
179 std::unordered_map< int,std::unique_ptr<ObjCCallCtx> >
contextMap;
265#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
A abstract class representing of a compound symbol.
The common base class of all entity definitions found in the sources.
A model of a class/file/namespace member symbol.
Class representing a list of different code generators.
This is an alternative implementation of QCString.
static bool isCastKeyword(const char *s)
static void pushScope(yyscan_t yyscanner, const QCString &s)
static void writeMultiLineCodeLink(yyscan_t yyscanner, OutputCodeList &ol, const Definition *d, const QCString &text)
static QCString escapeName(yyscan_t yyscanner, const char *s)
static void endCodeLine(yyscan_t yyscanner)
static bool skipLanguageSpecificKeyword(yyscan_t yyscanner, const char *kw)
static QCString escapeWord(yyscan_t yyscanner, const char *s)
static void generateClassOrGlobalLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &clName, bool typeOnly=FALSE, bool varOnly=FALSE)
static void restoreObjCContext(yyscan_t yyscanner)
static void nextCodeLine(yyscan_t yyscanner)
static void popScope(yyscan_t yyscanner)
static void startCodeLine(yyscan_t yyscanner)
static void codifyLines(yyscan_t yyscanner, const QCString &text)
static void incrementFlowKeyWordCount(yyscan_t yyscanner)
static bool startsWithKeyword(const QCString &str, const QCString &kw)
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
static int countLines(yyscan_t yyscanner)
static void addToSearchIndex(yyscan_t yyscanner, const QCString &text)
static const char * stateToString(int state)
static void addParmType(yyscan_t yyscanner)
static bool getLinkInScope(yyscan_t yyscanner, const QCString &c, const QCString &m, const QCString &memberText, OutputCodeList &ol, const QCString &text, bool varOnly=FALSE)
static const ClassDef * stripClassName(yyscan_t yyscanner, const QCString &s, const Definition *d)
static void updateCallContextForSmartPointer(yyscan_t yyscanner)
static QCString escapeObject(yyscan_t yyscanner, const char *s)
static void generateMemberLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &varName, const QCString &memName)
static void addUsingDirective(yyscan_t yyscanner, const QCString &name)
static bool getLink(yyscan_t yyscanner, const QCString &className, const QCString &memberName, OutputCodeList &ol, const QCString &text=QCString(), bool varOnly=FALSE)
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
static const MemberDef * setCallContextForVar(yyscan_t yyscanner, const QCString &name)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
static QCString escapeComment(yyscan_t yyscanner, const char *s)
static void generateFunctionLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &funcName)
static void addVariable(yyscan_t yyscanner, QCString type, QCString name)
static const char * getLexerFILE()
static void setClassScope(yyscan_t yyscanner, const QCString &name)
static bool generateClassMemberLink(yyscan_t yyscanner, OutputCodeList &ol, const MemberDef *xmd, const QCString &memName)
static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
static void setParameterList(yyscan_t yyscanner, const MemberDef *md)
static void addType(yyscan_t yyscanner)
static void saveObjCContext(yyscan_t yyscanner)
static void writeObjCMethodCall(yyscan_t yyscanner, ObjCCallCtx *ctx)
static void endCodeFold(yyscan_t yyscanner)
static void generatePHPVariableLink(yyscan_t yyscanner, OutputCodeList &ol, const char *varName)
std::vector< std::string > StringVector
Web server based search engine.
QCString objectTypeOrName
const MemberDef * objectVar
const ClassDef * objectType
StringVector curClassBases
CallContext theCallContext
std::unordered_map< int, QCString > commentMap
const Definition * currentDefinition
std::unique_ptr< FileDef > exampleFileDef
std::unordered_map< int, QCString > wordMap
const char * currentFontClass
std::stack< int > scopeStack
1 if bracket starts a scope,
const FileDef * sourceFileDef
std::unordered_map< int, QCString > objectMap
std::unordered_map< int, std::unique_ptr< ObjCCallCtx > > contextMap
VariableContext theVarContext
TooltipManager tooltipManager
std::vector< int > scopeNameLengthStack
std::map< std::string, const NamespaceDef * > UsingContext
const char * inputString
the code fragment as text
const Definition * searchCtx
SymbolResolver symbolResolver
yy_size_t inputPosition
read offset during parsing
bool insideSpecialComment
int yyLineNr
current line number
std::vector< const Definition * > foldStack
int lastVerbStringContext
int inputLines
number of line in the code fragment
const MemberDef * currentMemberDef
std::unordered_map< std::string, ScopedTypeVariant > codeClassMap
UsingContext theUsingContext
std::unordered_map< int, QCString > nameMap
bool skipCodify
for CSharp files scoped namespace {
std::stack< ObjCCallCtx * > contextStack
int skipInlineInitContext
SrcLangExt
Language as given by extension.
A bunch of utility functions.
276ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
278SCOPENAME ("::"{BN}*)?({ID}{BN}*{SEP}{BN}*)*("~"{BN}*)?{ID}
279TEMPLIST "<"[^\"\}\{\(\)\/\n>]*">"
280SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID})
281SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+
282KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property")
284KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"null"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"sealed"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|"concept"|"requires"|"decltype"|{KEYWORD_OBJC}|"constexpr"|"consteval"|"constinit"|"co_await"|"co_return"|"co_yield"|"static_assert"|"_Static_assert"|"noexcept"|"thread_local"|"enum"{B}+("class"|"struct"))
285FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally")
286FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try")
287TYPEKW ("bool"|"byte"|"char"|"char8_t"|"char16_t"|"char32_t"|"double"|"float"|"int"|"long"|"object"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"size_t"|"boolean"|"id"|"SEL"|"string"|"nullptr")
288TYPEKWSL ("LocalObject"|"Object"|"Value")
289CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast")
290CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'"))
291ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++"
292ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|="
293LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"|"<=>"
294BITOP "&"|"|"|"^"|"<<"|">>"|"~"
295OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
296RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
297RAWEND ")"[^ \t\(\)\\]{0,16}\"
298MODULE_ID ({ID}".")*{ID}
304DECIMAL_INTEGER [1-9][0-9']*[0-9]?[uU]?[lL]?[lL]?
305HEXADECIMAL_INTEGER "0"[xX][0-9a-zA-Z']+[0-9a-zA-Z]?
306OCTAL_INTEGER "0"[0-7][0-7']+[0-7]?
307BINARY_INTEGER "0"[bB][01][01']*[01]?
308INTEGER_NUMBER {DECIMAL_INTEGER}|{HEXADECIMAL_INTEGER}|{OCTAL_INTEGER}|{BINARY_INTEGER}
312DIGIT_SEQ [0-9][0-9']*[0-9]?
313FRAC_CONST {DIGIT_SEQ}"."|{DIGIT_SEQ}?"."{DIGIT_SEQ}
314FP_EXP [eE][+-]?{DIGIT_SEQ}
315DEC_FP1 {FRAC_CONST}{FP_EXP}?{FP_SUF}?
316DEC_FP2 {DIGIT_SEQ}{FP_EXP}{FP_SUF}
318HEX_DIGIT_SEQ [0-9a-fA-F][0-9a-fA-F']*[0-9a-fA-F]?
319HEX_FRAC_CONST {HEX_DIGIT_SEQ}"."|{HEX_DIGIT_SEQ}?"."{HEX_DIGIT_SEQ}
320BIN_EXP [pP][+-]?{DIGIT_SEQ}
321HEX_FP1 "0"[xX]{HEX_FRAC_CONST}{BIN_EXP}{FP_SUF}?
322HEX_FP2 "0"[xX]{HEX_DIGIT_SEQ}{BIN_EXP}{FP_SUF}?
324FLOAT_DECIMAL {DEC_FP1}|{DEC_FP2}
325FLOAT_HEXADECIMAL {HEX_FP1}|{HEX_FP2}
326FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL}
327NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
340ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"sealed"|"override"))*
360%x CppCliTypeModifierFollowup
385<Body>^([ \t]*"#"[ \t]*("include"|"import")[ \t]*)("<"|"\"") {
387 yyextra->code->codify(yytext);
388 BEGIN( ReadInclude );
390<Body>("@interface"|"@implementation"|"@protocol")[ \t\n]+ {
391 yyextra->insideObjC=
TRUE;
395 if (!yyextra->insideTemplate)
398<Body>(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") {
399 if (yyextra->insideTemplate) REJECT;
405<Body>"property"|"event"/{BN}* {
406 if (yyextra->insideTemplate) REJECT;
411<Body>("partial"{B}+)?("class"|"struct"|"union"|"namespace"|"interface"){B}+ {
415 if (!yyextra->insideTemplate)
418<Body>("package")[ \t\n]+ {
422 BEGIN( PackageName );
425 if (!yyextra->insideObjC) REJECT;
429<Body,ClassVar,Bases>"-"|"+" {
430 if (!yyextra->insideObjC || yyextra->insideBody)
432 yyextra->code->codify(yytext);
436 DBG_CTX((stderr,
"Start of Objective-C method!\n"));
437 yyextra->code->codify(yytext);
442 yyextra->code->codify(yytext);
446 yyextra->code->codify(yytext);
447 BEGIN(ObjCParamType);
449<ObjCParams,ObjCMethod>";"|"{" {
450 yyextra->code->codify(yytext);
453 if (yyextra->searchingForBody)
455 yyextra->searchingForBody=
FALSE;
456 yyextra->insideBody=
TRUE;
458 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
459 if (!yyextra->curClassName.isEmpty())
461 pushScope(yyscanner,yyextra->curClassName);
462 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
466 yyextra->type.clear();
467 yyextra->name.clear();
470<ObjCParams>{ID}{B}*":" {
471 yyextra->code->codify(yytext);
473<ObjCParamType>{TYPEKW} {
475 yyextra->code->codify(yytext);
477 yyextra->parmType=yytext;
481 yyextra->parmType=yytext;
484 yyextra->code->codify(yytext);
488 yyextra->code->codify(yytext);
489 yyextra->parmName=yytext;
490 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
491 yyextra->parmType.clear();yyextra->parmName.clear();
493<ObjCMethod,ObjCParams,ObjCParamType>{ID} {
496<ObjCMethod,ObjCParams,ObjCParamType>. {
497 yyextra->code->codify(yytext);
499<ObjCMethod,ObjCParams,ObjCParamType>\n {
502<ReadInclude>[^\n\">]+/(">"|"\"") {
513 DBG_CTX((stderr,
"===== yes %s is ambiguous\n",yytext));
515 if (!name.isEmpty() && yyextra->sourceFileDef)
521 auto it = std::find_if(fn->begin(),
523 [&sfd=yyextra->sourceFileDef]
525 { return sfd->isIncluded(lfd->absFilePath()); });
526 found = it!=fn->end();
542 yyextra->code->codify(yytext);
544 char c=(char)yyinput(yyscanner);
547 yyextra->code->codify(text);
virtual bool isLinkable() const =0
static std::string cleanDirPath(const std::string &path)
static FileNameLinkedMap * inputNameLinkedMap
A model of a file symbol.
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)
551<Body,Bases>^[ \t]*"#" {
553 yyextra->lastSkipCppContext = YY_START;
554 yyextra->code->codify(yytext);
558 yyextra->code->codify(yytext);
559 yyextra->lastStringContext=YY_START;
560 BEGIN( SkipString ) ;
563 yyextra->code->codify(yytext);
565<SkipCPP>[^\n\/\\\"]+ {
566 yyextra->code->codify(yytext);
571<SkipCPP>{CPPC}/[^/!] {
575 yyextra->theVarContext.pushScope();
576 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
577 yyextra->bracketCount = 0;
580 if (yyextra->type.find(
"enum ")!=-1)
582 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
588 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
592 if (yyextra->searchingForBody)
594 yyextra->searchingForBody=
FALSE;
595 yyextra->insideBody=
TRUE;
597 yyextra->code->codify(yytext);
598 if (yyextra->insideBody)
600 yyextra->bodyCurlyCount++;
602 yyextra->type.clear();
603 yyextra->name.clear();
606<Body,FuncCall,MemberCall,MemberCall2>"}" {
607 yyextra->theVarContext.popScope();
608 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
609 yyextra->type.clear();
610 yyextra->name.clear();
612 if (!yyextra->scopeStack.empty())
614 int scope = yyextra->scopeStack.top();
615 yyextra->scopeStack.pop();
623 yyextra->code->codify(yytext);
625 DBG_CTX((stderr,
"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount));
626 if (--yyextra->bodyCurlyCount<=0)
628 yyextra->insideBody=
FALSE;
629 yyextra->currentMemberDef=
nullptr;
630 if (yyextra->currentDefinition)
631 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
635<Body,ClassVar>"@end" {
636 DBG_CTX((stderr,
"End of objc scope fd=%s\n",
qPrint(yyextra->sourceFileDef->name())));
637 if (yyextra->sourceFileDef)
639 const FileDef *fd=yyextra->sourceFileDef;
642 DBG_CTX((stderr,
"insideObjC=%d\n",yyextra->insideObjC));
646 yyextra->insideObjC =
FALSE;
648 if (yyextra->insideBody)
650 yyextra->theVarContext.popScope();
652 if (!yyextra->scopeStack.empty())
654 int scope = yyextra->scopeStack.top();
655 yyextra->scopeStack.pop();
662 yyextra->insideBody=
FALSE;
666 yyextra->code->codify(yytext);
669 yyextra->currentMemberDef=
nullptr;
670 if (yyextra->currentDefinition)
671 yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
virtual const QCString & name() const =0
bool endsWith(const char *s) const
674<ClassName,ClassVar>";" {
677 yyextra->code->codify(yytext);
678 yyextra->skipCodify =
true;
683 yyextra->code->codify(yytext);
684 yyextra->searchingForBody=
FALSE;
688<ClassName,ClassVar>[*&^%]+ {
689 yyextra->type=yyextra->curClassName;
690 yyextra->name.clear();
691 yyextra->code->codify(yytext);
694<ClassName>"__declspec"{B}*"("{B}*{ID}{B}*")" {
696 yyextra->code->codify(yytext);
699<ClassName>{ID}("."{ID})* |
700<ClassName>{ID}("::"{ID})* {
702 yyextra->curClassName=
substitute(yytext,
".",
"::");
704 yyextra->curClassName=yytext;
706 if (yyextra->curClassName==
"alignas")
709 yyextra->code->codify(yytext);
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
720 yyextra->bracketCount=1;
721 yyextra->code->codify(yytext);
724<AlignAs>\n { yyextra->yyLineNr++;
727<AlignAs>. { yyextra->code->codify(yytext); }
728<AlignAsEnd>"(" { yyextra->code->codify(yytext);
729 yyextra->bracketCount++;
732 yyextra->code->codify(yytext);
733 if (--yyextra->bracketCount<=0)
738<AlignAsEnd>\n { yyextra->yyLineNr++;
741<AlignAsEnd>. { yyextra->code->codify(yytext); }
742<ClassName>{ID}("\\"{ID})* {
743 yyextra->curClassName=
substitute(yytext,
"\\",
"::");
745 pushScope(yyscanner,yyextra->curClassName);
750<ClassName>{ID}{B}*"("{ID}")" {
753 pushScope(yyscanner,yyextra->curClassName);
QCString removeRedundantWhiteSpace(const QCString &s)
758<PackageName>{ID}("."{ID})* {
759 yyextra->curClassName=
substitute(yytext,
".",
"::");
760 DBG_CTX((stderr,
"found package: %s\n",
qPrint(yyextra->curClassName)));
768<ClassVar>("extends"|"implements") {
772 yyextra->curClassBases.clear();
775<ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") {
776 DBG_CTX((stderr,
"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,
qPrint(yyextra->curClassName)));
780 BEGIN( CppCliTypeModifierFollowup );
783 yyextra->type = yyextra->curClassName;
784 yyextra->name = yytext;
785 if (yyextra->insideBody)
787 addVariable(yyscanner,yyextra->type,yyextra->name);
791<ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*":"{B}* {
793 yyextra->curClassBases.clear();
796<PackageName>[ \t]*";" |
797<Bases>^{Bopt}/"@"{ID} |
798<Bases,ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*"{"{B}* {
799 yyextra->theVarContext.pushScope();
800 if (!yyextra->skipCodify) yyextra->code->codify(yytext);
801 yyextra->skipCodify =
false;
802 if (YY_START==ClassVar && yyextra->curClassName.isEmpty())
804 yyextra->curClassName = yyextra->name;
806 if (yyextra->searchingForBody)
808 yyextra->searchingForBody=
FALSE;
809 yyextra->insideBody=
TRUE;
811 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
812 if (!yyextra->curClassName.isEmpty())
814 DBG_CTX((stderr,
"** scope stack push CLASSBLOCK\n"));
816 pushScope(yyscanner,yyextra->curClassName);
817 DBG_CTX((stderr,
"***** yyextra->curClassName=%s\n",
qPrint(yyextra->curClassName)));
818 if (yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->curClassName,
true)==
nullptr)
820 DBG_CTX((stderr,
"Adding new class %s\n",
qPrint(yyextra->curClassName)));
823 for (
const auto &s : yyextra->curClassBases)
826 auto it = yyextra->codeClassMap.find(s);
827 if (it!=yyextra->codeClassMap.end())
831 if (bcd==
nullptr) bcd=yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,
QCString(s),
true);
832 if (bcd && bcd->
name()!=yyextra->curClassName)
834 var.localDef()->insertBaseClass(bcd->
name());
837 yyextra->codeClassMap.emplace(yyextra->curClassName.str(),std::move(var));
843 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
846 yyextra->curClassName.clear();
847 yyextra->curClassBases.clear();
ClassDef * toClassDef(Definition *d)
850<Bases>"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" {
852 yyextra->code->codify(yytext);
855<Bases>{SEP}?({ID}{SEP})*{ID} {
856 DBG_CTX((stderr,
"%s:addBase(%s)\n",
qPrint(yyextra->curClassName),yytext));
857 yyextra->curClassBases.emplace_back(yytext);
861 yyextra->code->codify(yytext);
862 if (!yyextra->insideObjC)
864 yyextra->sharpCount=1;
869 yyextra->insideProtocolList=
TRUE;
873 yyextra->code->codify(yytext);
874 yyextra->insideProtocolList=
FALSE;
877 yyextra->code->codify(yytext);
878 ++yyextra->sharpCount;
881 yyextra->code->codify(yytext);
882 if (--yyextra->sharpCount<=0)
886 yyextra->code->codify(yytext);
887 yyextra->lastStringContext=YY_START;
891 yyextra->code->codify(yytext);
892 yyextra->lastStringContext=YY_START;
896 yyextra->code->codify(yytext);
897 yyextra->sharpCount=1;
901 yyextra->code->codify(yytext);
902 ++yyextra->sharpCount;
905 yyextra->code->codify(yytext);
906 if (--yyextra->sharpCount<=0)
912 yyextra->code->codify(yytext);
916<Body>{SCOPEPREFIX}?"operator"{B}*"()"{Bopt}/"(" {
919 yyextra->bracketCount=0;
920 yyextra->args.clear();
921 yyextra->name+=yytext;
924<Body>{SCOPEPREFIX}?"operator"/"(" {
927 yyextra->bracketCount=0;
928 yyextra->args.clear();
929 yyextra->name+=yytext;
932<Body>{SCOPEPREFIX}?"operator"[^a-z_A-Z0-9\(\n]+/"(" {
935 yyextra->bracketCount=0;
936 yyextra->args.clear();
937 yyextra->name+=yytext;
940<Body,TemplDecl>("template"|"generic")/([^a-zA-Z0-9]) {
944 yyextra->insideTemplate=
TRUE;
945 yyextra->sharpCount=0;
947<Body>"concept"{BN}+ {
953<Body>"using"{BN}+"namespace"{BN}+ {
965<Body>"module"/{B}*[:;]? {
967 if (!yyextra->type.isEmpty() || !yyextra->name.isEmpty()) REJECT;
973<Body>"import"/{B}*[<":]? {
980<ConceptName>{ID}("::"{ID})* {
983<ConceptName>"=" {
codifyLines(yyscanner,yytext); BEGIN(Body); }
984<UsingName>{ID}(("::"|"."){ID})* {
989<UsingName>\n {
codifyLines(yyscanner,yytext); BEGIN(Body); }
990<UsingName>. {
codifyLines(yyscanner,yytext); BEGIN(Body); }
991<Body,FuncCall>"$"?"this"("->"|".") { yyextra->code->codify(yytext);
992 yyextra->isPrefixedWithThis =
TRUE;
994<Body>{KEYWORD}/([^a-z_A-Z0-9]) {
1000 if (text==
"typedef" || text.
find(
"enum ")!=-1)
1003 yyextra->name+=yytext;
int find(char c, int index=0, bool cs=TRUE) const
int qstrcmp(const char *str1, const char *str2)
1007<Body>{KEYWORD}/{B}* {
1013<Body>{KEYWORD}/{BN}*"(" {
1018 yyextra->name.clear();yyextra->type.clear();
1020<FuncCall>"in"/{BN}* {
1021 if (!yyextra->inForEachExpression) REJECT;
1026 yyextra->theVarContext.popScope();
1027 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1028 yyextra->theVarContext.pushScope();
1029 yyextra->name.clear();yyextra->type.clear();
1031<Body>{FLOWKW}/{BN}*"(" {
1035 yyextra->name.clear();yyextra->type.clear();
1036 yyextra->inForEachExpression = (
qstrcmp(yytext,
"for each")==0 ||
qstrcmp(yytext,
"foreach")==0);
1039<Body>{FLOWCONDITION}/{BN}*"(" {
1044 yyextra->name.clear();yyextra->type.clear();
1045 yyextra->inForEachExpression = (strcmp(yytext,
"for each")==0 || strcmp(yytext,
"foreach")==0);
1048<Body>{FLOWKW}/([^a-z_A-Z0-9]) {
1052 if (yyextra->inFunctionTryBlock && (
qstrcmp(yytext,
"catch")==0 ||
qstrcmp(yytext,
"finally")==0))
1054 yyextra->inFunctionTryBlock=
FALSE;
1057<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1062 if (yyextra->inFunctionTryBlock && (strcmp(yytext,
"catch")==0 || strcmp(yytext,
"finally")==0))
1064 yyextra->inFunctionTryBlock=
FALSE;
1067<Body>{FLOWKW}/{B}* {
1072<Body>{FLOWCONDITION}/{B}* {
1079 yyextra->code->codify(yytext);
1080 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1081 yyextra->bracketCount--;
1082 yyextra->parmType = yyextra->name;
1085<Body>"\\)"|"\\(" {
1086 yyextra->code->codify(yytext);
1088<Body>[\\|\)\+\-\/\%\~\!] {
1089 yyextra->code->codify(yytext);
1090 yyextra->name.clear();yyextra->type.clear();
1093 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1094 yyextra->bracketCount--;
1095 if (yyextra->bracketCount<=0)
1101<Body,TemplDecl,ObjCMethod>{TYPEKW}/{B}* {
1103 yyextra->code->codify(yytext);
1106 yyextra->name+=yytext;
1108<Body,TemplDecl,ObjCMethod>{TYPEKWSL}/{B}* {
1116 yyextra->code->codify(yytext);
1119 yyextra->name+=yytext;
1122<Body>"generic"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1124 yyextra->code->codify(yytext);
1126 yyextra->sharpCount=0;
1129<Body>"template"/{B}*"<"[^\n\/\-\.\{\">]*">"{B}* {
1131 yyextra->code->codify(yytext);
1133 yyextra->sharpCount=0;
1136<TemplDecl>"class"|"typename" {
1142 yyextra->code->codify(yytext);
1143 yyextra->sharpCount++;
1146 yyextra->code->codify(yytext);
1147 yyextra->sharpCount--;
1148 if (yyextra->sharpCount<=0)
1157 BEGIN( yyextra->lastTemplCastContext );
1159<TemplCast>{ID}("::"{ID})* {
1162<TemplCast>("const"|"volatile"){B}* {
1170<Body,MemberCall2,FuncCall>{CASTKW}{B}*"<" {
1174 yyextra->lastTemplCastContext = YY_START;
1177<Body>"$this->"{SCOPENAME}/{BN}*[;,)\]] {
1180 yyextra->name+=yytext+7;
1182<Body,TemplCast>{SCOPENAME}{B}*"<"[^\n\/\-\.\{\">\(']*">"{ENDIDopt}/{B}* {
1189 yyextra->name+=yytext;
1191<ModuleName,ModuleImport>{MODULE_ID}({BN}*":"{BN}*{MODULE_ID})? {
1193 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
1210<ModuleName>":"{BN}+"private" {
1212 int i=text.
find(
'p');
1218<ModuleName>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1219<ModuleName>. { yyextra->code->codify(yytext); }
1221<ModuleImport>["<] { yyextra->code->codify(yytext); BEGIN(ReadInclude); }
1222<ModuleImport>";" { yyextra->code->codify(yytext); BEGIN(Body); }
1223<ModuleImport>. { yyextra->code->codify(yytext); }
1224<ModuleImport>\n {
codifyLines(yyscanner,yytext); }
1226<Body>{SCOPENAME}/{BN}*[:;,)\]] {
1230 yyextra->name+=yytext;
1232<Body>{ID}("."{ID})+/{BN}+ {
1237 yyextra->name+=yytext;
1244<Body>"export"/{B}* {
1250<Body>{SCOPENAME}/{B}* {
1254 yyextra->name+=yytext;
1256<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* {
1257 yyextra->code->codify(yytext);
1258 uint32_t s=0;
while (s<(uint32_t)yyleng && !
isId(yytext[s])) s++;
1259 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1262 yyextra->name=std::move(varname);
1264<Body>{SCOPETNAME}{B}*"<"[^\n\/\-\.\{\">]*">"/{BN}*"(" |
1265<Body>{SCOPETNAME}/{BN}*"(" {
1272 yyextra->bracketCount=0;
1273 yyextra->args.clear();
1274 yyextra->name+=yytext;
1277<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} {
1279 uint32_t i=(uint32_t)text.
find(
'R');
1280 yyextra->code->codify(text.
left(i+1));
1282 yyextra->code->codify(
QCString(yytext+i+1));
1283 yyextra->lastStringContext=YY_START;
1284 yyextra->inForEachExpression =
FALSE;
1285 yyextra->delimiter = yytext+i+2;
1286 yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
1289<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit,ClassVar,OldStyleArgs>\" {
1291 yyextra->code->codify(yytext);
1292 yyextra->lastStringContext=YY_START;
1293 yyextra->inForEachExpression =
FALSE;
1294 BEGIN( SkipString );
1296<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{NUMBER} {
1298 yyextra->code->codify(yytext);
1300<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
1302 yyextra->code->codify(yytext);
1303 yyextra->lastStringContext=YY_START;
1304 yyextra->inForEachExpression =
FALSE;
1305 BEGIN( SkipStringS );
1307<SkipString>[^\"\\\r\n]* {
1308 yyextra->code->codify(yytext);
1310<SkipStringS>[^\'\\\r\n]* {
1311 yyextra->code->codify(yytext);
1313<SkipString,SkipStringS>{CPPC}|{CCS} {
1314 yyextra->code->codify(yytext);
1317 yyextra->code->codify(yytext);
1318 if (yyextra->lastStringContext!=SkipCPP)
1322 BEGIN( yyextra->lastStringContext );
1325 yyextra->code->codify(yytext);
1327 BEGIN( yyextra->lastStringContext );
1329<SkipString,SkipStringS>\\. {
1330 yyextra->code->codify(yytext);
1332<RawString>{RAWEND} {
1333 yyextra->code->codify(yytext);
1335 delimiter=delimiter.left(delimiter.length()-1);
1336 if (delimiter==yyextra->delimiter)
1338 BEGIN( yyextra->lastStringContext );
1341<RawString>[^)\n]+ { yyextra->code->codify(yytext); }
1342<RawString>. { yyextra->code->codify(yytext); }
1344<SkipVerbString>[^"\n]+ {
1345 yyextra->code->codify(yytext);
1347<SkipVerbString>\"\" {
1348 yyextra->code->codify(yytext);
1351 yyextra->code->codify(yytext);
1353 BEGIN( yyextra->lastVerbStringContext );
1356 yyextra->code->codify(yytext);
1362 yyextra->code->codify(yytext);
1363 yyextra->name.clear();yyextra->type.clear();
1366 if (yyextra->insideTemplate)
1368 yyextra->sharpCount++;
1370 yyextra->code->codify(yytext);
1373 if (yyextra->insideTemplate)
1375 if (--yyextra->sharpCount<=0)
1377 yyextra->insideTemplate=
FALSE;
1380 yyextra->code->codify(yytext);
1382<Body,MemberCall,MemberCall2,FuncCall,OldStyleArgs>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
1384 yyextra->code->codify(yytext);
1392 yyextra->code->codify(yytext);
1393 yyextra->memCallContext = YY_START;
1394 BEGIN( MemberCall );
1396<MemberCall>{SCOPETNAME}/{BN}*"(" {
1397 if (yyextra->theCallContext.getScope().globalDef())
1404 yyextra->name.clear();
1410 yyextra->name.clear();
1412 yyextra->type.clear();
1413 if (yyextra->memCallContext==Body)
1419 BEGIN(yyextra->memCallContext);
1422<MemberCall>{SCOPENAME}/{B}* {
1423 if (yyextra->theCallContext.getScope().globalDef())
1425 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1431 yyextra->name.clear();
1435 DBG_CTX((stderr,
"no class context!\n"));
1438 yyextra->name.clear();
1440 yyextra->type.clear();
1441 BEGIN(yyextra->memCallContext);
1444 if (yyextra->insideObjC && *yytext==
'[')
1446 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
1448 yyextra->contextMap.clear();
1449 yyextra->nameMap.clear();
1450 yyextra->objectMap.clear();
1451 yyextra->wordMap.clear();
1452 yyextra->commentMap.clear();
1453 yyextra->currentCtxId = 0;
1454 yyextra->currentNameId = 0;
1455 yyextra->currentObjId = 0;
1456 yyextra->currentCtx =
nullptr;
1457 yyextra->braceCount = 0;
1463 yyextra->code->codify(yytext);
1464 yyextra->saveName = yyextra->name;
1465 yyextra->saveType = yyextra->type;
1466 if (*yytext!=
'[' && !yyextra->type.isEmpty())
1473 addVariable(yyscanner,yyextra->type,yyextra->name);
1475 yyextra->name.clear();
1477 if (*yytext==
';' || *yytext==
'=')
1479 yyextra->type.clear();
1480 yyextra->name.clear();
1482 else if (*yytext==
'[')
1484 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1486 yyextra->args.clear();
1487 yyextra->parmType.clear();
1488 yyextra->parmName.clear();
1491<ObjCCall,ObjCMName>"["|"{" {
1493 yyextra->currentCtx->format+=*yytext;
1497<ObjCCall,ObjCMName>"]"|"}" {
1498 yyextra->currentCtx->format+=*yytext;
1501 if (yyextra->currentCtx==
nullptr)
1505 auto it = yyextra->contextMap.find(0);
1506 if (it!=yyextra->contextMap.end())
1508 ctx = it->second.get();
1515<ObjCCall,ObjCMName>{CPPC}.* {
1516 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1518<ObjCCall,ObjCMName>{CCS} {
1519 yyextra->lastObjCCallContext = YY_START;
1520 yyextra->currentCtx->comment.str(yytext);
1521 BEGIN(ObjCCallComment);
1523<ObjCCallComment>{CCE} {
1524 yyextra->currentCtx->comment << yytext;
1525 std::string commentStr = yyextra->currentCtx->comment.str();
1526 yyextra->currentCtx->format+=
escapeComment(yyscanner,commentStr.c_str());
1527 BEGIN(yyextra->lastObjCCallContext);
1529<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
1530<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
1531<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
1532<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
1533<ObjCCall>{ID}({B}*"."{B}*{ID})* {
1535 if (yyextra->braceCount==0)
1537 yyextra->currentCtx->objectTypeOrName=yytext;
1538 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1542<ObjCMName>{ID}/{BN}*"]" {
1543 if (yyextra->braceCount==0 &&
1544 yyextra->currentCtx->methodName.isEmpty())
1546 yyextra->currentCtx->methodName=yytext;
1547 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1551 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1554<ObjCMName>{ID}/{BN}*":" {
1555 if (yyextra->braceCount==0)
1557 yyextra->currentCtx->methodName+=yytext;
1558 yyextra->currentCtx->methodName+=
":";
1560 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1562<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1563<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1564<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1565 BEGIN(yyextra->lastStringContext);
1567<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1568<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1569 yyextra->lastStringContext=YY_START;
1572<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+=
"$$"; }
1573<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
1574<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
1575<ObjCSkipStr>"@"/"\"" {
1576 yyextra->currentCtx->format+=yytext;
1578<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext); }
1579<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
1580<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
1583 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1584 yyextra->code->codify(yytext);
1586 yyextra->name = yyextra->saveName;
1587 yyextra->type = yyextra->saveType;
1590 yyextra->code->codify(yytext);
1592<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1593 yyextra->code->codify(yytext);
1595<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1600 yyextra->code->codify(yytext);
1603<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1605 yyextra->parmName=yytext;
1607 yyextra->code->codify(yytext);
1610<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1618 yyextra->parmName=yytext;
1620 yyextra->code->codify(yytext);
1624<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1626 yyextra->parmName=yytext;
1628 yyextra->code->codify(yytext);
1631<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1634 yyextra->parmName=yytext;
1636 yyextra->code->codify(yytext);
1639<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1645 yyextra->parmName=yytext;
1649 yyextra->code->codify(yytext);
1650 yyextra->inForEachExpression =
FALSE;
1653<MemberCall2,FuncCall>, {
1654 yyextra->code->codify(yytext);
1655 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1656 yyextra->parmType.clear();yyextra->parmName.clear();
1658<MemberCall2,FuncCall>"{" {
1659 if (yyextra->bracketCount>0)
1661 yyextra->code->codify(yytext);
1662 yyextra->skipInlineInitContext=YY_START;
1663 yyextra->curlyCount=0;
1671<InlineInit>"{" { yyextra->curlyCount++;
1672 yyextra->code->codify(yytext);
1675 yyextra->code->codify(yytext);
1676 if (--yyextra->curlyCount<=0)
1678 BEGIN(yyextra->skipInlineInitContext);
1685 yyextra->code->codify(yytext);
1687<MemberCall2,FuncCall>"(" {
1688 yyextra->parmType.clear();yyextra->parmName.clear();
1689 yyextra->code->codify(yytext);
1690 yyextra->bracketCount++;
1691 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1692 if (YY_START==FuncCall && !yyextra->insideBody)
1694 yyextra->theVarContext.pushScope();
1697<MemberCall2,FuncCall>{OPERATOR} {
1704 yyextra->parmType.clear();yyextra->parmName.clear();
1706 yyextra->code->codify(yytext);
1708<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1711 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1712 if (yyextra->parmType.isEmpty())
1714 yyextra->parmType=yyextra->parmName;
1715 yyextra->parmName.clear();
1717 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1721 yyextra->parmType = yyextra->parmName;
1722 yyextra->parmName.clear();
1723 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1725 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1726 yyextra->inForEachExpression =
FALSE;
1728 yyextra->code->codify(yytext);
1729 if (--yyextra->bracketCount<=0)
1731 if (yyextra->name.isEmpty())
1741<MemberCall,MemberCall2,FuncCall>[;:] {
1743 if (yyextra->bracketCount<=0)
1750 yyextra->code->codify(yytext);
1753<CallEnd>[ \t\n]* {
codifyLines(yyscanner,yytext); }
1756 yyextra->bracketCount=0;
1757 if (*yytext==
';') yyextra->searchingForBody=
FALSE;
1758 if (!yyextra->type.isEmpty())
1760 DBG_CTX((stderr,
"add variable yyextra->type=%s yyextra->name=%s)\n",
qPrint(yyextra->type),
qPrint(yyextra->name)));
1761 addVariable(yyscanner,yyextra->type,yyextra->name);
1763 yyextra->parmType.clear();yyextra->parmName.clear();
1765 if (*yytext==
';' || yyextra->insideBody)
1767 if (!yyextra->insideBody)
1769 yyextra->theVarContext.popScope();
1771 yyextra->name.clear();yyextra->type.clear();
1776 yyextra->bracketCount=0;
1780<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1785<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1786 if (yyextra->insideBody)
1788 yyextra->theVarContext.pushScope();
1790 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1792 yyextra->parmType.clear();yyextra->parmName.clear();
1793 int index = yyextra->name.findRev(
"::");
1794 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1798 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1804 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1810 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1815 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1818 yytext[yyleng-1]=
'\0';
1820 if (!cv.stripWhiteSpace().isEmpty())
1830 yyextra->code->codify(
"{");
1831 if (yyextra->searchingForBody)
1833 yyextra->searchingForBody=
FALSE;
1834 yyextra->insideBody=
TRUE;
1836 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1837 yyextra->type.clear(); yyextra->name.clear();
static NamespaceDefMutable * globalScope
QCString & prepend(const char *s)
1842 yyextra->code->codify(yytext);
1844 yyextra->inFunctionTryBlock=
TRUE;
1846<CallEnd>"requires" {
1848 yyextra->code->codify(yytext);
1852 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1858 yyextra->parmName=yytext;
1860 BEGIN(OldStyleArgs);
1864 yyextra->parmName=yytext;
1868 yyextra->code->codify(yytext);
1869 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1870 if (*yytext==
';') yyextra->parmType.clear();
1871 yyextra->parmName.clear();
1873<CallEnd,OldStyleArgs>"#" {
1875 yyextra->lastSkipCppContext = Body;
1876 yyextra->code->codify(yytext);
1881 if (!yyextra->insideBody)
1883 yyextra->theVarContext.popScope();
1885 yyextra->name.clear();yyextra->args.clear();
1886 yyextra->parmType.clear();yyextra->parmName.clear();
1890 yyextra->code->codify(yytext);
1891 yyextra->type.clear(); yyextra->name.clear();
1895 yyextra->code->codify(yytext);
1896 if (yyextra->searchingForBody)
1898 yyextra->searchingForBody=
FALSE;
1899 yyextra->insideBody=
TRUE;
1901 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1902 if (yyextra->name.find(
"::")!=-1)
1904 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1910 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1913 yyextra->type.clear(); yyextra->name.clear();
1916<SkipInits>{ID}{B}*"{" {
1918 int bracketPos = text.
find(
'{');
1919 int spacePos = text.
find(
' ');
1920 int len = spacePos==-1 ? bracketPos : spacePos;
1922 yyextra->code->codify(
QCString(yytext+len));
1930<FuncCall>{ID}/("."|"->") {
1931 yyextra->name=yytext;
1933 BEGIN( MemberCall2 );
1935<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1936 yyextra->code->codify(yytext);
1937 uint32_t s=0;
while (!
isId(yytext[s])) s++;
1938 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1939 yyextra->name=((
QCString)yytext).mid(s,e-s+1);
1940 BEGIN( MemberCall2 );
1942<MemberCall2>{ID}/([ \t\n]*"(") {
1943 if (!yyextra->args.isEmpty())
1947 yyextra->args.clear();
1950<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1952 yyextra->name=yytext;
1954 BEGIN( MemberCall2 );
1956<MemberCall2>"->"|"." {
1961 yyextra->code->codify(yytext);
1962 yyextra->memCallContext = YY_START;
1963 BEGIN( MemberCall );
1965<SkipComment>{CCS}("!"?){CCE} {
1966 yyextra->code->codify(yytext);
1968 BEGIN( yyextra->lastCContext ) ;
1970<SkipComment>{CPPC}|{CCS} {
1971 yyextra->code->codify(yytext);
1973<SkipComment>[^*\/\n]+ {
1974 yyextra->code->codify(yytext);
1976<SkipComment>[ \t]*{CCE} {
1977 yyextra->code->codify(yytext);
1979 if (yyextra->lastCContext==SkipCPP)
1983 BEGIN( yyextra->lastCContext ) ;
1985<SkipCxxComment>[^\r\n]*"\\"[\r]?\n {
1988<SkipCxxComment>[^\r\n]+ {
1989 yyextra->code->codify(yytext);
1995 BEGIN( yyextra->lastCContext ) ;
1998 yyextra->code->codify(yytext);
2000<MemberCall>[^a-z_A-Z0-9(\n] {
2001 yyextra->code->codify(yytext);
2002 yyextra->type.clear();
2003 yyextra->name.clear();
2004 BEGIN(yyextra->memCallContext);
2006<*>\n({B}*{CPPC}[!/][^\n]*\n)+ {
2007 if (YY_START==SkipCPP) REJECT;
2012 if (YY_START==SkipCxxComment)
2014 BEGIN( yyextra->lastCContext ) ;
2019 BEGIN( yyextra->lastSkipCppContext ) ;
2022<*>\n{B}*{CPPC}"@"[{}].*\n {
2027 if (YY_START==SkipCxxComment)
2029 BEGIN( yyextra->lastCContext ) ;
2032<*>\n{B}*{CCS}"@"[{}] {
2034 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2036 yyextra->lastCContext = YY_START ;
2042<*>^{B}*{CPPC}"@"[{}].*\n {
2048<*>^{B}*{CCS}"@"[{}] {
2050 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2052 yyextra->lastCContext = YY_START ;
2055 yyextra->code->codify(yytext);
2058<*>^{B}*{CPPC}[!/][^\n]* {
2063<*>{CPPC}[!/][^\n]* {
2064 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2069<*>\n{B}*{CCS}[!*]/{NCOMM} {
2071 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2073 yyextra->lastCContext = YY_START ;
2079<*>^{B}*{CCS}"*"[*]+/[^/] {
2081 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2083 yyextra->lastCContext = YY_START ;
2087 yyextra->code->codify(yytext);
#define Config_getBool(name)
2090<*>^{B}*{CCS}[!*]/{NCOMM} {
2092 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2094 yyextra->lastCContext = YY_START ;
2097 yyextra->code->codify(yytext);
2100<*>{CCS}[!*]/{NCOMM} {
2101 if (YY_START==SkipString) REJECT;
2103 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2105 yyextra->lastCContext = YY_START ;
2108 yyextra->code->codify(yytext);
2111<*>{CCS}("!"?){CCE} {
2112 if (YY_START==SkipString) REJECT;
2115 yyextra->code->codify(yytext);
2118<SkipComment>[^\*\n]+ {
2119 yyextra->code->codify(yytext);
2123 yyextra->code->codify(yytext);
2125 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2127 yyextra->lastCContext = YY_START ;
2129 BEGIN( SkipComment ) ;
2133 yyextra->code->codify(yytext);
2134 yyextra->lastVerbStringContext=YY_START;
2135 BEGIN(SkipVerbString);
2139 yyextra->code->codify(yytext);
2140 yyextra->lastCContext = YY_START ;
2141 BEGIN( SkipCxxComment ) ;
2144 if (yytext[0]==
'(') yyextra->bracketCount++;
2145 yyextra->code->codify(yytext);
2146 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2149 if (yytext[0]==
')') yyextra->bracketCount--;
2150 yyextra->code->codify(yytext);
2151 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2157 yyextra->code->codify(yytext);
2160 yyextra->code->codify(yytext);
2177 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2185 DBG_CTX((stderr,
"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n",
2186 qPrint(ltype),
qPrint(lname),yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>"));
2187 auto it = yyextra->codeClassMap.find(ltype.
str());
2188 if (it!=yyextra->codeClassMap.end())
2191 yyextra->theVarContext.addVariable(lname,std::move(it->second));
2195 auto findVariableType = [&yyscanner,&yyg,<ype,&lname,&name](
const Definition *d) ->
const ClassDef *
2197 const ClassDef *varDef = yyextra->symbolResolver.resolveClass(d,ltype,
true);
2204 else if ((i=ltype.find(
'<'))!=-1)
2211 const ClassDef *varDef = findVariableType(yyextra->currentDefinition);
2212 if (varDef==
nullptr)
2214 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2216 varDef = findVariableType(namespaceDef);
2220 if (varDef==
nullptr)
2222 if (!yyextra->theVarContext.atGlobalScope())
2226 DBG_CTX((stderr,
"** addVariable: dummy context for '%s'\n",
qPrint(lname)));
2231 DBG_CTX((stderr,
"** addVariable: not adding variable!\n"));
2242 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2243 yyextra->scopeNameLengthStack.push_back(
int(yyextra->scopeName.length()));
2244 if (yyextra->scopeName.isEmpty() ||
leftScopeMatch(s,yyextra->scopeName))
2246 yyextra->scopeName = s;
2250 yyextra->scopeName +=
"::";
2251 yyextra->scopeName += s;
2260 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2261 if (!yyextra->scopeNameLengthStack.empty())
2263 int length = yyextra->scopeNameLengthStack.back();
2264 yyextra->scopeNameLengthStack.pop_back();
2265 yyextra->scopeName.resize(length);
2271 DBG_CTX((stderr,
"popScope() result: '%s'\n",
qPrint(yyextra->scopeName)));
2276 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2279 if (yyextra->searchCtx)
2306 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2312 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
2313 if (ts!=-1 && te!=-1 && te>ts)
2318 while (!yyextra->scopeNameLengthStack.empty())
2322 yyextra->scopeName.clear();
2324 while ((i=n.
find(
"::"))!=-1)
2330 DBG_CTX((stderr,
"--->New class scope '%s'\n",
qPrint(yyextra->scopeName)));
2335 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2336 while (!yyextra->foldStack.empty())
2338 const Definition *dd = yyextra->foldStack.back();
2341 yyextra->code->endFold();
2343 yyextra->foldStack.pop_back();
2358 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2367 if (endLine!=-1 && startLine!=endLine &&
2375 (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
2383 yyextra->code->startFold(yyextra->yyLineNr,
"",
"");
2387 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2391 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2396 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2400 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2402 yyextra->foldStack.push_back(d);
2414 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2416 if (yyextra->sourceFileDef && yyextra->lineNumbers)
2422 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
2424 DBG_CTX((stderr,
"%s:startCodeLine(%d)=%p\n",
qPrint(yyextra->sourceFileDef->name()),yyextra->yyLineNr,(
void*)d));
2425 if (!yyextra->includeCodeFragment && d)
2427 yyextra->currentDefinition = d;
2428 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
2429 yyextra->insideBody =
FALSE;
2430 yyextra->searchingForBody =
TRUE;
2432 yyextra->type.
clear();
2433 yyextra->name.clear();
2434 yyextra->args.clear();
2435 yyextra->parmType.clear();
2436 yyextra->parmName.clear();
2437 DBG_CTX((stderr,
"Real scope: '%s'\n",
qPrint(yyextra->realScope)));
2438 yyextra->bodyCurlyCount = 0;
2440 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
2441 if (yyextra->currentMemberDef)
2444 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
2445 yyextra->currentMemberDef->getOutputFileBase(),
2446 yyextra->currentMemberDef->anchor(),
2447 yyextra->yyLineNr,!yyextra->includeCodeFragment);
2455 QCString(),yyextra->yyLineNr,!yyextra->includeCodeFragment);
2467 !yyextra->includeCodeFragment);
2470 DBG_CTX((stderr,
"startCodeLine(%d)\n",yyextra->yyLineNr));
2471 yyextra->code->startCodeLine(yyextra->yyLineNr);
2472 yyextra->insideCodeLine =
true;
2473 if (yyextra->currentFontClass)
2475 yyextra->code->startFontClass(
QCString(yyextra->currentFontClass));
2483 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2484 DBG_CTX((stderr,
"endCodeLine(%d)\n",yyextra->yyLineNr));
2486 yyextra->code->endCodeLine();
2487 yyextra->insideCodeLine =
false;
2492 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2493 const char * fc = yyextra->currentFontClass;
2494 if (yyextra->insideCodeLine)
2498 if (yyextra->yyLineNr<yyextra->inputLines)
2500 yyextra->currentFontClass = fc;
2510 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2511 DBG_CTX((stderr,
"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,
qPrint(text)));
2513 const char *p=text.
data(),*sp=p;
2519 while ((c=*p++) && c!=
'\n');
2522 yyextra->yyLineNr++;
2523 size_t l =
static_cast<size_t>(p-sp-1);
2524 std::string tmp(sp,l);
2525 yyextra->code->codify(tmp.c_str());
2530 yyextra->code->codify(
QCString(sp));
2544 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2545 if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
2563 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2565 yyextra->tooltipManager.addTooltip(d);
2570 if (!sourceTooltips)
2575 const char *p=text.
data();
2580 while ((c=*p++) && c!=
'\n') { }
2583 yyextra->yyLineNr++;
2599 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2600 if (yyextra->name==
"const") { yyextra->name.clear();
return; }
2601 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2602 yyextra->type += yyextra->name ;
2603 yyextra->name.clear() ;
2604 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2605 yyextra->type += yyextra->args ;
2606 yyextra->args.clear() ;
2611 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2612 if (yyextra->parmName==
"const") { yyextra->parmName.clear();
return; }
2613 if (!yyextra->parmType.isEmpty()) yyextra->parmType +=
' ' ;
2614 yyextra->parmType += yyextra->parmName ;
2615 yyextra->parmName.clear() ;
2621 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2622 if (yyextra->sourceFileDef && !name.
isEmpty())
2627 yyextra->theUsingContext.emplace(name.
str(),nd);
2634 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2637 yyextra->parmName = a.name;
2638 yyextra->parmType = a.type;
2639 int i = yyextra->parmType.find(
'*');
2640 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2641 i = yyextra->parmType.find(
'&');
2642 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2643 yyextra->parmType.stripPrefix(
"const ");
2644 yyextra->parmType=yyextra->parmType.stripWhiteSpace();
2645 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
2651 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2652 DBG_CTX((stderr,
"stripClassName(scope=%s,type=%s) scopeName=%s\n",
2660 QCString clName=className+templSpec;
2662 if (!yyextra->scopeName.isEmpty())
2664 cd=yyextra->symbolResolver.resolveClass(d,yyextra->scopeName+
"::"+clName,
true);
2668 cd=yyextra->symbolResolver.resolveClass(d,clName,
true);
2670 DBG_CTX((stderr,
"stripClass trying '%s' = %p\n",
qPrint(clName),(
void*)cd));
2682 if (name.
isEmpty())
return nullptr;
2683 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2684 DBG_CTX((stderr,
"setCallContextForVar(%s) yyextra->scopeName=%s\n",
qPrint(name),
qPrint(yyextra->scopeName)));
2686 int scopeEnd = name.
findRev(
"::");
2693 if (mcd && !locName.
isEmpty())
2706 if (mnd && !locName.
isEmpty())
2722 DBG_CTX((stderr,
"local variable?\n"));
2726 yyextra->theCallContext.setScope(*mcv);
2731 DBG_CTX((stderr,
"class member? scope=%s\n",
qPrint(yyextra->scopeName)));
2741 if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=
CLASSBLOCK)
2758 const std::unique_ptr<MemberDef> &md=mn->
front();
2759 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2766 else if (mn->
size()>1)
2768 for (
const auto &md : *mn)
2777 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2780 DBG_CTX((stderr,
"returning member %s in source file %s\n",
qPrint(md->name()),
qPrint(yyextra->sourceFileDef->name())));
2792 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2793 const Definition *d = yyextra->theCallContext.getScope().globalDef();
2816 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2817 DBG_CTX((stderr,
"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",
qPrint(c),
qPrint(m),varOnly));
2822 DBG_CTX((stderr,
"scopeNameLengthStack.size()=%zu\n",yyextra->scopeNameLengthStack.size()));
2823 if (!result.
found && !yyextra->scopeNameLengthStack.empty() && c==yyextra->scopeName)
2825 QCString localName = yyextra->scopeName.
mid(yyextra->scopeNameLengthStack[0]+2);
2826 auto it = yyextra->codeClassMap.
find(localName.
str());
2827 if (it!=yyextra->codeClassMap.end())
2834 DBG_CTX((stderr,
"trying lookup via base class %s\n",
qPrint(bcName)));
2837 if (result.
found)
break;
2847 if (yyextra->exampleBlock)
2851 anchor.
sprintf(
"a%d",yyextra->anchorCount);
2853 qPrint(yyextra->exampleFile)));
2855 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
2858 yyextra->anchorCount++;
2872 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n",
2873 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,yyextra->insideBody));
2875 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
2876 yyextra->insideBody && yyextra->collectXRefs)
2898 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2899 DBG_CTX((stderr,
"getLink(%s,%s) yyextra->curClassName=%s\n",
2905 if (!yyextra->curClassName.isEmpty())
2908 c.
prepend(yyextra->curClassName);
2922 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2924 if (!scopeName.
isEmpty() && scopeName[0]==
'~')
2926 scopeName=scopeName.
mid(1);
2930 yyextra->code->codify(
"~");
2933 if (yyextra->insideProtocolList)
2945 if (!yyextra->scopeName.isEmpty())
2947 scopeName = yyextra->scopeName+
"::"+scopeName;
2953 DBG_CTX((stderr,
"generateClassOrGlobalLink(name=%s) yyextra->scopeName=%s scopeName=%s\n",
qPrint(scName),
qPrint(yyextra->scopeName),
qPrint(scopeName)));
2954 if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(scopeName))==
nullptr)
2956 int i=scopeName.
find(
'<');
2958 if (i!=-1) bareName = bareName.
left(i);
2960 auto checkForSymbol = [&yyg,&bareName,&scopeName](
const Definition *
parent,
2963 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,scopeName,
QCString(),
false,
true);
2964 DBG_CTX((stderr,
"non-local variable name=%s sym=%s!\n",
2965 qPrint(scopeName),sym_?
qPrint(sym_->name()):
"<none>"));
2966 if (sym_==
nullptr && !bareName.
isEmpty())
2969 if (bareName!=scopeName)
2971 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,bareName,
QCString(),
false,
true);
2975 const Definition *d = yyextra->currentDefinition;
2976 DBG_CTX((stderr,
"d=%s yyextra->sourceFileDef=%s\n",d?
qPrint(d->
name()):
"<none>",yyextra->sourceFileDef?
qPrint(yyextra->sourceFileDef->name()):
"<none>"));
2977 checkForSymbol(d,sym);
2986 checkForSymbol(nd,sym);
2994 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2996 checkForSymbol(namespaceDef,sym);
3018 DBG_CTX((stderr,
"is found as a type sym=%s nd=%s\n",
3023 if (
getLink(yyscanner,yyextra->scopeName,scName,ol,scName,varOnly))
3031 DBG_CTX((stderr,
"local variable!\n"));
3035 yyextra->theCallContext.setScope(*lcd);
3046 DBG_CTX((stderr,
"is a local variable sym=%p!\n",(
void*)sym));
3048 yyextra->isPrefixedWithThis =
FALSE;
3053 if (yyextra->exampleBlock)
3057 anchor.
sprintf(
"_a%d",yyextra->anchorCount);
3058 DBG_CTX((stderr,
"addExampleClass(%s,%s,%s)\n",
qPrint(anchor),
qPrint(yyextra->exampleName),
3059 qPrint(yyextra->exampleFile)));
3063 if (cdm && cdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3066 yyextra->anchorCount++;
3080 yyextra->currentMemberDef && yyextra->collectXRefs)
3089 DBG_CTX((stderr,
"class %s not linkable! cd=%p typeOnly=%d\n",
qPrint(scName),(
void*)sym,typeOnly));
3090 if (!isLocal && (md || (!sym && !typeOnly)))
3095 DBG_CTX((stderr,
"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%s\n",
qPrint(scName),(
void*)md,yyextra->currentDefinition ?
qPrint(yyextra->currentDefinition->name()) :
"<none>"));
3096 if (md && yyextra->currentDefinition)
3098 DBG_CTX((stderr,
"%s accessible from %s? %d md->getOuterScope=%s\n",
3099 qPrint(md->name()),
qPrint(yyextra->currentDefinition->name()),
3100 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md),
3101 qPrint(md->getOuterScope()->name())));
3104 if (md && yyextra->currentDefinition &&
3105 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md)==-1)
3112 DBG_CTX((stderr,
"is a global md=%p yyextra->currentDefinition=%s linkable=%d\n",(
void*)md,yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>",md->isLinkable()));
3113 if (md->isLinkable())
3117 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3127 DBG_CTX((stderr,
"not found!\n"));
3134 bool typeOnly,
bool varOnly)
3144 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3148 DBG_CTX((stderr,
"type='%s' args='%s' class=%s\n",
3152 if (yyextra->exampleBlock)
3156 anchor.
sprintf(
"a%d",yyextra->anchorCount);
3158 qPrint(yyextra->exampleFile)));
3160 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3163 yyextra->anchorCount++;
3177 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",
3178 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,(
void*)xmd,yyextra->insideBody));
3180 if (xmd->templateMaster()) xmd = xmd->templateMaster();
3182 if (xmd->isLinkable())
3185 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
3186 yyextra->insideBody && yyextra->collectXRefs)
3206 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3211 DBG_CTX((stderr,
"generateClassMemberLink(class=%s,member=%s)=%p\n",
qPrint(def->
name()),
qPrint(memName),(
void*)xmd));
3249 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3250 DBG_CTX((stderr,
"generateMemberLink(object=%s,mem=%s) classScope=%s\n",
3253 if (varName.
isEmpty())
return;
3261 DBG_CTX((stderr,
"Class found!\n"));
3264 DBG_CTX((stderr,
"Found result!\n"));
3271 if (
getLink(yyscanner,bcName,memName,ol))
3273 DBG_CTX((stderr,
"Found result!\n"));
3282 const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->scopeName,
true);
3285 DBG_CTX((stderr,
"Found class %s for variable '%s'\n",
qPrint(yyextra->scopeName),
qPrint(varName)));
3299 for (
const auto &vmd : *vmn)
3301 if (vmd->getClassDef()==jcd)
3303 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3316 DBG_CTX((stderr,
"There is a variable with name '%s'\n",
qPrint(varName)));
3317 for (
const auto &vmd : *vmn)
3319 if (vmd->getClassDef()==vcd)
3321 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3340 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3343 DBG_CTX((stderr,
"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,
qPrint(name),
qPrint(yyextra->scopeName)));
3352 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3354 QCString locScope=yyextra->scopeName;
3359 QCString funcWithFullScope=locFunc;
3364 if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() &&
3365 funcName==yyextra->currentMemberDef->localName() &&
3366 yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr &&
3378 if (i==-1) i=locFunc.
findRev(
"."),len=1;
3379 if (i==-1) i=locFunc.
findRev(
"\\"),len=1;
3382 funcScope=locFunc.
left(i);
3384 int ts=locScope.
find(
'<');
3386 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3387 if (ts!=-1 && te!=-1 && te>ts)
3392 ts=funcScope.
find(
'<');
3394 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3395 if (ts!=-1 && te!=-1 && te>ts)
3398 funcScope=funcScope.
left(ts)+funcScope.
right(funcScope.
length()-te-1);
3402 funcWithScope = funcScope+
"::"+locFunc;
3405 fullScope=locScope+
"::"+funcScope;
3410 funcWithFullScope = locScope+
"::"+funcWithScope;
3416 auto it = yyextra->codeClassMap.find(fullScope.
str());
3417 if (it!=yyextra->codeClassMap.end())
3424 if (
getLink(yyscanner,bcName,locFunc,ol,funcName))
3433 if (!locScope.
isEmpty() && fullScope!=locScope)
3435 auto it = yyextra->codeClassMap.find(locScope.
str());
3436 if (it!=yyextra->codeClassMap.end())
3443 if (
getLink(yyscanner,bcName,funcWithScope,ol,funcName))
3451 if (!
getLink(yyscanner,locScope,funcWithScope,ol,funcName))
3467 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3468 const char *p=yyextra->inputString;
3474 if (c==
'\n') count++;
3476 if (p>yyextra->inputString && *(p-1)!=
'\n')
3485 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3486 if (yyextra->currentFontClass)
3488 yyextra->code->endFontClass();
3489 yyextra->currentFontClass=
nullptr;
3491 if (specialComment && yyextra->insideSpecialComment)
3493 yyextra->code->endSpecialComment();
3494 yyextra->insideSpecialComment =
false;
3500 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3504 yyextra->code->startSpecialComment();
3505 yyextra->insideSpecialComment =
true;
3507 yyextra->code->startFontClass(
QCString(s));
3508 yyextra->currentFontClass=s;
3516 if (ctx==
nullptr)
return;
3517 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3521 DBG_CTX((stderr,
"writeObjCMethodCall(%s) obj=%s method=%s\n",
3530 DBG_CTX((stderr,
" object is local variable\n"));
3538 DBG_CTX((stderr,
" class=%p method=%p\n",(
void*)cd,(
void*)ctx->
method));
3549 char skipChar =
' ';
3574 yyextra->code->codify(
"$");
3582 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3584 int refId=refIdStr.
toInt();
3585 auto it = yyextra->nameMap.find(refId);
3586 if (it!=yyextra->nameMap.end())
3592 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3604 DBG_CTX((stderr,
"Invalid name: id=%d\n",refId));
3611 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3613 int refId=refIdStr.
toInt();
3614 auto it = yyextra->objectMap.find(refId);
3615 if (it!=yyextra->objectMap.end())
3620 if (yyextra->currentDefinition &&
3637 else if (
object==
"super")
3639 if (yyextra->currentDefinition &&
3666 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3679 int dotPos=
object.find(
'.',pp);
3680 int len =
static_cast<int>(
object.length());
3681 if (dotPos==-1) dotPos=len;
3682 const Definition *scope = yyextra->currentDefinition;
3689 if (fragmentStripped==
"self")
3702 const Definition *symbol = yyextra->symbolResolver.resolveSymbol(scope,fragmentStripped,
QCString(),
false,
true);
3708 ctx->
method = yyextra->symbolResolver.getTypedef();
3732 dotPos=
object.find(
'.',pp);
3733 if (dotPos==-1) dotPos=len;
3742 else if (ctx->
method==
nullptr)
3745 DBG_CTX((stderr,
"yyextra->currentDefinition=%p\n",(
void*)yyextra->currentDefinition));
3746 if (yyextra->currentDefinition &&
3767 DBG_CTX((stderr,
"Invalid object: id=%d\n",refId));
3774 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3776 int refId=refIdStr.
toInt();
3777 auto it = yyextra->contextMap.find(refId);
3778 if (it!=yyextra->contextMap.end())
3793 if (mn && mn->
size()==1)
3811 DBG_CTX((stderr,
"Invalid context: id=%d\n",refId));
3818 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3820 int refId=refIdStr.
toInt();
3821 auto it = yyextra->wordMap.find(refId);
3822 if (it!=yyextra->wordMap.end())
3825 bool isKeyword =
word==
"self";
3841 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3843 int refId=refIdStr.
toInt();
3844 auto it = yyextra->commentMap.find(refId);
3845 if (it!=yyextra->commentMap.end())
3859 else if (c==
'\'' || c ==
'"')
3876 DBG_CTX((stderr,
"}=(type='%s',name='%s')",
3886 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3888 result.
sprintf(
"$n%d",yyextra->currentNameId);
3889 yyextra->nameMap.emplace(yyextra->currentNameId,s);
3890 yyextra->currentNameId++;
3896 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3898 result.
sprintf(
"$o%d",yyextra->currentObjId);
3899 yyextra->objectMap.emplace(yyextra->currentObjId,s);
3900 yyextra->currentObjId++;
3906 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3908 result.
sprintf(
"$w%d",yyextra->currentWordId);
3909 yyextra->wordMap.emplace(yyextra->currentWordId,s);
3910 yyextra->currentWordId++;
3916 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3918 result.
sprintf(
"$d%d",yyextra->currentCommentId);
3919 yyextra->commentMap.emplace(yyextra->currentCommentId,s);
3920 yyextra->currentCommentId++;
3926 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3927 static const std::unordered_set<std::string> non_cpp_keywords = {
3928 "__assume",
"__super",
"abstract",
"function",
3929 "gcnew",
"gcroot",
"generic",
"get",
3930 "internal",
"null",
"pin_ptr",
"raise",
3931 "remove",
"self",
"set",
"transient",
3934 static const std::unordered_set<std::string> non_java_keywords = {
3935 "alignas",
"alignof",
"and",
"and_eq",
"asm",
3936 "atomic_cancel",
"atomic_commit",
"atomic_noexcept",
"auto",
"bitand",
3937 "bitor",
"bool",
"char8_t",
"char16_t",
"char32_t",
3938 "compl",
"concept",
"consteval",
"constexpr",
"constinit",
3939 "const_cast",
"co_await",
"co_return",
"co_yield",
"decltype",
3940 "delete",
"dynamic_cast",
"explicit",
"export",
"extern",
3941 "friend",
"inline",
"mutable",
"namespace",
"noexcept",
3942 "not",
"not_eq",
"nullptr",
"operator",
"or",
3943 "or_eq",
"reflexpr",
"register",
"reinterpret_cast",
"requires",
3944 "signed",
"sizeof",
"static_assert",
"_Static_assert",
"static_cast",
"struct",
3945 "template",
"thread_local",
"typedef",
"typeid",
"typename",
3946 "union",
"unsigned",
"using",
"virtual",
"wchar_t",
3947 "xor",
"xor_eq",
"override",
"sealed"
3949 bool retval =
false;
3950 switch (yyextra->lang)
3953 retval = (non_cpp_keywords.find(keyword) != non_cpp_keywords.end());
3956 retval = (non_java_keywords.find(keyword) != non_java_keywords.end());
3969 if (i==-1)
return FALSE;
3971 return kw==
"const_cast" || kw==
"static_cast" || kw==
"dynamic_cast" || kw==
"reinterpret_cast";
3976 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3977 yy_size_t inputPosition = yyextra->inputPosition;
3978 const char *s = yyextra->inputString + inputPosition;
3980 while( c < max_size && *s )
3985 yyextra->inputPosition += c;
3992 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3993 if (yyextra->currentCtx)
3995 yyextra->currentCtx->format+=
QCString().
sprintf(
"$c%d",yyextra->currentCtxId);
3996 if (yyextra->braceCount==0 && YY_START==ObjCCall)
3998 yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1);
3999 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
4001 yyextra->contextStack.push(yyextra->currentCtx);
4005 DBG_CTX((stderr,
"Trying to save NULL context!\n"));
4007 auto newCtx = std::make_unique<ObjCCallCtx>();
4008 newCtx->id = yyextra->currentCtxId;
4009 newCtx->lexState = YY_START;
4010 newCtx->braceCount = yyextra->braceCount;
4011 newCtx->objectType =
nullptr;
4012 newCtx->objectVar =
nullptr;
4013 newCtx->method =
nullptr;
4014 DBG_CTX((stderr,
"save state=%d\n",YY_START));
4015 yyextra->currentCtx = newCtx.get();
4016 yyextra->contextMap.emplace(yyextra->currentCtxId,std::move(newCtx));
4017 yyextra->braceCount = 0;
4018 yyextra->currentCtxId++;
4023 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4024 DBG_CTX((stderr,
"restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState));
4025 BEGIN(yyextra->currentCtx->lexState);
4026 yyextra->braceCount = yyextra->currentCtx->braceCount;
4027 if (!yyextra->contextStack.empty())
4029 yyextra->currentCtx = yyextra->contextStack.top();
4030 yyextra->contextStack.pop();
4034 yyextra->currentCtx =
nullptr;
4035 DBG_CTX((stderr,
"Trying to pop context while yyextra->contextStack is empty!\n"));
4047 codeYYlex_init_extra(&
p->state,&
p->yyscanner);
4056 codeYYlex_destroy(
p->yyscanner);
4061 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4062 DBG_CTX((stderr,
"***CodeParser::reset()\n"));
4063 yyextra->theVarContext.clear();
4064 while (!yyextra->scopeNameLengthStack.empty()) yyextra->scopeNameLengthStack.pop_back();
4065 yyextra->codeClassMap.clear();
4066 yyextra->curClassBases.clear();
4067 yyextra->anchorCount = 0;
4068 yyextra->insideCodeLine =
false;
4073 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4074 yyextra->insideCodeLine = inp;
4079 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4080 return yyextra->insideCodeLine;
4085 int startLine,
int endLine,
bool inlineFragment,
4090 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4091 DBG_CTX((stderr,
"***parseCode() exBlock=%d exName=%s fd=%p scopeName=%s searchCtx=%s\n",
4099 yyextra->code = &od;
4100 yyextra->inputString = s.
data();
4101 yyextra->fileName = fd ? fd->
fileName():
"";
4103 yyextra->inputPosition = 0;
4104 codeYYrestart(
nullptr,yyscanner);
4105 yyextra->currentFontClass =
nullptr;
4106 yyextra->searchCtx = searchCtx;
4107 yyextra->collectXRefs = collectXRefs;
4108 yyextra->inFunctionTryBlock =
FALSE;
4109 yyextra->symbolResolver.setFileScope(fd);
4110 yyextra->foldStack.clear();
4111 yyextra->insideSpecialComment =
false;
4114 yyextra->yyLineNr = startLine;
4116 yyextra->yyLineNr = 1;
4119 yyextra->inputLines = endLine+1;
4121 yyextra->inputLines = yyextra->yyLineNr +
countLines(yyscanner) - 1;
4123 yyextra->curlyCount = 0;
4124 yyextra->bodyCurlyCount = 0;
4125 yyextra->bracketCount = 0;
4126 yyextra->sharpCount = 0;
4127 yyextra->insideTemplate =
FALSE;
4128 yyextra->theCallContext.clear();
4129 while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
4130 yyextra->scopeName = scopeName;
4132 yyextra->exampleBlock = exBlock;
4133 yyextra->exampleName = exName;
4134 yyextra->sourceFileDef = fd;
4135 yyextra->lineNumbers = fd && showLineNumbers;
4140 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
4142 yyextra->lang = lang;
4144 if (yyextra->sourceFileDef)
4149 yyextra->currentMemberDef =
nullptr;
4150 yyextra->searchingForBody = exBlock;
4151 yyextra->insideBody =
FALSE;
4152 yyextra->bracketCount = 0;
4153 if (!yyextra->exampleName.isEmpty())
4156 DBG_CTX((stderr,
"yyextra->exampleFile=%s\n",
qPrint(yyextra->exampleFile)));
4158 yyextra->includeCodeFragment = inlineFragment;
4159 DBG_CTX((stderr,
"** exBlock=%d exName=%s include=%d\n",exBlock,
qPrint(exName),inlineFragment));
4160 if (!yyextra->insideCodeLine)
4164 yyextra->type.clear();
4165 yyextra->name.clear();
4166 yyextra->args.clear();
4167 yyextra->parmName.clear();
4168 yyextra->parmType.clear();
4171 codeYYlex(yyscanner);
4172 yyextra->lexInit=
TRUE;
4173 if (yyextra->insideCodeLine)
4179 while (!yyextra->foldStack.empty())
4181 yyextra->code->endFold();
4182 yyextra->foldStack.pop_back();
4185 if (yyextra->exampleFileDef)
4188 yyextra->exampleFileDef.reset();
4189 yyextra->sourceFileDef=
nullptr;
4192 yyextra->tooltipManager.writeTooltips(od);
void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool stripCodeComments, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
void resetCodeParserState() override
Resets the state of the code parser.
void setInsideCodeLine(bool inp)
std::unique_ptr< Private > p
bool insideCodeLine() const
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual const MemberDef * getMemberByName(const QCString &) const =0
Returns the member with the given name.
virtual ClassDef * categoryOf() const =0
Returns the class of which this is a category (Objective-C only)
virtual FileDef * getFileDef() const =0
Returns the namespace this compound is in, or 0 if it has a global scope.
virtual bool addExample(const QCString &anchor, const QCString &name, const QCString &file)=0
static bool isFlagSet(const DebugMask mask)
virtual int getEndBodyLine() const =0
virtual DefType definitionType() const =0
virtual QCString anchor() const =0
virtual QCString briefDescriptionAsTooltip() const =0
virtual bool isLinkableInProject() const =0
virtual const Definition * findInnerCompound(const QCString &name) const =0
virtual int getStartDefLine() const =0
virtual QCString getReference() const =0
virtual QCString qualifiedName() const =0
virtual CodeSymbolType codeSymbolType() const =0
virtual QCString getOutputFileBase() const =0
virtual Definition * getOuterScope() const =0
static NamespaceLinkedMap * namespaceLinkedMap
static MemberNameLinkedMap * functionNameLinkedMap
static std::mutex countFlowKeywordsMutex
static MemberNameLinkedMap * memberNameLinkedMap
static SearchIndexIntf searchIndex
static std::mutex addExampleMutex
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
virtual QCString fileName() const =0
std::vector< QCString > baseClasses() const
virtual QCString typeString() const =0
virtual const ClassDef * getClassDef() const =0
virtual GroupDef * getGroupDef()=0
virtual const FileDef * getFileDef() const =0
virtual const ArgumentList & argumentList() const =0
virtual MemberDef * resolveAlias()=0
virtual bool isDefine() const =0
virtual bool isVariable() const =0
virtual QCString argsString() const =0
virtual bool isCallable() const =0
virtual void incrementFlowKeyWordCount()=0
virtual bool addExample(const QCString &anchor, const QCString &name, const QCString &file)=0
An abstract interface of a namespace symbol.
virtual const MemberDef * getMemberByName(const QCString &) const =0
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
void writeCodeAnchor(const QCString &name)
void stripCodeComments(bool b)
int toInt(bool *ok=nullptr, int base=10) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
bool startsWith(const char *s) const
char & at(size_t i)
Returns a reference to the character at index i.
bool isEmpty() const
Returns TRUE iff the string is empty.
const std::string & str() const
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
QCString right(size_t len) const
QCString & sprintf(const char *format,...)
int findRev(char c, int index=-1, bool cs=TRUE) const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
bool stripPrefix(const QCString &prefix)
const Definition * globalDef() const
ClassDefMutable * toClassDefMutable(Definition *d)
ClassDef * getClass(const QCString &n)
static void codeFolding(yyscan_t yyscanner, const Definition *d)
ConceptDef * getResolvedConcept(const Definition *d, const QCString &name)
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
void addDocCrossReference(const MemberDef *s, const MemberDef *d)
MemberDefMutable * toMemberDefMutable(Definition *d)
MemberDef * toMemberDef(Definition *d)
NamespaceDef * getResolvedNamespace(const QCString &name)
NamespaceDef * toNamespaceDef(Definition *d)
This class contains the information about the argument of a function or template.
int extractClassNameFromType(const QCString &type, int &pos, QCString &name, QCString &templSpec, SrcLangExt lang)
bool leftScopeMatch(const QCString &scope, const QCString &name)
QCString removeAnonymousScopes(const QCString &str)
QCString convertNameToFile(const QCString &name, bool allowDots, bool allowUnderscore)
GetDefResult getDefs(const GetDefInput &input)