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;
265#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 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
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}*[:;,)\]] {
1233 yyextra->name+=yytext;
1235<Body>{ID}("."{ID})+/{BN}+ {
1240 yyextra->name+=yytext;
1247<Body>"export"/{B}* {
1253<Body>{SCOPENAME}/{B}* {
1260 yyextra->name+=yytext;
1262<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* {
1263 yyextra->code->codify(yytext);
1264 uint32_t s=0;
while (s<(uint32_t)yyleng && !
isId(yytext[s])) s++;
1265 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1268 yyextra->name=std::move(varname);
1270<Body>{SCOPETNAME}{B}*"<"[^\n\/\-\.\{\">]*">"/{BN}*"(" |
1271<Body>{SCOPETNAME}/{BN}*"(" {
1278 yyextra->bracketCount=0;
1279 yyextra->args.clear();
1280 yyextra->name+=yytext;
1283<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} {
1285 uint32_t i=(uint32_t)text.
find(
'R');
1286 yyextra->code->codify(text.
left(i+1));
1288 yyextra->code->codify(
QCString(yytext+i+1));
1289 yyextra->lastStringContext=YY_START;
1290 yyextra->inForEachExpression =
FALSE;
1291 yyextra->delimiter = yytext+i+2;
1292 yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
1295<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit,ClassVar,OldStyleArgs>\" {
1297 yyextra->code->codify(yytext);
1298 yyextra->lastStringContext=YY_START;
1299 yyextra->inForEachExpression =
FALSE;
1300 BEGIN( SkipString );
1302<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{NUMBER} {
1304 yyextra->code->codify(yytext);
1306<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
1308 yyextra->code->codify(yytext);
1309 yyextra->lastStringContext=YY_START;
1310 yyextra->inForEachExpression =
FALSE;
1311 BEGIN( SkipStringS );
1313<SkipString>[^\"\\\r\n]* {
1314 yyextra->code->codify(yytext);
1316<SkipStringS>[^\'\\\r\n]* {
1317 yyextra->code->codify(yytext);
1319<SkipString,SkipStringS>{CPPC}|{CCS} {
1320 yyextra->code->codify(yytext);
1323 yyextra->code->codify(yytext);
1324 if (yyextra->lastStringContext!=SkipCPP)
1328 BEGIN( yyextra->lastStringContext );
1331 yyextra->code->codify(yytext);
1333 BEGIN( yyextra->lastStringContext );
1335<SkipString,SkipStringS>\\. {
1336 yyextra->code->codify(yytext);
1338<RawString>{RAWEND} {
1339 yyextra->code->codify(yytext);
1341 delimiter=delimiter.left(delimiter.length()-1);
1342 if (delimiter==yyextra->delimiter)
1344 BEGIN( yyextra->lastStringContext );
1347<RawString>[^)\n]+ { yyextra->code->codify(yytext); }
1348<RawString>. { yyextra->code->codify(yytext); }
1350<SkipVerbString>[^"\n]+ {
1351 yyextra->code->codify(yytext);
1353<SkipVerbString>\"\" {
1354 yyextra->code->codify(yytext);
1357 yyextra->code->codify(yytext);
1359 BEGIN( yyextra->lastVerbStringContext );
1362 yyextra->code->codify(yytext);
1368 yyextra->code->codify(yytext);
1369 yyextra->name.clear();yyextra->type.clear();
1372 if (yyextra->insideTemplate)
1374 yyextra->sharpCount++;
1376 yyextra->code->codify(yytext);
1379 if (yyextra->insideTemplate)
1381 if (--yyextra->sharpCount<=0)
1383 yyextra->insideTemplate=
FALSE;
1386 yyextra->code->codify(yytext);
1388<Body,MemberCall,MemberCall2,FuncCall,OldStyleArgs>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
1390 yyextra->code->codify(yytext);
1398 yyextra->code->codify(yytext);
1399 yyextra->memCallContext = YY_START;
1400 BEGIN( MemberCall );
1402<MemberCall>{SCOPETNAME}/{BN}*"(" {
1403 if (yyextra->theCallContext.getScope().globalDef())
1410 yyextra->name.clear();
1416 yyextra->name.clear();
1418 yyextra->type.clear();
1419 if (yyextra->memCallContext==Body)
1425 BEGIN(yyextra->memCallContext);
1428<MemberCall>{SCOPENAME}/{B}* {
1429 if (yyextra->theCallContext.getScope().globalDef())
1431 DBG_CTX((stderr,
"yyextra->theCallContext.getClass()=%p\n",(
void*)yyextra->theCallContext.getScope().globalDef()));
1437 yyextra->name.clear();
1441 DBG_CTX((stderr,
"no class context!\n"));
1444 yyextra->name.clear();
1446 yyextra->type.clear();
1447 BEGIN(yyextra->memCallContext);
1450 if (yyextra->insideObjC && *yytext==
'[')
1452 DBG_CTX((stderr,
"Found start of ObjC call!\n"));
1454 yyextra->contextMap.clear();
1455 yyextra->nameMap.clear();
1456 yyextra->objectMap.clear();
1457 yyextra->wordMap.clear();
1458 yyextra->commentMap.clear();
1459 yyextra->currentCtxId = 0;
1460 yyextra->currentNameId = 0;
1461 yyextra->currentObjId = 0;
1462 yyextra->currentCtx =
nullptr;
1463 yyextra->braceCount = 0;
1469 yyextra->code->codify(yytext);
1470 yyextra->saveName = yyextra->name;
1471 yyextra->saveType = yyextra->type;
1472 if (*yytext!=
'[' && !yyextra->type.isEmpty())
1479 addVariable(yyscanner,yyextra->type,yyextra->name);
1481 yyextra->name.clear();
1483 if (*yytext==
';' || *yytext==
'=')
1485 yyextra->type.clear();
1486 yyextra->name.clear();
1488 else if (*yytext==
'[')
1490 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1492 yyextra->args.clear();
1493 yyextra->parmType.clear();
1494 yyextra->parmName.clear();
1497<ObjCCall,ObjCMName>"["|"{" {
1499 yyextra->currentCtx->format+=*yytext;
1503<ObjCCall,ObjCMName>"]"|"}" {
1504 yyextra->currentCtx->format+=*yytext;
1507 if (yyextra->currentCtx==
nullptr)
1511 auto it = yyextra->contextMap.find(0);
1512 if (it!=yyextra->contextMap.end())
1514 ctx = it->second.get();
1521<ObjCCall,ObjCMName>{CPPC}.* {
1522 yyextra->currentCtx->format+=
escapeComment(yyscanner,yytext);
1524<ObjCCall,ObjCMName>{CCS} {
1525 yyextra->lastObjCCallContext = YY_START;
1526 yyextra->currentCtx->comment.str(yytext);
1527 BEGIN(ObjCCallComment);
1529<ObjCCallComment>{CCE} {
1530 yyextra->currentCtx->comment << yytext;
1531 std::string commentStr = yyextra->currentCtx->comment.str();
1532 yyextra->currentCtx->format+=
escapeComment(yyscanner,commentStr.c_str());
1533 BEGIN(yyextra->lastObjCCallContext);
1535<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
1536<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
1537<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
1538<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
1539<ObjCCall>{ID}({B}*"."{B}*{ID})* {
1541 if (yyextra->braceCount==0)
1543 yyextra->currentCtx->objectTypeOrName=yytext;
1544 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
1548<ObjCMName>{ID}/{BN}*"]" {
1549 if (yyextra->braceCount==0 &&
1550 yyextra->currentCtx->methodName.isEmpty())
1552 yyextra->currentCtx->methodName=yytext;
1553 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1557 yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext);
1560<ObjCMName>{ID}/{BN}*":" {
1561 if (yyextra->braceCount==0)
1563 yyextra->currentCtx->methodName+=yytext;
1564 yyextra->currentCtx->methodName+=
":";
1566 yyextra->currentCtx->format+=
escapeName(yyscanner,yytext);
1568<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
1569<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
1570<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
1571 BEGIN(yyextra->lastStringContext);
1573<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
1574<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
1575 yyextra->lastStringContext=YY_START;
1578<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+=
"$$"; }
1579<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
1580<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
1581<ObjCSkipStr>"@"/"\"" {
1582 yyextra->currentCtx->format+=yytext;
1584<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=
escapeWord(yyscanner,yytext); }
1585<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
1586<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
1589 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1590 yyextra->code->codify(yytext);
1592 yyextra->name = yyextra->saveName;
1593 yyextra->type = yyextra->saveType;
1596 yyextra->code->codify(yytext);
1598<Body>[0-9]+[xX][0-9A-Fa-f]+ {
1599 yyextra->code->codify(yytext);
1601<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
1606 yyextra->code->codify(yytext);
1609<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
1611 yyextra->parmName=yytext;
1613 yyextra->code->codify(yytext);
1616<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
1624 yyextra->parmName=yytext;
1626 yyextra->code->codify(yytext);
1630<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
1632 yyextra->parmName=yytext;
1634 yyextra->code->codify(yytext);
1637<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
1640 yyextra->parmName=yytext;
1642 yyextra->code->codify(yytext);
1645<MemberCall2,FuncCall>("::")?{ID}(({B}*"<"[^\n\[\](){}<>']*">")?({B}*"::"{B}*{ID})?)* {
1651 yyextra->parmName=yytext;
1655 yyextra->code->codify(yytext);
1656 yyextra->inForEachExpression =
FALSE;
1659<MemberCall2,FuncCall>, {
1660 yyextra->code->codify(yytext);
1661 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1662 yyextra->parmType.clear();yyextra->parmName.clear();
1664<MemberCall2,FuncCall>"{" {
1665 if (yyextra->bracketCount>0)
1667 yyextra->code->codify(yytext);
1668 yyextra->skipInlineInitContext=YY_START;
1669 yyextra->curlyCount=0;
1677<InlineInit>"{" { yyextra->curlyCount++;
1678 yyextra->code->codify(yytext);
1681 yyextra->code->codify(yytext);
1682 if (--yyextra->curlyCount<=0)
1684 BEGIN(yyextra->skipInlineInitContext);
1691 yyextra->code->codify(yytext);
1693<MemberCall2,FuncCall>"(" {
1694 yyextra->parmType.clear();yyextra->parmName.clear();
1695 yyextra->code->codify(yytext);
1696 yyextra->bracketCount++;
1697 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1698 if (YY_START==FuncCall && !yyextra->insideBody)
1700 yyextra->theVarContext.pushScope();
1703<MemberCall2,FuncCall>{OPERATOR} {
1710 yyextra->parmType.clear();yyextra->parmName.clear();
1712 yyextra->code->codify(yytext);
1714<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
1717 DBG_CTX((stderr,
"addVariable(%s,%s)\n",
qPrint(yyextra->parmType),
qPrint(yyextra->parmName)));
1718 if (yyextra->parmType.isEmpty())
1720 yyextra->parmType=yyextra->parmName;
1721 yyextra->parmName.clear();
1723 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1727 yyextra->parmType = yyextra->parmName;
1728 yyextra->parmName.clear();
1729 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1731 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
1732 yyextra->inForEachExpression =
FALSE;
1734 yyextra->code->codify(yytext);
1735 if (--yyextra->bracketCount<=0)
1737 if (yyextra->name.isEmpty())
1747<MemberCall,MemberCall2,FuncCall>[;:] {
1749 if (yyextra->bracketCount<=0)
1756 yyextra->code->codify(yytext);
1759<CallEnd>[ \t\n]* {
codifyLines(yyscanner,yytext); }
1762 yyextra->bracketCount=0;
1763 if (*yytext==
';') yyextra->searchingForBody=
FALSE;
1764 if (!yyextra->type.isEmpty())
1766 DBG_CTX((stderr,
"add variable yyextra->type=%s yyextra->name=%s)\n",
qPrint(yyextra->type),
qPrint(yyextra->name)));
1767 addVariable(yyscanner,yyextra->type,yyextra->name);
1769 yyextra->parmType.clear();yyextra->parmName.clear();
1771 if (*yytext==
';' || yyextra->insideBody)
1773 if (!yyextra->insideBody)
1775 yyextra->theVarContext.popScope();
1777 yyextra->name.clear();yyextra->type.clear();
1782 yyextra->bracketCount=0;
1786<CallEnd>{ENDQopt}/{BN}*(";"|"="|"throw"{BN}*"(") {
1791<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
1792 if (yyextra->insideBody)
1794 yyextra->theVarContext.pushScope();
1796 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1798 yyextra->parmType.clear();yyextra->parmName.clear();
1799 int index = yyextra->name.findRev(
"::");
1800 DBG_CTX((stderr,
"yyextra->name=%s\n",
qPrint(yyextra->name)));
1804 if (!yyextra->scopeName.isEmpty()) scope.
prepend((yyextra->scopeName+
"::"));
1810 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1816 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1821 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1824 yytext[yyleng-1]=
'\0';
1826 if (!cv.stripWhiteSpace().isEmpty())
1836 yyextra->code->codify(
"{");
1837 if (yyextra->searchingForBody)
1839 yyextra->searchingForBody=
FALSE;
1840 yyextra->insideBody=
TRUE;
1842 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1843 yyextra->type.clear(); yyextra->name.clear();
static NamespaceDefMutable * globalScope
QCString & prepend(const char *s)
1848 yyextra->code->codify(yytext);
1850 yyextra->inFunctionTryBlock=
TRUE;
1852<CallEnd>"requires" {
1854 yyextra->code->codify(yytext);
1858 if (yyextra->insideBody || !yyextra->parmType.isEmpty())
1864 yyextra->parmName=yytext;
1866 BEGIN(OldStyleArgs);
1870 yyextra->parmName=yytext;
1874 yyextra->code->codify(yytext);
1875 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
1876 if (*yytext==
';') yyextra->parmType.clear();
1877 yyextra->parmName.clear();
1879<CallEnd,OldStyleArgs>"#" {
1881 yyextra->lastSkipCppContext = Body;
1882 yyextra->code->codify(yytext);
1887 if (!yyextra->insideBody)
1889 yyextra->theVarContext.popScope();
1891 yyextra->name.clear();yyextra->args.clear();
1892 yyextra->parmType.clear();yyextra->parmName.clear();
1896 yyextra->code->codify(yytext);
1897 yyextra->type.clear(); yyextra->name.clear();
1901 yyextra->code->codify(yytext);
1902 if (yyextra->searchingForBody)
1904 yyextra->searchingForBody=
FALSE;
1905 yyextra->insideBody=
TRUE;
1907 if (yyextra->insideBody) yyextra->bodyCurlyCount++;
1908 if (yyextra->name.find(
"::")!=-1)
1910 DBG_CTX((stderr,
"** scope stack push SCOPEBLOCK\n"));
1916 DBG_CTX((stderr,
"** scope stack push INNERBLOCK\n"));
1919 yyextra->type.clear(); yyextra->name.clear();
1922<SkipInits>{ID}{B}*"{" {
1924 int bracketPos = text.
find(
'{');
1925 int spacePos = text.
find(
' ');
1926 int len = spacePos==-1 ? bracketPos : spacePos;
1928 yyextra->code->codify(
QCString(yytext+len));
1936<FuncCall>{ID}/("."|"->") {
1937 yyextra->name=yytext;
1939 BEGIN( MemberCall2 );
1941<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
1942 yyextra->code->codify(yytext);
1943 uint32_t s=0;
while (!
isId(yytext[s])) s++;
1944 uint32_t e=(uint32_t)yyleng-1;
while (e>1 && !
isId(yytext[e])) e--;
1945 yyextra->name=((
QCString)yytext).mid(s,e-s+1);
1946 BEGIN( MemberCall2 );
1948<MemberCall2>{ID}/([ \t\n]*"(") {
1949 if (!yyextra->args.isEmpty())
1953 yyextra->args.clear();
1956<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
1958 yyextra->name=yytext;
1960 BEGIN( MemberCall2 );
1962<MemberCall2>"->"|"." {
1967 yyextra->code->codify(yytext);
1968 yyextra->memCallContext = YY_START;
1969 BEGIN( MemberCall );
1971<SkipComment>{CCS}("!"?){CCE} {
1972 yyextra->code->codify(yytext);
1974 BEGIN( yyextra->lastCContext ) ;
1976<SkipComment>{CPPC}|{CCS} {
1977 yyextra->code->codify(yytext);
1979<SkipComment>[^*\/\n]+ {
1980 yyextra->code->codify(yytext);
1982<SkipComment>[ \t]*{CCE} {
1983 yyextra->code->codify(yytext);
1985 if (yyextra->lastCContext==SkipCPP)
1989 BEGIN( yyextra->lastCContext ) ;
1991<SkipCxxComment>[^\r\n]*"\\"[\r]?\n {
1994<SkipCxxComment>[^\r\n]+ {
1995 yyextra->code->codify(yytext);
2001 BEGIN( yyextra->lastCContext ) ;
2004 yyextra->code->codify(yytext);
2006<MemberCall>[^a-z_A-Z0-9(\n] {
2007 yyextra->code->codify(yytext);
2008 yyextra->type.clear();
2009 yyextra->name.clear();
2010 BEGIN(yyextra->memCallContext);
2012<*>\n({B}*{CPPC}[!/][^\n]*\n)+ {
2013 if (YY_START==SkipCPP) REJECT;
2018 if (YY_START==SkipCxxComment)
2020 BEGIN( yyextra->lastCContext ) ;
2025 BEGIN( yyextra->lastSkipCppContext ) ;
2028<*>\n{B}*{CPPC}"@"[{}].*\n {
2033 if (YY_START==SkipCxxComment)
2035 BEGIN( yyextra->lastCContext ) ;
2038<*>\n{B}*{CCS}"@"[{}] {
2040 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2042 yyextra->lastCContext = YY_START ;
2048<*>^{B}*{CPPC}"@"[{}].*\n {
2054<*>^{B}*{CCS}"@"[{}] {
2056 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2058 yyextra->lastCContext = YY_START ;
2061 yyextra->code->codify(yytext);
2064<*>^{B}*{CPPC}[!/][^\n]* {
2069<*>{CPPC}[!/][^\n]* {
2070 if (YY_START==SkipComment || YY_START==SkipString) REJECT;
2075<*>\n{B}*{CCS}[!*]/{NCOMM} {
2077 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2079 yyextra->lastCContext = YY_START ;
2085<*>^{B}*{CCS}"*"[*]+/[^/] {
2087 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2089 yyextra->lastCContext = YY_START ;
2093 yyextra->code->codify(yytext);
#define Config_getBool(name)
2096<*>^{B}*{CCS}[!*]/{NCOMM} {
2098 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2100 yyextra->lastCContext = YY_START ;
2103 yyextra->code->codify(yytext);
2106<*>{CCS}[!*]/{NCOMM} {
2107 if (YY_START==SkipString) REJECT;
2109 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2111 yyextra->lastCContext = YY_START ;
2114 yyextra->code->codify(yytext);
2117<*>{CCS}("!"?){CCE} {
2118 if (YY_START==SkipString) REJECT;
2121 yyextra->code->codify(yytext);
2124<SkipComment>[^\*\n]+ {
2125 yyextra->code->codify(yytext);
2129 yyextra->code->codify(yytext);
2131 if (YY_START != SkipComment && YY_START != SkipCxxComment)
2133 yyextra->lastCContext = YY_START ;
2135 BEGIN( SkipComment ) ;
2139 yyextra->code->codify(yytext);
2140 yyextra->lastVerbStringContext=YY_START;
2141 BEGIN(SkipVerbString);
2145 yyextra->code->codify(yytext);
2146 yyextra->lastCContext = YY_START ;
2147 BEGIN( SkipCxxComment ) ;
2150 if (yytext[0]==
'(') yyextra->bracketCount++;
2151 yyextra->code->codify(yytext);
2152 yyextra->theCallContext.pushScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2155 if (yytext[0]==
')') yyextra->bracketCount--;
2156 yyextra->code->codify(yytext);
2157 yyextra->theCallContext.popScope(yyextra->name, yyextra->type, yyextra->bracketCount);
2163 yyextra->code->codify(yytext);
2166 yyextra->code->codify(yytext);
2183 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2191 DBG_CTX((stderr,
"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n",
2192 qPrint(ltype),
qPrint(lname),yyextra->currentDefinition?
qPrint(yyextra->currentDefinition->name()):
"<none>"));
2193 auto it = yyextra->codeClassMap.find(ltype.
str());
2194 if (it!=yyextra->codeClassMap.end())
2197 yyextra->theVarContext.addVariable(lname,std::move(it->second));
2201 auto findVariableType = [&yyscanner,&yyg,<ype,&lname,&name](
const Definition *d) ->
const ClassDef *
2203 const ClassDef *varDef = yyextra->symbolResolver.resolveClass(d,ltype,
true);
2210 else if ((i=ltype.find(
'<'))!=-1)
2217 const ClassDef *varDef = findVariableType(yyextra->currentDefinition);
2218 if (varDef==
nullptr)
2220 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
2222 varDef = findVariableType(namespaceDef);
2226 if (varDef==
nullptr)
2228 if (!yyextra->theVarContext.atGlobalScope())
2232 DBG_CTX((stderr,
"** addVariable: dummy context for '%s'\n",
qPrint(lname)));
2237 DBG_CTX((stderr,
"** addVariable: not adding variable!\n"));
2248 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2249 yyextra->scopeNameLengthStack.push_back(
int(yyextra->scopeName.length()));
2250 if (yyextra->scopeName.isEmpty() ||
leftScopeMatch(s,yyextra->scopeName))
2252 yyextra->scopeName = s;
2256 yyextra->scopeName +=
"::";
2257 yyextra->scopeName += s;
2266 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2267 if (!yyextra->scopeNameLengthStack.empty())
2269 int length = yyextra->scopeNameLengthStack.back();
2270 yyextra->scopeNameLengthStack.pop_back();
2271 yyextra->scopeName.resize(length);
2277 DBG_CTX((stderr,
"popScope() result: '%s'\n",
qPrint(yyextra->scopeName)));
2282 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2285 if (yyextra->searchCtx)
2312 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2318 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
2319 if (ts!=-1 && te!=-1 && te>ts)
2324 while (!yyextra->scopeNameLengthStack.empty())
2328 yyextra->scopeName.clear();
2330 while ((i=n.
find(
"::"))!=-1)
2336 DBG_CTX((stderr,
"--->New class scope '%s'\n",
qPrint(yyextra->scopeName)));
2341 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2342 while (!yyextra->foldStack.empty())
2344 const Definition *dd = yyextra->foldStack.back();
2347 yyextra->code->endFold();
2349 yyextra->foldStack.pop_back();
2364 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2373 if (endLine!=-1 && startLine!=endLine &&
2381 (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
2389 yyextra->code->startFold(yyextra->yyLineNr,
"",
"");
2393 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2397 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2402 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"};");
2406 yyextra->code->startFold(yyextra->yyLineNr,
"{",
"}");
2408 yyextra->foldStack.push_back(d);
2420 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2422 if (yyextra->sourceFileDef && yyextra->lineNumbers)
2428 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
2430 DBG_CTX((stderr,
"%s:startCodeLine(%d)=%p\n",
qPrint(yyextra->sourceFileDef->name()),yyextra->yyLineNr,(
void*)d));
2431 if (!yyextra->includeCodeFragment && d)
2433 yyextra->currentDefinition = d;
2434 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
2435 yyextra->insideBody =
FALSE;
2436 yyextra->searchingForBody =
TRUE;
2438 yyextra->type.
clear();
2439 yyextra->name.clear();
2440 yyextra->args.clear();
2441 yyextra->parmType.clear();
2442 yyextra->parmName.clear();
2443 DBG_CTX((stderr,
"Real scope: '%s'\n",
qPrint(yyextra->realScope)));
2444 yyextra->bodyCurlyCount = 0;
2446 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
2447 if (yyextra->currentMemberDef)
2450 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
2451 yyextra->currentMemberDef->getOutputFileBase(),
2452 yyextra->currentMemberDef->anchor(),
2453 yyextra->yyLineNr,!yyextra->includeCodeFragment);
2461 QCString(),yyextra->yyLineNr,!yyextra->includeCodeFragment);
2473 !yyextra->includeCodeFragment);
2476 DBG_CTX((stderr,
"startCodeLine(%d)\n",yyextra->yyLineNr));
2477 yyextra->code->startCodeLine(yyextra->yyLineNr);
2478 yyextra->insideCodeLine =
true;
2479 if (yyextra->currentFontClass)
2481 yyextra->code->startFontClass(
QCString(yyextra->currentFontClass));
2489 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2490 DBG_CTX((stderr,
"endCodeLine(%d)\n",yyextra->yyLineNr));
2492 yyextra->code->endCodeLine();
2493 yyextra->insideCodeLine =
false;
2498 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2499 const char * fc = yyextra->currentFontClass;
2500 if (yyextra->insideCodeLine)
2504 if (yyextra->yyLineNr<yyextra->inputLines)
2506 yyextra->currentFontClass = fc;
2516 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2517 DBG_CTX((stderr,
"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,
qPrint(text)));
2519 const char *p=text.
data(),*sp=p;
2525 while ((c=*p++) && c!=
'\n');
2528 yyextra->yyLineNr++;
2529 size_t l =
static_cast<size_t>(p-sp-1);
2530 std::string tmp(sp,l);
2531 yyextra->code->codify(tmp.c_str());
2536 yyextra->code->codify(
QCString(sp));
2550 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2551 if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
2569 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2571 yyextra->tooltipManager.addTooltip(d);
2576 if (!sourceTooltips)
2581 const char *p=text.
data();
2586 while ((c=*p++) && c!=
'\n') { }
2589 yyextra->yyLineNr++;
2605 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2606 if (yyextra->name==
"const") { yyextra->name.clear();
return; }
2607 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2608 yyextra->type += yyextra->name ;
2609 yyextra->name.clear() ;
2610 if (!yyextra->type.isEmpty()) yyextra->type +=
' ' ;
2611 yyextra->type += yyextra->args ;
2612 yyextra->args.clear() ;
2617 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2618 if (yyextra->parmName==
"const") { yyextra->parmName.clear();
return; }
2619 if (!yyextra->parmType.isEmpty()) yyextra->parmType +=
' ' ;
2620 yyextra->parmType += yyextra->parmName ;
2621 yyextra->parmName.clear() ;
2627 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2628 if (yyextra->sourceFileDef && !name.
isEmpty())
2633 yyextra->theUsingContext.emplace(name.
str(),nd);
2640 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2643 yyextra->parmName = a.name;
2644 yyextra->parmType = a.type;
2645 int i = yyextra->parmType.find(
'*');
2646 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2647 i = yyextra->parmType.find(
'&');
2648 if (i!=-1) yyextra->parmType = yyextra->parmType.left(i);
2649 yyextra->parmType.stripPrefix(
"const ");
2650 yyextra->parmType=yyextra->parmType.stripWhiteSpace();
2651 addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
2657 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2658 DBG_CTX((stderr,
"stripClassName(scope=%s,type=%s) scopeName=%s\n",
2666 QCString clName=className+templSpec;
2668 if (!yyextra->scopeName.isEmpty())
2670 cd=yyextra->symbolResolver.resolveClass(d,yyextra->scopeName+
"::"+clName,
true);
2674 cd=yyextra->symbolResolver.resolveClass(d,clName,
true);
2676 DBG_CTX((stderr,
"stripClass trying '%s' = %p\n",
qPrint(clName),(
void*)cd));
2688 if (name.
isEmpty())
return nullptr;
2689 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2690 DBG_CTX((stderr,
"setCallContextForVar(%s) yyextra->scopeName=%s\n",
qPrint(name),
qPrint(yyextra->scopeName)));
2692 int scopeEnd = name.
findRev(
"::");
2699 if (mcd && !locName.
isEmpty())
2712 if (mnd && !locName.
isEmpty())
2728 DBG_CTX((stderr,
"local variable?\n"));
2732 yyextra->theCallContext.setScope(*mcv);
2737 DBG_CTX((stderr,
"class member? scope=%s\n",
qPrint(yyextra->scopeName)));
2747 if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=
CLASSBLOCK)
2764 const std::unique_ptr<MemberDef> &md=mn->
front();
2765 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2772 else if (mn->
size()>1)
2774 for (
const auto &md : *mn)
2783 if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
2786 DBG_CTX((stderr,
"returning member %s in source file %s\n",
qPrint(md->name()),
qPrint(yyextra->sourceFileDef->name())));
2798 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2799 const Definition *d = yyextra->theCallContext.getScope().globalDef();
2822 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2823 DBG_CTX((stderr,
"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",
qPrint(c),
qPrint(m),varOnly));
2828 DBG_CTX((stderr,
"scopeNameLengthStack.size()=%zu\n",yyextra->scopeNameLengthStack.size()));
2829 if (!result.
found && !yyextra->scopeNameLengthStack.empty() && c==yyextra->scopeName)
2831 QCString localName = yyextra->scopeName.
mid(yyextra->scopeNameLengthStack[0]+2);
2832 auto it = yyextra->codeClassMap.
find(localName.
str());
2833 if (it!=yyextra->codeClassMap.end())
2840 DBG_CTX((stderr,
"trying lookup via base class %s\n",
qPrint(bcName)));
2843 if (result.
found)
break;
2853 if (yyextra->exampleBlock)
2857 anchor.
sprintf(
"a%d",yyextra->anchorCount);
2859 qPrint(yyextra->exampleFile)));
2861 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
2864 yyextra->anchorCount++;
2878 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n",
2879 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,yyextra->insideBody));
2881 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
2882 yyextra->insideBody && yyextra->collectXRefs)
2904 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2905 DBG_CTX((stderr,
"getLink(%s,%s) yyextra->curClassName=%s\n",
2911 if (!yyextra->curClassName.isEmpty())
2914 c.
prepend(yyextra->curClassName);
2928 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2930 if (!scopeName.
isEmpty() && scopeName[0]==
'~')
2932 scopeName=scopeName.
mid(1);
2936 yyextra->code->codify(
"~");
2939 if (yyextra->insideProtocolList)
2951 if (yyextra->currentDefinition==
nullptr && !yyextra->scopeName.isEmpty())
2953 scopeName = yyextra->scopeName+
"::"+scopeName;
2959 DBG_CTX((stderr,
"generateClassOrGlobalLink(name=%s) yyextra->scopeName=%s scopeName=%s\n",
qPrint(scName),
qPrint(yyextra->scopeName),
qPrint(scopeName)));
2960 if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(scopeName))==
nullptr)
2962 int i=scopeName.
find(
'<');
2964 if (i!=-1) bareName = bareName.
left(i);
2966 auto checkForSymbol = [&yyg,&bareName,&scopeName](
const Definition *
parent,
2969 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,scopeName,
QCString(),
false,
true);
2970 DBG_CTX((stderr,
"non-local variable name=%s sym=%s!\n",
2971 qPrint(scopeName),sym_?
qPrint(sym_->name()):
"<none>"));
2972 if (sym_==
nullptr && !bareName.
isEmpty())
2975 if (bareName!=scopeName)
2977 sym_ = yyextra->symbolResolver.resolveSymbol(
parent,bareName,
QCString(),
false,
true);
2981 const Definition *d = yyextra->currentDefinition;
2982 DBG_CTX((stderr,
"d=%s yyextra->sourceFileDef=%s\n",d?
qPrint(d->
name()):
"<none>",yyextra->sourceFileDef?
qPrint(yyextra->sourceFileDef->name()):
"<none>"));
2983 checkForSymbol(d,sym);
2992 checkForSymbol(nd,sym);
3000 for (
const auto &[usingName,namespaceDef] : yyextra->theUsingContext)
3002 checkForSymbol(namespaceDef,sym);
3024 DBG_CTX((stderr,
"is found as a type sym=%s nd=%s\n",
3029 if (
getLink(yyscanner,yyextra->scopeName,scName,ol,scName,varOnly))
3037 DBG_CTX((stderr,
"local variable!\n"));
3041 yyextra->theCallContext.setScope(*lcd);
3052 DBG_CTX((stderr,
"is a local variable sym=%p!\n",(
void*)sym));
3054 yyextra->isPrefixedWithThis =
FALSE;
3059 if (yyextra->exampleBlock)
3063 anchor.
sprintf(
"_a%d",yyextra->anchorCount);
3064 DBG_CTX((stderr,
"addExampleClass(%s,%s,%s)\n",
qPrint(anchor),
qPrint(yyextra->exampleName),
3065 qPrint(yyextra->exampleFile)));
3069 if (cdm && cdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3072 yyextra->anchorCount++;
3078 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3081 yyextra->anchorCount++;
3095 yyextra->currentMemberDef && yyextra->collectXRefs)
3104 DBG_CTX((stderr,
"class %s not linkable! cd=%p typeOnly=%d\n",
qPrint(scName),(
void*)sym,typeOnly));
3105 if (!isLocal && (md || (!sym && !typeOnly)))
3110 DBG_CTX((stderr,
"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%s\n",
qPrint(scName),(
void*)md,yyextra->currentDefinition ?
qPrint(yyextra->currentDefinition->name()) :
"<none>"));
3111 if (md && yyextra->currentDefinition)
3113 DBG_CTX((stderr,
"%s accessible from %s? %d md->getOuterScope=%s\n",
3114 qPrint(md->name()),
qPrint(yyextra->currentDefinition->name()),
3115 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md),
3116 qPrint(md->getOuterScope()->name())));
3119 if (md && yyextra->currentDefinition &&
3120 yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md)==-1)
3127 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()));
3128 if (md->isLinkable())
3132 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3142 DBG_CTX((stderr,
"not found!\n"));
3149 bool typeOnly,
bool varOnly)
3159 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3163 DBG_CTX((stderr,
"type='%s' args='%s' class=%s\n",
3167 if (yyextra->exampleBlock)
3171 anchor.
sprintf(
"a%d",yyextra->anchorCount);
3173 qPrint(yyextra->exampleFile)));
3175 if (mdm && mdm->
addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
3178 yyextra->anchorCount++;
3192 DBG_CTX((stderr,
"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",
3193 (
void*)yyextra->currentDefinition,(
void*)yyextra->currentMemberDef,(
void*)xmd,yyextra->insideBody));
3195 if (xmd->templateMaster()) xmd = xmd->templateMaster();
3197 if (xmd->isLinkable())
3200 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
3201 yyextra->insideBody && yyextra->collectXRefs)
3221 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3226 DBG_CTX((stderr,
"generateClassMemberLink(class=%s,member=%s)=%p\n",
qPrint(def->
name()),
qPrint(memName),(
void*)xmd));
3264 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3265 DBG_CTX((stderr,
"generateMemberLink(object=%s,mem=%s) classScope=%s\n",
3268 if (varName.
isEmpty())
return;
3276 DBG_CTX((stderr,
"Class found!\n"));
3279 DBG_CTX((stderr,
"Found result!\n"));
3286 if (
getLink(yyscanner,bcName,memName,ol))
3288 DBG_CTX((stderr,
"Found result!\n"));
3297 const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->scopeName,
true);
3300 DBG_CTX((stderr,
"Found class %s for variable '%s'\n",
qPrint(yyextra->scopeName),
qPrint(varName)));
3314 for (
const auto &vmd : *vmn)
3316 if (vmd->getClassDef()==jcd)
3318 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3331 DBG_CTX((stderr,
"There is a variable with name '%s'\n",
qPrint(varName)));
3332 for (
const auto &vmd : *vmn)
3334 if (vmd->getClassDef()==vcd)
3336 DBG_CTX((stderr,
"Found variable type=%s\n",
qPrint(vmd->typeString())));
3355 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3358 DBG_CTX((stderr,
"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,
qPrint(name),
qPrint(yyextra->scopeName)));
3367 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3369 QCString locScope=yyextra->scopeName;
3374 QCString funcWithFullScope=locFunc;
3379 if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() &&
3380 funcName==yyextra->currentMemberDef->localName() &&
3381 yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr &&
3393 if (i==-1) i=locFunc.
findRev(
"."),len=1;
3394 if (i==-1) i=locFunc.
findRev(
"\\"),len=1;
3397 funcScope=locFunc.
left(i);
3399 int ts=locScope.
find(
'<');
3401 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3402 if (ts!=-1 && te!=-1 && te>ts)
3407 ts=funcScope.
find(
'<');
3409 DBG_CTX((stderr,
"ts=%d te=%d\n",ts,te));
3410 if (ts!=-1 && te!=-1 && te>ts)
3413 funcScope=funcScope.
left(ts)+funcScope.
right(funcScope.
length()-te-1);
3417 funcWithScope = funcScope+
"::"+locFunc;
3420 fullScope=locScope+
"::"+funcScope;
3425 funcWithFullScope = locScope+
"::"+funcWithScope;
3431 auto it = yyextra->codeClassMap.find(fullScope.
str());
3432 if (it!=yyextra->codeClassMap.end())
3439 if (
getLink(yyscanner,bcName,locFunc,ol,funcName))
3448 if (!locScope.
isEmpty() && fullScope!=locScope)
3450 auto it = yyextra->codeClassMap.find(locScope.
str());
3451 if (it!=yyextra->codeClassMap.end())
3458 if (
getLink(yyscanner,bcName,funcWithScope,ol,funcName))
3466 if (!
getLink(yyscanner,locScope,funcWithScope,ol,funcName))
3482 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3483 const char *p=yyextra->inputString;
3489 if (c==
'\n') count++;
3491 if (p>yyextra->inputString && *(p-1)!=
'\n')
3500 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3501 if (yyextra->currentFontClass)
3503 yyextra->code->endFontClass();
3504 yyextra->currentFontClass=
nullptr;
3506 if (specialComment && yyextra->insideSpecialComment)
3508 yyextra->code->endSpecialComment();
3509 yyextra->insideSpecialComment =
false;
3515 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3519 yyextra->code->startSpecialComment();
3520 yyextra->insideSpecialComment =
true;
3522 yyextra->code->startFontClass(
QCString(s));
3523 yyextra->currentFontClass=s;
3531 if (ctx==
nullptr)
return;
3532 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3536 DBG_CTX((stderr,
"writeObjCMethodCall(%s) obj=%s method=%s\n",
3545 DBG_CTX((stderr,
" object is local variable\n"));
3553 DBG_CTX((stderr,
" class=%p method=%p\n",(
void*)cd,(
void*)ctx->
method));
3564 char skipChar =
' ';
3589 yyextra->code->codify(
"$");
3597 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3599 int refId=refIdStr.
toInt();
3600 auto it = yyextra->nameMap.find(refId);
3601 if (it!=yyextra->nameMap.end())
3607 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3619 DBG_CTX((stderr,
"Invalid name: id=%d\n",refId));
3626 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3628 int refId=refIdStr.
toInt();
3629 auto it = yyextra->objectMap.find(refId);
3630 if (it!=yyextra->objectMap.end())
3635 if (yyextra->currentDefinition &&
3652 else if (
object==
"super")
3654 if (yyextra->currentDefinition &&
3681 if (yyextra->currentMemberDef && yyextra->collectXRefs)
3694 int dotPos=
object.find(
'.',pp);
3695 int len =
static_cast<int>(
object.length());
3696 if (dotPos==-1) dotPos=len;
3697 const Definition *scope = yyextra->currentDefinition;
3704 if (fragmentStripped==
"self")
3717 const Definition *symbol = yyextra->symbolResolver.resolveSymbol(scope,fragmentStripped,
QCString(),
false,
true);
3723 ctx->
method = yyextra->symbolResolver.getTypedef();
3747 dotPos=
object.find(
'.',pp);
3748 if (dotPos==-1) dotPos=len;
3757 else if (ctx->
method==
nullptr)
3760 DBG_CTX((stderr,
"yyextra->currentDefinition=%p\n",(
void*)yyextra->currentDefinition));
3761 if (yyextra->currentDefinition &&
3782 DBG_CTX((stderr,
"Invalid object: id=%d\n",refId));
3789 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3791 int refId=refIdStr.
toInt();
3792 auto it = yyextra->contextMap.find(refId);
3793 if (it!=yyextra->contextMap.end())
3808 if (mn && mn->
size()==1)
3826 DBG_CTX((stderr,
"Invalid context: id=%d\n",refId));
3833 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3835 int refId=refIdStr.
toInt();
3836 auto it = yyextra->wordMap.find(refId);
3837 if (it!=yyextra->wordMap.end())
3840 bool isKeyword =
word==
"self";
3856 while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
3858 int refId=refIdStr.
toInt();
3859 auto it = yyextra->commentMap.find(refId);
3860 if (it!=yyextra->commentMap.end())
3874 else if (c==
'\'' || c ==
'"')
3891 DBG_CTX((stderr,
"}=(type='%s',name='%s')",
3901 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3903 result.
sprintf(
"$n%d",yyextra->currentNameId);
3904 yyextra->nameMap.emplace(yyextra->currentNameId,s);
3905 yyextra->currentNameId++;
3911 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3913 result.
sprintf(
"$o%d",yyextra->currentObjId);
3914 yyextra->objectMap.emplace(yyextra->currentObjId,s);
3915 yyextra->currentObjId++;
3921 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3923 result.
sprintf(
"$w%d",yyextra->currentWordId);
3924 yyextra->wordMap.emplace(yyextra->currentWordId,s);
3925 yyextra->currentWordId++;
3931 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3933 result.
sprintf(
"$d%d",yyextra->currentCommentId);
3934 yyextra->commentMap.emplace(yyextra->currentCommentId,s);
3935 yyextra->currentCommentId++;
3941 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3942 static const std::unordered_set<std::string> non_cpp_keywords = {
3943 "__assume",
"__super",
"abstract",
"function",
3944 "gcnew",
"gcroot",
"generic",
"get",
3945 "internal",
"null",
"pin_ptr",
"raise",
3946 "remove",
"self",
"set",
"transient",
3949 static const std::unordered_set<std::string> non_java_keywords = {
3950 "alignas",
"alignof",
"and",
"and_eq",
"asm",
3951 "atomic_cancel",
"atomic_commit",
"atomic_noexcept",
"auto",
"bitand",
3952 "bitor",
"bool",
"char8_t",
"char16_t",
"char32_t",
3953 "compl",
"concept",
"consteval",
"constexpr",
"constinit",
3954 "const_cast",
"co_await",
"co_return",
"co_yield",
"decltype",
3955 "delete",
"dynamic_cast",
"explicit",
"export",
"extern",
3956 "friend",
"inline",
"mutable",
"namespace",
"noexcept",
3957 "not",
"not_eq",
"nullptr",
"operator",
"or",
3958 "or_eq",
"reflexpr",
"register",
"reinterpret_cast",
"requires",
3959 "signed",
"sizeof",
"static_assert",
"_Static_assert",
"static_cast",
"struct",
3960 "template",
"thread_local",
"typedef",
"typeid",
"typename",
3961 "union",
"unsigned",
"using",
"virtual",
"wchar_t",
3962 "xor",
"xor_eq",
"override",
"sealed"
3964 bool retval =
false;
3965 switch (yyextra->lang)
3968 retval = (non_cpp_keywords.find(keyword) != non_cpp_keywords.end());
3971 retval = (non_java_keywords.find(keyword) != non_java_keywords.end());
3984 if (i==-1)
return FALSE;
3986 return kw==
"const_cast" || kw==
"static_cast" || kw==
"dynamic_cast" || kw==
"reinterpret_cast";
3991 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3992 yy_size_t inputPosition = yyextra->inputPosition;
3993 const char *s = yyextra->inputString + inputPosition;
3995 while( c < max_size && *s )
4000 yyextra->inputPosition += c;
4007 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4008 if (yyextra->currentCtx)
4010 yyextra->currentCtx->format+=
QCString().
sprintf(
"$c%d",yyextra->currentCtxId);
4011 if (yyextra->braceCount==0 && YY_START==ObjCCall)
4013 yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1);
4014 DBG_CTX((stderr,
"new type=%s\n",
qPrint(yyextra->currentCtx->objectTypeOrName)));
4016 yyextra->contextStack.push(yyextra->currentCtx);
4020 DBG_CTX((stderr,
"Trying to save NULL context!\n"));
4022 auto newCtx = std::make_unique<ObjCCallCtx>();
4023 newCtx->id = yyextra->currentCtxId;
4024 newCtx->lexState = YY_START;
4025 newCtx->braceCount = yyextra->braceCount;
4026 newCtx->objectType =
nullptr;
4027 newCtx->objectVar =
nullptr;
4028 newCtx->method =
nullptr;
4029 DBG_CTX((stderr,
"save state=%d\n",YY_START));
4030 yyextra->currentCtx = newCtx.get();
4031 yyextra->contextMap.emplace(yyextra->currentCtxId,std::move(newCtx));
4032 yyextra->braceCount = 0;
4033 yyextra->currentCtxId++;
4038 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4039 DBG_CTX((stderr,
"restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState));
4040 BEGIN(yyextra->currentCtx->lexState);
4041 yyextra->braceCount = yyextra->currentCtx->braceCount;
4042 if (!yyextra->contextStack.empty())
4044 yyextra->currentCtx = yyextra->contextStack.top();
4045 yyextra->contextStack.pop();
4049 yyextra->currentCtx =
nullptr;
4050 DBG_CTX((stderr,
"Trying to pop context while yyextra->contextStack is empty!\n"));
4062 codeYYlex_init_extra(&
p->state,&
p->yyscanner);
4071 codeYYlex_destroy(
p->yyscanner);
4076 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4077 DBG_CTX((stderr,
"***CodeParser::reset()\n"));
4078 yyextra->theVarContext.clear();
4079 while (!yyextra->scopeNameLengthStack.empty()) yyextra->scopeNameLengthStack.pop_back();
4080 yyextra->codeClassMap.clear();
4081 yyextra->curClassBases.clear();
4082 yyextra->anchorCount = 0;
4083 yyextra->insideCodeLine =
false;
4088 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4089 yyextra->insideCodeLine = inp;
4094 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4095 return yyextra->insideCodeLine;
4100 int startLine,
int endLine,
bool inlineFragment,
4105 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
4106 DBG_CTX((stderr,
"***parseCode() exBlock=%d exName=%s fd=%p scopeName=%s searchCtx=%s\n",
4114 yyextra->code = &od;
4115 yyextra->inputString = s.
data();
4116 yyextra->fileName = fd ? fd->
fileName():
"";
4118 yyextra->inputPosition = 0;
4119 codeYYrestart(
nullptr,yyscanner);
4120 yyextra->currentFontClass =
nullptr;
4121 yyextra->searchCtx = searchCtx;
4122 yyextra->collectXRefs = collectXRefs;
4123 yyextra->inFunctionTryBlock =
FALSE;
4124 yyextra->symbolResolver.setFileScope(fd);
4125 yyextra->foldStack.clear();
4126 yyextra->insideSpecialComment =
false;
4129 yyextra->yyLineNr = startLine;
4131 yyextra->yyLineNr = 1;
4134 yyextra->inputLines = endLine+1;
4136 yyextra->inputLines = yyextra->yyLineNr +
countLines(yyscanner) - 1;
4138 yyextra->curlyCount = 0;
4139 yyextra->bodyCurlyCount = 0;
4140 yyextra->bracketCount = 0;
4141 yyextra->sharpCount = 0;
4142 yyextra->insideTemplate =
FALSE;
4143 yyextra->theCallContext.clear();
4144 while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
4145 yyextra->scopeName = scopeName;
4147 yyextra->exampleBlock = exBlock;
4148 yyextra->exampleName = exName;
4149 yyextra->sourceFileDef = fd;
4150 yyextra->lineNumbers = fd && showLineNumbers;
4155 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
4157 yyextra->lang = lang;
4159 if (yyextra->sourceFileDef)
4164 yyextra->currentMemberDef =
nullptr;
4165 yyextra->searchingForBody = exBlock;
4166 yyextra->insideBody =
FALSE;
4167 yyextra->bracketCount = 0;
4168 if (!yyextra->exampleName.isEmpty())
4171 DBG_CTX((stderr,
"yyextra->exampleFile=%s\n",
qPrint(yyextra->exampleFile)));
4173 yyextra->includeCodeFragment = inlineFragment;
4174 DBG_CTX((stderr,
"** exBlock=%d exName=%s include=%d\n",exBlock,
qPrint(exName),inlineFragment));
4175 if (!yyextra->insideCodeLine)
4179 yyextra->type.clear();
4180 yyextra->name.clear();
4181 yyextra->args.clear();
4182 yyextra->parmName.clear();
4183 yyextra->parmType.clear();
4186 codeYYlex(yyscanner);
4187 yyextra->lexInit=
TRUE;
4188 if (yyextra->insideCodeLine)
4194 while (!yyextra->foldStack.empty())
4196 yyextra->code->endFold();
4197 yyextra->foldStack.pop_back();
4200 if (yyextra->exampleFileDef)
4203 yyextra->exampleFileDef.reset();
4204 yyextra->sourceFileDef=
nullptr;
4207 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)