diff options
-rw-r--r-- | src/declinfo.h | 3 | ||||
-rw-r--r-- | src/declinfo.l | 17 | ||||
-rw-r--r-- | src/docbookvisitor.cpp | 7 | ||||
-rw-r--r-- | src/docparser.cpp | 18 | ||||
-rw-r--r-- | src/docparser.h | 16 | ||||
-rw-r--r-- | src/doctokenizer.l | 2 | ||||
-rw-r--r-- | src/doxygen.cpp | 2 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 6 | ||||
-rw-r--r-- | src/latexdocvisitor.cpp | 6 | ||||
-rw-r--r-- | src/printdocvisitor.h | 22 | ||||
-rw-r--r-- | src/rtfdocvisitor.cpp | 6 | ||||
-rw-r--r-- | src/xmldocvisitor.cpp | 9 |
12 files changed, 85 insertions, 29 deletions
diff --git a/src/declinfo.h b/src/declinfo.h index d226c7d..2039dca 100644 --- a/src/declinfo.h +++ b/src/declinfo.h @@ -20,9 +20,10 @@ #include <stdio.h> #include <qcstring.h> +#include "types.h" extern void parseFuncDecl(const QCString &decl, - bool objC, + const SrcLangExt lang, QCString &clName, QCString &type, QCString &name, diff --git a/src/declinfo.l b/src/declinfo.l index d7f8743..83f7268 100644 --- a/src/declinfo.l +++ b/src/declinfo.l @@ -34,6 +34,7 @@ #include "declinfo.h" #include "util.h" #include "message.h" +#include "types.h" #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 @@ -59,6 +60,7 @@ struct declinfoYY_state bool funcTempListFound; QCString exceptionString; bool insideObjC; + bool insidePHP; }; static void addType(yyscan_t yyscanner); @@ -100,13 +102,21 @@ ID "$"?([a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+) yyextra->name += yytext; } } +<Start>([~!]{B}*)?{ID}{B}*"["{B}*"]" { // PHP + if (!yyextra->insidePHP) + { + REJECT; + } + addTypeName(yyscanner); + yyextra->name += removeRedundantWhiteSpace(yytext); + } <Start>([~!]{B}*)?{ID}/({B}*"["{B}*"]")* { // the []'s are for Java, // the / was add to deal with multi- // dimensional C++ arrays like A[][15] // the leading ~ is for a destructor // the leading ! is for a C++/CLI finalizer (see bug 456475 and 635198) addTypeName(yyscanner); - yyextra->name += yytext; + yyextra->name += removeRedundantWhiteSpace(yytext); } <Start>{B}*"::"{B}* { // found a yyextra->scope specifier if (!yyextra->scope.isEmpty()) @@ -240,7 +250,7 @@ static int yyread(char *buf,int max_size, yyscan_t yyscanner) static yyscan_t g_yyscanner; static struct declinfoYY_state g_declinfo_extra; -void parseFuncDecl(const QCString &decl,bool objC,QCString &cl,QCString &t, +void parseFuncDecl(const QCString &decl,const SrcLangExt lang,QCString &cl,QCString &t, QCString &n,QCString &a,QCString &ftl,QCString &exc) { if (decl.isEmpty()) @@ -260,7 +270,8 @@ void parseFuncDecl(const QCString &decl,bool objC,QCString &cl,QCString &t, yyextra->inputPosition = 0; yyextra->classTempListFound = FALSE; yyextra->funcTempListFound = FALSE; - yyextra->insideObjC = objC; + yyextra->insideObjC = lang==SrcLangExt_ObjC; + yyextra->insidePHP = lang==SrcLangExt_PHP; yyextra->scope.resize(0); yyextra->className.resize(0); yyextra->classTempList.resize(0); diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 24fb43f..a42a895 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -1433,11 +1433,9 @@ DB_VIS_C { QListIterator<DocNode> li(pl->paramTypes()); DocNode *type; - bool first=TRUE; m_t << " <entry>"; for (li.toFirst();(type=li.current());++li) { - if (!first) m_t << " | "; else first=FALSE; if (type->kind()==DocNode::Kind_Word) { visit((DocWord*)type); @@ -1446,6 +1444,11 @@ DB_VIS_C { visit((DocLinkedWord*)type); } + else if (type->kind()==DocNode::Kind_Sep) + { + m_t << " " << ((DocSeparator *)type)->chars() << " "; + } + } m_t << " </entry>"; } diff --git a/src/docparser.cpp b/src/docparser.cpp index a18237e..f09a1ee 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1165,17 +1165,25 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor static void handleParameterType(DocNode *parent,QList<DocNode> &children,const QCString ¶mTypes) { - QCString name = g_token->name; - int p=0,i; + QCString name = g_token->name; // save token name + QCString name1; + int p=0,i,l,ii; while ((i=paramTypes.find('|',p))!=-1) { - g_token->name = paramTypes.mid(p,i-p); + name1 = paramTypes.mid(p,i-p); + ii=name1.find('['); + g_token->name=ii!=-1 ? name1.mid(0,ii) : name1; // take part without [] handleLinkedWord(parent,children); + if (ii!=-1) children.append(new DocWord(parent,name1.mid(ii))); // add [] part p=i+1; + children.append(new DocSeparator(parent,"|")); } - g_token->name = paramTypes.mid(p); + name1 = paramTypes.mid(p); + ii=name1.find('['); + g_token->name=ii!=-1 ? name1.mid(0,ii) : name1; handleLinkedWord(parent,children); - g_token->name = name; + if (ii!=-1) children.append(new DocWord(parent,name1.mid(ii))); + g_token->name = name; // restore original token name } static DocInternalRef *handleInternalRef(DocNode *parent) diff --git a/src/docparser.h b/src/docparser.h index 70d13f9..e608d8f 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -141,7 +141,8 @@ class DocNode Kind_VhdlFlow = 50, Kind_ParBlock = 51, Kind_DiaFile = 52, - Kind_Emoji = 53 + Kind_Emoji = 53, + Kind_Sep = 54 }; /*! Creates a new node */ DocNode() : m_parent(0), m_insidePre(FALSE) {} @@ -518,6 +519,19 @@ class DocWhiteSpace : public DocNode QCString m_chars; }; +/** Node representing a separator */ +class DocSeparator : public DocNode +{ + public: + DocSeparator(DocNode *parent,const QCString &chars) : + m_chars(chars) { m_parent = parent; } + Kind kind() const { return Kind_Sep; } + QCString chars() const { return m_chars; } + void accept(DocVisitor *v) { } + private: + QCString m_chars; +}; + /** Node representing a verbatim, unparsed text fragment */ class DocVerbatim : public DocNode { diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 15fedbe..97ab926 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -1151,7 +1151,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} g_token->name = g_token->name.left((int)yyleng-2); return TK_WORD; } -<St_Param>({PHPTYPE}{BLANK}*"|"{BLANK}*)*{PHPTYPE}{WS}+("&")?"$"{LABELID} { +<St_Param>({PHPTYPE}{BLANK}*("["{BLANK}*"]")*{BLANK}*"|"{BLANK}*)*{PHPTYPE}{BLANK}*("["{BLANK}*"]")*{WS}+("&")?"$"{LABELID} { QCString params = yytext; int j = params.find('&'); int i = params.find('$'); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 18936fa..960b420 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -5911,7 +5911,7 @@ static void findMember(Entry *root, else { // extract information from the declarations - parseFuncDecl(funcDecl,root->lang==SrcLangExt_ObjC,scopeName,funcType,funcName, + parseFuncDecl(funcDecl,root->lang,scopeName,funcType,funcName, funcArgs,funcTempList,exceptions ); } diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 5bcedd1..e228116 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -2036,10 +2036,8 @@ void HtmlDocVisitor::visitPre(DocParamList *pl) m_t << "<td class=\"paramtype\">"; QListIterator<DocNode> li(pl->paramTypes()); DocNode *type; - bool first=TRUE; for (li.toFirst();(type=li.current());++li) { - if (!first) m_t << " | "; else first=FALSE; if (type->kind()==DocNode::Kind_Word) { visit((DocWord*)type); @@ -2048,6 +2046,10 @@ void HtmlDocVisitor::visitPre(DocParamList *pl) { visit((DocLinkedWord*)type); } + else if (type->kind()==DocNode::Kind_Sep) + { + m_t << " " << ((DocSeparator *)type)->chars() << " "; + } } m_t << "</td>"; } diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 7706064..a9d2c64 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -1588,10 +1588,8 @@ void LatexDocVisitor::visitPre(DocParamList *pl) { QListIterator<DocNode> li(pl->paramTypes()); DocNode *type; - bool first=TRUE; for (li.toFirst();(type=li.current());++li) { - if (!first) m_t << " | "; else first=FALSE; if (type->kind()==DocNode::Kind_Word) { visit((DocWord*)type); @@ -1600,6 +1598,10 @@ void LatexDocVisitor::visitPre(DocParamList *pl) { visit((DocLinkedWord*)type); } + else if (type->kind()==DocNode::Kind_Sep) + { + m_t << " " << ((DocSeparator *)type)->chars() << " "; + } } if (useTable) m_t << " & "; } diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index 7fc7e3d..6b9bd75 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -622,16 +622,24 @@ class PrintDocVisitor : public DocVisitor //const char *s; DocNode *param; printf("<parameters>"); - for (sli.toFirst();(param=sli.current());++sli) + if (sli.count() > 0) { printf("<param>"); - if (param->kind()==DocNode::Kind_Word) + for (sli.toFirst();(param=sli.current());++sli) { - visit((DocWord*)param); - } - else if (param->kind()==DocNode::Kind_LinkedWord) - { - visit((DocLinkedWord*)param); + if (param->kind()==DocNode::Kind_Word) + { + visit((DocWord*)param); + } + else if (param->kind()==DocNode::Kind_LinkedWord) + { + visit((DocLinkedWord*)param); + } + else if (param->kind()==DocNode::Kind_Sep) + { + printf("</param>"); + printf("<param>"); + } } printf("</param>"); } diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 760769e..e4f33da 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -1495,10 +1495,8 @@ void RTFDocVisitor::visitPre(DocParamList *pl) } QListIterator<DocNode> li(pl->paramTypes()); DocNode *type; - bool first=TRUE; for (li.toFirst();(type=li.current());++li) { - if (!first) m_t << " | "; else first=FALSE; if (type->kind()==DocNode::Kind_Word) { visit((DocWord*)type); @@ -1507,6 +1505,10 @@ void RTFDocVisitor::visitPre(DocParamList *pl) { visit((DocLinkedWord*)type); } + else if (type->kind()==DocNode::Kind_Sep) + { + m_t << " " << ((DocSeparator *)type)->chars() << " "; + } } if (useTable) { diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index af6ed75..0344642 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -998,9 +998,9 @@ void XmlDocVisitor::visitPre(DocParamList *pl) { QListIterator<DocNode> li(pl->paramTypes()); DocNode *type; + m_t << "<parametertype>"; for (li.toFirst();(type=li.current());++li) { - m_t << "<parametertype>"; if (type->kind()==DocNode::Kind_Word) { visit((DocWord*)type); @@ -1009,8 +1009,13 @@ void XmlDocVisitor::visitPre(DocParamList *pl) { visit((DocLinkedWord*)type); } - m_t << "</parametertype>" << endl; + else if (type->kind()==DocNode::Kind_Sep) + { + m_t << "</parametertype>" << endl; + m_t << "<parametertype>"; + } } + m_t << "</parametertype>" << endl; } m_t << "<parametername"; if (pl->direction()!=DocParamSect::Unspecified) |