summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.xml1
-rw-r--r--src/docparser.cpp12
-rw-r--r--src/docparser.h14
-rw-r--r--src/htmldocvisitor.cpp55
-rw-r--r--src/pycode.l8
-rw-r--r--src/pyscanner.l20
-rwxr-xr-xsrc/util.cpp1
7 files changed, 93 insertions, 18 deletions
diff --git a/src/config.xml b/src/config.xml
index b89d9d7..0aa8fda 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -1325,6 +1325,7 @@ FILE_VERSION_INFO = "cleartool desc -fmt \%Vn"
<value name='*.mm'/>
<value name='*.dox'/>
<value name='*.py'/>
+ <value name='*.pyw'/>
<value name='*.f90'/>
<value name='*.f'/>
<value name='*.for'/>
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/docparser.h b/src/docparser.h
index 5af5e96..e2751d8 100644
--- a/src/docparser.h
+++ b/src/docparser.h
@@ -309,10 +309,18 @@ class DocCite : public DocNode
class DocStyleChange : public DocNode
{
public:
- enum Style { Bold, Italic, Code, Center, Small,
- Subscript, Superscript, Preformatted,
- Span, Div
+ enum Style { Bold = (1<<0),
+ Italic = (1<<1),
+ Code = (1<<2),
+ Center = (1<<3),
+ Small = (1<<4),
+ Subscript = (1<<5),
+ Superscript = (1<<6),
+ Preformatted = (1<<7),
+ Span = (1<<8),
+ Div = (1<<9)
};
+
DocStyleChange(DocNode *parent,uint position,Style s,bool enable,
const HtmlAttribList *attribs=0) :
m_position(position), m_style(s), m_enable(enable)
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index d1e4ffb..0533f87 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -42,7 +42,7 @@ static const char types[][NUM_HTML_LIST_TYPES] = {"1", "a", "i", "A"};
static QCString convertIndexWordToAnchor(const QString &word)
{
static char hex[] = "0123456789abcdef";
- QCString result;
+ QCString result="a";
const char *str = word.data();
unsigned char c;
if (str)
@@ -54,8 +54,7 @@ static QCString convertIndexWordToAnchor(const QString &word)
(c >= '0' && c <= '9') || // DIGIT
c == '-' ||
c == '.' ||
- c == '_' ||
- c == '~'
+ c == '_'
)
{
result += c;
@@ -63,7 +62,7 @@ static QCString convertIndexWordToAnchor(const QString &word)
else
{
char enc[4];
- enc[0] = '%';
+ enc[0] = ':';
enc[1] = hex[(c & 0xf0) >> 4];
enc[2] = hex[c & 0xf];
enc[3] = 0;
@@ -2044,6 +2043,42 @@ void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName,
}
}
+/** Returns TRUE if the child nodes in paragraph \a para until \a nodeIndex
+ contain a style change node that is still active and that style change is one that
+ must be located outside of a paragraph, i.e. it is a center, div, or pre tag.
+ See also bug746162.
+ */
+static bool insideStyleChangeThatIsOutsideParagraph(DocPara *para,int nodeIndex)
+{
+ //printf("insideStyleChangeThatIsOutputParagraph(index=%d)\n",nodeIndex);
+ int styleMask=0;
+ bool styleOutsideParagraph=FALSE;
+ while (nodeIndex>=0 && !styleOutsideParagraph)
+ {
+ DocNode *n = para->children().at(nodeIndex);
+ if (n->kind()==DocNode::Kind_StyleChange)
+ {
+ DocStyleChange *sc = (DocStyleChange*)n;
+ if (!sc->enable()) // remember styles that has been closed already
+ {
+ styleMask|=(int)sc->style();
+ }
+ bool paraStyle = sc->style()==DocStyleChange::Center ||
+ sc->style()==DocStyleChange::Div ||
+ sc->style()==DocStyleChange::Preformatted;
+ //printf("Found style change %s enabled=%d\n",sc->styleString(),sc->enable());
+ if (sc->enable() && (styleMask&(int)sc->style())==0 && // style change that is still active
+ paraStyle
+ )
+ {
+ styleOutsideParagraph=TRUE;
+ }
+ }
+ nodeIndex--;
+ }
+ return styleOutsideParagraph;
+}
+
/** Used for items found inside a paragraph, which due to XHTML restrictions
* have to be outside of the paragraph. This method will forcefully end
* the current paragraph and forceStartParagraph() will restart it.
@@ -2057,7 +2092,7 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n)
int nodeIndex = para->children().findRef(n);
nodeIndex--;
if (nodeIndex<0) return; // first node
- while (nodeIndex>=0 &&
+ while (nodeIndex>=0 &&
para->children().at(nodeIndex)->kind()==DocNode::Kind_WhiteSpace
)
{
@@ -2069,12 +2104,14 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n)
//printf("n=%p kind=%d outside=%d\n",n,n->kind(),mustBeOutsideParagraph(n));
if (mustBeOutsideParagraph(n)) return;
}
-
+ nodeIndex--;
+ bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,nodeIndex);
bool isFirst;
bool isLast;
getParagraphContext(para,isFirst,isLast);
- //printf("forceEnd first=%d last=%d\n",isFirst,isLast);
+ //printf("forceEnd first=%d last=%d styleOutsideParagraph=%d\n",isFirst,isLast,styleOutsideParagraph);
if (isFirst && isLast) return;
+ if (styleOutsideParagraph) return;
m_t << "</p>";
}
@@ -2092,9 +2129,11 @@ void HtmlDocVisitor::forceStartParagraph(DocNode *n)
DocPara *para = (DocPara*)n->parent();
int nodeIndex = para->children().findRef(n);
int numNodes = para->children().count();
+ bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,nodeIndex);
+ if (styleOutsideParagraph) return;
nodeIndex++;
if (nodeIndex==numNodes) return; // last node
- while (nodeIndex<numNodes &&
+ while (nodeIndex<numNodes &&
para->children().at(nodeIndex)->kind()==DocNode::Kind_WhiteSpace
)
{
diff --git a/src/pycode.l b/src/pycode.l
index bdbb9db..0ba7453 100644
--- a/src/pycode.l
+++ b/src/pycode.l
@@ -1015,6 +1015,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);
diff --git a/src/util.cpp b/src/util.cpp
index a560f18..84e9126 100755
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -7040,6 +7040,7 @@ void initDefaultExtensionMapping()
updateLanguageMapping(".M", "objective-c");
updateLanguageMapping(".mm", "objective-c");
updateLanguageMapping(".py", "python");
+ updateLanguageMapping(".pyw", "python");
updateLanguageMapping(".f", "fortran");
updateLanguageMapping(".for", "fortran");
updateLanguageMapping(".f90", "fortran");