diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2015-12-26 17:29:06 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2015-12-26 17:29:06 (GMT) |
commit | d1dc126c44b2e48e004a3f1477b63d4885764295 (patch) | |
tree | 51b6074b78ae94aa753b31b87b3f029dac3edf9d /src | |
parent | d5905871951cde51c6dcaa01d745de2f884ce9a9 (diff) | |
parent | 0a5dfb77a7d0dfaac2baf8f3e61014a29ba2883b (diff) | |
download | Doxygen-d1dc126c44b2e48e004a3f1477b63d4885764295.zip Doxygen-d1dc126c44b2e48e004a3f1477b63d4885764295.tar.gz Doxygen-d1dc126c44b2e48e004a3f1477b63d4885764295.tar.bz2 |
Merge pull request #430 from albert-github/feature/bug_735152
Bug 735152 - Python: Allow undocumented "cls" parameter for class methods
Diffstat (limited to 'src')
-rw-r--r-- | src/docparser.cpp | 12 | ||||
-rw-r--r-- | src/pycode.l | 8 | ||||
-rw-r--r-- | src/pyscanner.l | 20 |
3 files changed, 33 insertions, 7 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp index b706c9b..099213d 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -471,9 +471,9 @@ static void checkUndocumentedParams() if (lang==SrcLangExt_Fortran) argName = argName.lower(); argName=argName.stripWhiteSpace(); if (argName.right(3)=="...") argName=argName.left(argName.length()-3); - if (g_memberDef->getLanguage()==SrcLangExt_Python && argName=="self") + if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls")) { - // allow undocumented self parameter for Python + // allow undocumented self / cls parameter for Python } else if (!argName.isEmpty() && g_paramsFound.find(argName)==0 && a->docs.isEmpty()) { @@ -494,9 +494,9 @@ static void checkUndocumentedParams() QCString argName = g_memberDef->isDefine() ? a->type : a->name; if (lang==SrcLangExt_Fortran) argName = argName.lower(); argName=argName.stripWhiteSpace(); - if (g_memberDef->getLanguage()==SrcLangExt_Python && argName=="self") + if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls")) { - // allow undocumented self parameter for Python + // allow undocumented self / cls parameter for Python } else if (!argName.isEmpty() && g_paramsFound.find(argName)==0) { @@ -554,7 +554,7 @@ static void detectNoDocumentedParams() for (ali.toFirst();(a=ali.current()) && allDoc;++ali) { if (!a->name.isEmpty() && a->type!="void" && - !(isPython && a->name=="self") + !(isPython && (a->name=="self" || a->name=="cls")) ) { allDoc = !a->docs.isEmpty(); @@ -570,7 +570,7 @@ static void detectNoDocumentedParams() for (ali.toFirst();(a=ali.current()) && allDoc;++ali) { if (!a->name.isEmpty() && a->type!="void" && - !(isPython && a->name=="self") + !(isPython && (a->name=="self" || a->name=="cls")) ) { allDoc = !a->docs.isEmpty(); diff --git a/src/pycode.l b/src/pycode.l index c3219d9..3edbcc3 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -989,6 +989,14 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT codify("self."); findMemberLink(*g_code,&yytext[5]); } + "cls."{IDENTIFIER}/"(" { + codify("cls."); + findMemberLink(*g_code,&yytext[4]); + } + "cls."{IDENTIFIER} { + codify("cls."); + findMemberLink(*g_code,&yytext[4]); + } } <ClassDec>{IDENTIFIER} { diff --git a/src/pyscanner.l b/src/pyscanner.l index 1ccb943..c73e7dc 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -745,7 +745,7 @@ STARTDOCSYMS "##" <SearchMemVars>{ "self."{IDENTIFIER}/{B}"=" { - DBG_CTX((stderr,"Found member variable %s in %s at %d\n",&yytext[5],current_root->name.data(),yyLineNr)); + DBG_CTX((stderr,"Found instance method variable %s in %s at %d\n",&yytext[5],current_root->name.data(),yyLineNr)); current->name=&yytext[5]; current->section=Entry::VARIABLE_SEC; current->fileName = yyFileName; @@ -762,6 +762,24 @@ STARTDOCSYMS "##" } newEntry(); } + "cls."{IDENTIFIER}/{B}"=" { + DBG_CTX((stderr,"Found class method variable %s in %s at %d\n",&yytext[4],current_root->name.data(),yyLineNr)); + current->name=&yytext[4]; + current->section=Entry::VARIABLE_SEC; + current->fileName = yyFileName; + current->startLine = yyLineNr; + current->bodyLine = yyLineNr; + current->type.resize(0); + if (current->name.at(0)=='_') // mark as private + { + current->protection=Private; + } + else + { + current->protection=Public; + } + newEntry(); + } {TRIDOUBLEQUOTE} { // start of a comment block initTriDoubleQuoteBlock(); BEGIN(TripleComment); |