diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 10:54:13 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 10:54:13 +0900 |
commit | d6f1e74d173f59fc63d7e031cd9685b4eb38fed2 (patch) | |
tree | d50bd7e36be4511530c4159c74d29b7bcedc0d71 /src/code.l | |
parent | 021ee4c58494575f9f4eaedeba447a18b22ca4c1 (diff) | |
download | doxygen-d6f1e74d173f59fc63d7e031cd9685b4eb38fed2.tar.gz doxygen-d6f1e74d173f59fc63d7e031cd9685b4eb38fed2.tar.bz2 doxygen-d6f1e74d173f59fc63d7e031cd9685b4eb38fed2.zip |
Imported Upstream version 1.8.14upstream/1.8.14
Diffstat (limited to 'src/code.l')
-rw-r--r-- | src/code.l | 66 |
1 files changed, 53 insertions, 13 deletions
@@ -126,6 +126,7 @@ static bool g_lexInit = FALSE; static QStack<int> g_classScopeLengthStack; +static int g_prefixed_with_this_keyword = FALSE; static Definition *g_searchCtx; static bool g_collectXRefs; @@ -963,7 +964,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName bool isLocal=FALSE; //printf("generateClassOrGlobalLink(className=%s)\n",className.data()); - if ((lcd=g_theVarContext.findVariable(className))==0) // not a local variable + if (!g_prefixed_with_this_keyword || (lcd=g_theVarContext.findVariable(className))==0) // not a local variable { Definition *d = g_currentDefinition; //printf("d=%s g_sourceFileDef=%s\n",d?d->name().data():"<none>",g_sourceFileDef?g_sourceFileDef->name().data():"<none>"); @@ -1019,6 +1020,8 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName isLocal=TRUE; DBG_CTX((stderr,"is a local variable cd=%p!\n",cd)); } + g_prefixed_with_this_keyword = FALSE; // discard the "this" prefix for the next calls + if (cd && cd->isLinkable()) // is it a linkable class { DBG_CTX((stderr,"is linkable class %s\n",clName)); @@ -1821,7 +1824,8 @@ SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID}) SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+ KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property") KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"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"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|{KEYWORD_OBJC}) -FLOWKW ("break"|"case"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"for"|"foreach"|"for each"|"goto"|"if"|"return"|"switch"|"throw"|"throws"|"try"|"while"|"@try"|"@catch"|"@finally") +FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally") +FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try") TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"object"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"size_t"|"boolean"|"id"|"SEL"|"string"|"nullptr") CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast") CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'")) @@ -1943,7 +1947,6 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_code->codify(yytext); if (*yytext=='{') { - g_curlyCount++; if (g_searchingForBody) { g_searchingForBody=FALSE; @@ -2066,11 +2069,6 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" <SkipCPP>"//" { g_code->codify(yytext); } -<Body,FuncCall>"}" { - g_theVarContext.popScope(); - g_yyColNr++; - g_code->codify(yytext); - } <Body,FuncCall>"{" { g_theVarContext.pushScope(); @@ -2083,7 +2081,6 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_insideBody=TRUE; } g_code->codify(yytext); - g_curlyCount++; if (g_insideBody) { g_bodyCurlyCount++; @@ -2092,7 +2089,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_name.resize(0); BEGIN( Body ); } -<Body,MemberCall,MemberCall2>"}" { +<Body,FuncCall,MemberCall,MemberCall2>"}" { g_theVarContext.popScope(); g_type.resize(0); g_name.resize(0); @@ -2265,7 +2262,6 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" <Bases,ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*"{"{B}* { g_theVarContext.pushScope(); g_code->codify(yytext); - g_curlyCount++; if (YY_START==ClassVar && g_curClassName.isEmpty()) { g_curClassName = g_name.copy(); @@ -2416,6 +2412,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" <UsingName>\n { codifyLines(yytext); BEGIN(Body); } <UsingName>. { codifyLines(yytext); BEGIN(Body); } <Body,FuncCall>"$"?"this"("->"|".") { g_code->codify(yytext); // this-> for C++, this. for C# + g_prefixed_with_this_keyword = TRUE; } <Body>{KEYWORD}/([^a-z_A-Z0-9]) { startFontClass("keyword"); @@ -2457,6 +2454,18 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_inForEachExpression = (qstrcmp(yytext,"for each")==0 || qstrcmp(yytext, "foreach")==0); BEGIN(FuncCall); } +<Body>{FLOWCONDITION}/{BN}*"(" { + if (g_currentMemberDef && g_currentMemberDef->isFunction()) + { + g_currentMemberDef->addFlowKeyWord(); + } + startFontClass("keywordflow"); + codifyLines(yytext); + endFontClass(); + g_name.resize(0);g_type.resize(0); + g_inForEachExpression = (strcmp(yytext,"for each")==0 || strcmp(yytext, "foreach")==0); + BEGIN(FuncCall); + } <Body>{FLOWKW}/([^a-z_A-Z0-9]) { startFontClass("keywordflow"); codifyLines(yytext); @@ -2466,11 +2475,33 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_inFunctionTryBlock=FALSE; } } +<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) { + if (g_currentMemberDef && g_currentMemberDef->isFunction()) + { + g_currentMemberDef->addFlowKeyWord(); + } + startFontClass("keywordflow"); + codifyLines(yytext); + endFontClass(); + if (g_inFunctionTryBlock && (strcmp(yytext,"catch")==0 || strcmp(yytext,"finally")==0)) + { + g_inFunctionTryBlock=FALSE; + } + } <Body>{FLOWKW}/{B}* { startFontClass("keywordflow"); codifyLines(yytext); endFontClass(); } +<Body>{FLOWCONDITION}/{B}* { + if (g_currentMemberDef && g_currentMemberDef->isFunction()) + { + g_currentMemberDef->addFlowKeyWord(); + } + startFontClass("keywordflow"); + codifyLines(yytext); + endFontClass(); + } <Body>"*"{B}*")" { // end of cast? g_code->codify(yytext); g_theCallContext.popScope(); @@ -2971,6 +3002,17 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_code->codify(yytext); endFontClass(); } +<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) { + if (g_currentMemberDef && g_currentMemberDef->isFunction()) + { + g_currentMemberDef->addFlowKeyWord(); + } + addParmType(); + g_parmName=yytext; + startFontClass("keywordflow"); + g_code->codify(yytext); + endFontClass(); + } <MemberCall2,FuncCall>{ID}(({B}*"<"[^\n\[\](){}<>]*">")?({B}*"::"{B}*{ID})?)* { addParmType(); g_parmName=yytext; @@ -3156,7 +3198,6 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_insideBody=TRUE; } if (g_insideBody) g_bodyCurlyCount++; - g_curlyCount++; g_type.resize(0); g_name.resize(0); BEGIN( Body ); } @@ -3211,7 +3252,6 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } <SkipInits>"{" { g_code->codify(yytext); - g_curlyCount++; if (g_searchingForBody) { g_searchingForBody=FALSE; |