diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bufstr.h | 90 | ||||
-rw-r--r-- | src/commentcnv.l | 4 | ||||
-rw-r--r-- | src/config.l | 2 | ||||
-rw-r--r-- | src/docparser.cpp | 119 | ||||
-rw-r--r-- | src/docparser.h | 6 | ||||
-rw-r--r-- | src/doctokenizer.l | 2 | ||||
-rw-r--r-- | src/doxygen.cpp | 8 | ||||
-rw-r--r-- | src/doxygen.h | 4 | ||||
-rw-r--r-- | src/index.cpp | 13 | ||||
-rw-r--r-- | src/memberdef.cpp | 27 | ||||
-rw-r--r-- | src/memberdef.h | 48 | ||||
-rw-r--r-- | src/outputlist.cpp | 6 | ||||
-rw-r--r-- | src/outputlist.h | 2 | ||||
-rw-r--r-- | src/scanner.l | 56 | ||||
-rw-r--r-- | src/util.cpp | 15 |
15 files changed, 252 insertions, 150 deletions
diff --git a/src/bufstr.h b/src/bufstr.h index 2426fac..ec372b9 100644 --- a/src/bufstr.h +++ b/src/bufstr.h @@ -19,56 +19,84 @@ #define _BUFSTR_H #include "qtbc.h" +#include <stdio.h> +#include <stdlib.h> -/*! String that can deal more efficiently with large large numbers - * of resizing. +/*! @brief Buffer used to store strings + * + * This buffer is used append characters and strings. It will automatically + * resize itself, yet provide efficient random access to the content. */ -class BufStr : public QCString +class BufStr { public: - BufStr(int size) : QCString(size), offset(0), spareRoom(10240) {} + BufStr(int size) + : m_size(size), m_writeOffset(0), m_spareRoom(10240), m_buf(0) + { + m_buf = (char *)malloc(size); + } + ~BufStr() + { + free(m_buf); + } void addChar(char c) { - if (offset>=size()) - { - QCString::resize(size()+spareRoom); - } - QCString::data()[offset++]=c; + makeRoomFor(1); + m_buf[m_writeOffset++]=c; } void addArray(const char *a,int len) { - if (offset+len>=size()) - { - QCString::resize(size()+len+spareRoom); - } - memcpy(QCString::data()+offset,a,len); - offset+=len; + makeRoomFor(len); + memcpy(m_buf+m_writeOffset,a,len); + m_writeOffset+=len; } - uint curPos() { return offset; } void skip(uint s) { - if (offset+s>=size()) - { - QCString::resize(size()+s+spareRoom); - } - offset+=s; + makeRoomFor(s); + m_writeOffset+=s; } void resize( uint newlen ) { - //QCString::resize(newlen); - //if (offset>newlen) - //{ - // offset=newlen; - //} - offset=newlen; - if (offset>=size()) + m_size=newlen; + if (m_writeOffset>=m_size) // offset out of range -> enlarge { - QCString::resize(size()+spareRoom); + m_size=m_writeOffset+m_spareRoom; } + m_buf = (char *)realloc(m_buf,m_size); + } + char *data() const + { + return m_buf; + } + char &at(uint i) const + { + return m_buf[i]; + } + bool isEmpty() const + { + return m_writeOffset==0; + } + operator const char *() const + { + return m_buf; + } + uint curPos() const + { + return m_writeOffset; } private: - uint offset; - const int spareRoom; // 10Kb extra room to avoid frequent resizing + void makeRoomFor(uint size) + { + if (m_writeOffset+size>=m_size) + { + resize(m_size+size+m_spareRoom); + } + } + uint m_size; + uint m_writeOffset; + const int m_spareRoom; // 10Kb extra room to avoid frequent resizing + char *m_buf; }; + #endif diff --git a/src/commentcnv.l b/src/commentcnv.l index d7d04a7..dc152a1 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -188,6 +188,7 @@ static QCString handleCondCmdInAliases(const QCString &s) } else // get argument { + ep=sp; while ((c=*arg) && isId(c)) arg++,ep++; if (ep>sp) { @@ -195,6 +196,9 @@ static QCString handleCondCmdInAliases(const QCString &s) //printf("Found conditional section id %s\n",id.data()); startCondSection(id); } + else // invalid identifier + { + } } p=ep; } diff --git a/src/config.l b/src/config.l index bd0210f..60060e5 100644 --- a/src/config.l +++ b/src/config.l @@ -2850,12 +2850,12 @@ static QCString configFileToString(const char *name) int fsize=f.size(); QCString contents(fsize+2); f.readBlock(contents.data(),fsize); + f.close(); if (fsize==0 || contents[fsize-1]=='\n') contents[fsize]='\0'; else contents[fsize]='\n'; // to help the scanner contents[fsize+1]='\0'; - f.close(); return contents; } } diff --git a/src/docparser.cpp b/src/docparser.cpp index c50b66e..bd25e0e 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -338,31 +338,40 @@ static void checkUndocumentedParams() } /*! Check if a member has documentation for its parameter and or return - * type, if applicable. + * type, if applicable. If found this will be stored in the member, this + * is needed as a member can have brief and detailed documentation, while + * only one of these needs to document the parameters. */ -static void checkNoDocumentedParams() +static void detectNoDocumentedParams() { if (g_memberDef && Config_getBool("WARN_NO_PARAMDOC")) { - ArgumentList *al= g_memberDef->argumentList(); + ArgumentList *al = g_memberDef->argumentList(); ArgumentList *declAl = g_memberDef->declArgumentList(); - QString returnType = g_memberDef->typeString(); - if (!g_hasParamCommand && // no @param command - al && // but the member has a parameter list - al->count()>0 // with at least one parameter (that is not void) - ) + QString returnType = g_memberDef->typeString(); + if (!g_memberDef->hasDocumentedParams() && + g_hasParamCommand) + { + g_memberDef->setHasDocumentedParams(TRUE); + } + else if (!g_memberDef->hasDocumentedParams()) { - ArgumentListIterator ali(*al); - Argument *a; bool allDoc=TRUE; - for (ali.toFirst();(a=ali.current()) && allDoc;++ali) - { - allDoc = !a->docs.isEmpty(); - printf("a->name=%s doc=%s\n",a->name.data(),a->docs.data()); - } - if (!allDoc) + if ( // member has parameters + al && // but the member has a parameter list + al->count()>0 // with at least one parameter (that is not void) + ) { - if (declAl) // try declaration arguments as well + ArgumentListIterator ali(*al); + Argument *a; + + // see if all parameters have documentation + for (ali.toFirst();(a=ali.current()) && allDoc;++ali) + { + allDoc = !a->docs.isEmpty(); + //printf("a->name=%s doc=%s\n",a->name.data(),a->docs.data()); + } + if (!allDoc && declAl) // try declaration arguments as well { allDoc=TRUE; ArgumentListIterator ali(*declAl); @@ -370,32 +379,33 @@ static void checkNoDocumentedParams() for (ali.toFirst();(a=ali.current()) && allDoc;++ali) { allDoc = !a->docs.isEmpty(); - printf("a->name=%s doc=%s\n",a->name.data(),a->docs.data()); + //printf("a->name=%s doc=%s\n",a->name.data(),a->docs.data()); } } - if (!allDoc) - { - QString errMsg = - "Warning: the parameters of member "+ - QString(g_memberDef->qualifiedName())+ - QString(argListToString(al))+ - " are not documented."; - warn_doc_error(g_memberDef->docFile(),g_memberDef->docLine(),errMsg); - } } + if (allDoc) + { + g_memberDef->setHasDocumentedParams(TRUE); + } + } - if (!g_hasReturnCommand && // no @return or @retval commands - !returnType.isEmpty() && // non empty - returnType!="void" // end non void return type + //printf("Member %s hasReturnCommand=%d\n",g_memberDef->name().data(),g_hasReturnCommand); + if (!g_memberDef->hasDocumentedReturnType() && // docs not yet found + g_hasReturnCommand) + { + g_memberDef->setHasDocumentedReturnType(TRUE); + } + else if ( // see if return needs to documented + g_memberDef->hasDocumentedReturnType() || + returnType.isEmpty() || // empty return type + returnType.find("void")!=-1 || // void return type + !g_memberDef->isConstructor() || // a constructor + !g_memberDef->isDestructor() // or destructor ) { - QString errMsg = - "Warning: the return type or values of member "+ - QString(g_memberDef->qualifiedName())+ - QString(argListToString(al))+ - " are not documented."; - warn_doc_error(g_memberDef->docFile(),g_memberDef->docLine(),errMsg); + g_memberDef->setHasDocumentedReturnType(TRUE); } + } } @@ -4953,7 +4963,7 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, Definition *ctx,MemberDef *md, const char *input,bool indexWords, bool isExample, const char *exampleName, - bool singleLine,bool isParam) + bool singleLine, bool linkFromIndex) { //printf("validatingParseDoc(%s,%s)\n",ctx?ctx->name().data():"<none>", @@ -5052,7 +5062,8 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, } g_fileName = fileName; - g_relPath = ctx ? relativePathToRoot(ctx->getOutputFileBase()) : QString(""); + g_relPath = (!linkFromIndex && ctx) ? + relativePathToRoot(ctx->getOutputFileBase()) : QString(""); //printf("ctx->name=%s relPath=%s\n",ctx->name().data(),g_relPath.data()); g_memberDef = md; g_nodeStack.clear(); @@ -5086,11 +5097,8 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, delete v; } - if (!isParam) - { - checkUndocumentedParams(); - checkNoDocumentedParams(); - } + checkUndocumentedParams(); + detectNoDocumentedParams(); delete g_token; @@ -5106,7 +5114,6 @@ DocNode *validatingParseText(const char *input) { //printf("------------ input ---------\n%s\n" // "------------ end input -----\n",input); - g_token = new TokenInfo; g_context = ""; g_fileName = "<parseText>"; @@ -5128,19 +5135,23 @@ DocNode *validatingParseText(const char *input) g_paramsFound.clear(); g_searchUrl=""; - doctokenizerYYlineno=1; - doctokenizerYYinit(input,g_fileName); - - // build abstract syntax tree DocText *txt = new DocText; - txt->parse(); - if (Debug::isFlagSet(Debug::PrintTree)) + if (input) { - // pretty print the result - PrintDocVisitor *v = new PrintDocVisitor; - txt->accept(v); - delete v; + doctokenizerYYlineno=1; + doctokenizerYYinit(input,g_fileName); + + // build abstract syntax tree + txt->parse(); + + if (Debug::isFlagSet(Debug::PrintTree)) + { + // pretty print the result + PrintDocVisitor *v = new PrintDocVisitor; + txt->accept(v); + delete v; + } } delete g_token; diff --git a/src/docparser.h b/src/docparser.h index 1b4333b..241ea6d 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -53,7 +53,9 @@ void initDocParser(); * @param exampleName Base name of the example file (0 if isExample is FALSE). * @param singleLine Output should be presented on a single line, so without * starting a new paragraph at the end. - * @param isParam TRUE if the documentation is for a parameter. + * @param linkFromIndex TRUE if the documentation is generated from an + * index page. In this case context is not used to determine + * the relative path when making a link. * @returns Root node of the abstract syntax tree. Ownership of the * pointer is handed over to the caller. */ @@ -61,7 +63,7 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, Definition *context, MemberDef *md, const char *input,bool indexWords, bool isExample,const char *exampleName=0, - bool singleLine=FALSE,bool isParam=FALSE); + bool singleLine=FALSE,bool linkFromIndex=FALSE); /*! Main entry point for parsing simple text fragments. These * fragments are limited to words, whitespace and symbols. diff --git a/src/doctokenizer.l b/src/doctokenizer.l index dc02f64..449abc8 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -299,7 +299,7 @@ SCOPEKEYS ":"({ID}":")* SCOPECPP {SCOPEPRE}*(~)?{ID}("<"{TEMPCHAR}*">")? SCOPEOBJC {SCOPEPRE}?{ID}{SCOPEKEYS}? SCOPEMASK {SCOPECPP}|{SCOPEOBJC} -FUNCARG "("{FUNCCHAR}*")" +FUNCARG "("{FUNCCHAR}*")"({BLANK}*("volatile"|"const"))? OPNEW {BLANK}+"new"({BLANK}*"[]")? OPDEL {BLANK}+"delete"({BLANK}*"[]")? OPNORM {OPNEW}|{OPDEL}|"+"|"-"|"*"|"/"|"%"|"^"|"&"|"|"|"~"|"!"|"="|"<"|">"|"+="|"-="|"*="|"/="|"%="|"^="|"&="|"|="|"<<"|">>"|"<<="|">>="|"=="|"!="|"<="|">="|"&&"|"||"|"++"|"--"|","|"->*"|"->"|"[]"|"()" diff --git a/src/doxygen.cpp b/src/doxygen.cpp index f4735a8..60e1c09 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -213,7 +213,7 @@ static void addRelatedPage(Entry *root) { if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) break; } - //printf("addRelatedPage() %s gd=%p\n",root->name.data(),gd); + //printf("---> addRelatedPage() %s gd=%p\n",root->name.data(),gd); PageDef *pd = addRelatedPage(root->name,root->args,root->doc,root->anchors, root->fileName,root->startLine, root->sli, @@ -1724,7 +1724,7 @@ static MemberDef *addVariableToFile( */ static int findFunctionPtr(const QCString &type,int *pLength=0) { - static const QRegExp re("([^)]\\*"); + static const QRegExp re("([^)]*\\*"); int i=-1,l; if (!type.isEmpty() && // return type is non-empty (i=re.match(type,0,&l))!=-1 && // contains a (* @@ -1905,7 +1905,7 @@ static void buildVarList(Entry *root) { root->type=root->type.left(root->type.length()-1); root->args.prepend(")"); - printf("root->type=%s root->args=%s\n",root->type.data(),root->args.data()); + //printf("root->type=%s root->args=%s\n",root->type.data(),root->args.data()); } } } @@ -6769,7 +6769,7 @@ static void generatePageDocs() SectionInfo *si=0; if (!pd->title().isEmpty() && !pd->name().isEmpty() && - (si=Doxygen::sectionDict.find(pd->name()))!=0) + (si=Doxygen::sectionDict.find(pageName))!=0) { outputList->startSection(si->label,si->title,si->type); outputList->docify(si->title); diff --git a/src/doxygen.h b/src/doxygen.h index 0720dd5..9a16cc6 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -123,7 +123,7 @@ void readConfiguration(int argc, char **argv); void parseInput(); void generateOutput(); -#undef USE_TMP_FILE -//#define USE_TMP_FILE +//#undef USE_TMP_FILE +#define USE_TMP_FILE #endif diff --git a/src/index.cpp b/src/index.cpp index 53a8c48..0951cc8 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -885,7 +885,8 @@ void writeFileIndex(OutputList &ol) FALSE, // index words FALSE, // isExample 0, // example name - TRUE // single line + TRUE, // single line + TRUE // link from index ); //ol.docify(")"); } @@ -1011,7 +1012,10 @@ void writeNamespaceIndex(OutputList &ol) nd,0, abbreviate(nd->briefDescription(),nd->displayName()), FALSE, // index words - FALSE // isExample + FALSE, // isExample + 0, // example name + TRUE, // single line + TRUE // link from index ); //ol.docify(")"); } @@ -1131,7 +1135,10 @@ void writeAnnotatedClassList(OutputList &ol) cd,0, abbreviate(cd->briefDescription(),cd->displayName()), FALSE, // indexWords - FALSE // isExample + FALSE, // isExample + 0, // example name + TRUE, // single line + TRUE // link from index ); } ol.endIndexValue(cd->getOutputFileBase(),hasBrief); diff --git a/src/memberdef.cpp b/src/memberdef.cpp index a2bb3d9..9c2ed72 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -423,6 +423,8 @@ MemberDef::MemberDef(const char *df,int dl, m_inbodyLine = -1; m_implOnly=FALSE; groupMember = 0; + m_hasDocumentedParams = FALSE; + m_hasDocumentedReturnType = FALSE; } /*! Destroys the member definition. */ @@ -1584,13 +1586,10 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ol.startDescTableData(); ol.parseDoc(docFile(),docLine(), getOuterScope()?getOuterScope():container, - this, + this, // memberDef a->docs+"\n", // docStr TRUE, // indexWords - FALSE, // isExample - 0, // exampleName - FALSE, // singleLine - TRUE // isParam + FALSE // isExample ); ol.endDescTableData(); } @@ -1838,6 +1837,24 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, //if (Config_getBool("EXTRACT_ALL") && !hasDocs) ol.enable(OutputGenerator::Latex); ol.popGeneratorState(); + if (!Config_getBool("EXTRACT_ALL") && + Config_getBool("WARN_IF_UNDOCUMENTED") && + Config_getBool("WARN_NO_PARAMDOC")) + { + if (!hasDocumentedParams()) + { + warn_doc_error(docFile(),docLine(), + "Warning: parameters of member %s are not (all) documented", + qualifiedName().data()); + } + if (!hasDocumentedReturnType()) + { + warn_doc_error(docFile(),docLine(), + "Warning: return type of member %s is not documented", + qualifiedName().data()); + } + } + } void MemberDef::warnIfUndocumented() diff --git a/src/memberdef.h b/src/memberdef.h index 5456e98..2dfe5b7 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -71,11 +71,13 @@ class MemberDef : public Definition bool related,MemberType t,const ArgumentList *tal, const ArgumentList *al); ~MemberDef(); - DefType definitionType() { return TypeMember; } + DefType definitionType() { return TypeMember; } + // link id QCString getOutputFileBase() const; QCString getReference() const; QCString anchor() const; + const char *declaration() const { return decl; } const char *definition() const { return def; } const char *typeString() const { return type; } @@ -110,7 +112,7 @@ class MemberDef : public Definition Specifier virtualness() const; MemberType memberType() const { return mtype; } - // convenience methods + // getter methods bool isSignal() const { return mtype==Signal; } bool isSlot() const { return mtype==Slot; } bool isVariable() const { return mtype==Variable; } @@ -137,6 +139,8 @@ class MemberDef : public Definition bool isImplementation() const { return m_implOnly; } bool isExternal() const { return explExt; } bool isTemplateSpecialization() const { return tspec; } + bool hasDocumentedParams() const { return m_hasDocumentedParams; } + bool hasDocumentedReturnType() const { return m_hasDocumentedReturnType; } bool isObjCMethod() const; bool isConstructor() const; bool isDestructor() const; @@ -154,27 +158,29 @@ class MemberDef : public Definition bool isDocumentedFriendClass() const; // set functions - void setMemberType(MemberType t) { mtype=t; } - void setDefinition(const char *d) { def=d; } - void setFileDef(FileDef *fd) { fileDef=fd; } + void setMemberType(MemberType t) { mtype=t; } + void setDefinition(const char *d) { def=d; } + void setFileDef(FileDef *fd) { fileDef=fd; } void setAnchor(const char *a); - void setProtection(Protection p) { prot=p; } - void setMemberSpecifiers(int s) { memSpec=s; } - void mergeMemberSpecifiers(int s) { memSpec|=s; } + void setProtection(Protection p) { prot=p; } + void setMemberSpecifiers(int s) { memSpec=s; } + void mergeMemberSpecifiers(int s) { memSpec|=s; } void setInitializer(const char *i); - void setBitfields(const char *s) { bitfields = s; } - void setMaxInitLines(int lines) { userInitLines=lines; } + void setBitfields(const char *s) { bitfields = s; } + void setMaxInitLines(int lines) { userInitLines=lines; } void setMemberClass(ClassDef *cd); void setSectionList(Definition *d,MemberList *sl); void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, const QCString &fileName,int startLine,bool hasDocs, MemberDef *member=0); - void setExplicitExternal(bool b) { explExt=b; } - void setReadAccessor(const char *r) { read=r; } - void setWriteAccessor(const char *w) { write=w; } - void setTemplateSpecialization(bool b) { tspec=b; } + void setExplicitExternal(bool b) { explExt=b; } + void setReadAccessor(const char *r) { read=r; } + void setWriteAccessor(const char *w) { write=w; } + void setTemplateSpecialization(bool b) { tspec=b; } - void makeRelated() { related=TRUE; } + void makeRelated() { related=TRUE; } + void setHasDocumentedParams(bool b) { m_hasDocumentedParams = b; } + void setHasDocumentedReturnType(bool b) { m_hasDocumentedReturnType = b; } // output generatation void writeLink(OutputList &ol, @@ -330,18 +336,17 @@ class MemberDef : public Definition MemberDef *groupAlias; // Member containing the definition Specifier virt; // normal/virtual/pure virtual Protection prot; // protection type [Public/Protected/Private] - bool related; // is this a member that is only related to a class - bool stat; // is it a static function? - int memSpec; // The specifiers present for this member + int memSpec; // The specifiers present for this member MemberType mtype; // returns the kind of member + bool related; // is this a member that is only related to a class + bool stat; // is it a static function? bool proto; // is it a prototype; bool docEnumValues; // is an enum with documented enum values. bool annScope; // member is part of an annoymous scope bool annUsed; bool annShown; bool m_hasCallGraph; - //int indDepth; // indentation depth for this member if inside an annonymous scope - int maxInitLines; // when the initializer will be displayed + int maxInitLines; // when the initializer will be displayed int userInitLines; // result of explicit \hideinitializer or \showinitializer MemberList *section; // declation list containing this member MemberDef *annMemb; @@ -389,6 +394,9 @@ class MemberDef : public Definition // objective-c bool m_implOnly; // function found in implementation but not // in the interface + + bool m_hasDocumentedParams; + bool m_hasDocumentedReturnType; }; #endif diff --git a/src/outputlist.cpp b/src/outputlist.cpp index 83f9b29..917e5f6 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -133,7 +133,7 @@ void OutputList::parseDoc(const char *fileName,int startLine, Definition *ctx,MemberDef * md, const QCString &docStr,bool indexWords, bool isExample,const char *exampleName, - bool singleLine,bool isParam) + bool singleLine,bool linkFromIndex) { int count=0; if (docStr.isEmpty()) return; @@ -151,13 +151,13 @@ void OutputList::parseDoc(const char *fileName,int startLine, { root = validatingParseDoc(fileName,startLine, ctx,md,docStr,indexWords,isExample,exampleName, - singleLine,isParam); + singleLine,linkFromIndex); } else { root = validatingParseDoc(fileName,startLine, ctx,md,docStr+"\n",indexWords,isExample,exampleName, - singleLine,isParam); + singleLine,linkFromIndex); } og=outputs->first(); diff --git a/src/outputlist.h b/src/outputlist.h index 690e7da..78fc8cd 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -64,7 +64,7 @@ class OutputList : public OutputDocInterface void parseDoc(const char *fileName,int startLine, Definition *ctx,MemberDef *md,const QCString &docStr, bool indexWords,bool isExample,const char *exampleName=0, - bool singleLine=FALSE,bool isParam=FALSE); + bool singleLine=FALSE,bool linkFromIndex=FALSE); void parseText(const QCString &textStr); diff --git a/src/scanner.l b/src/scanner.l index a8f552e..e9b01b3 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -125,6 +125,7 @@ static QCString aliasName; static QCString baseName; static QCString* specName; static QCString formulaText; +static QCString formulaEnd; static bool useOverrideCommands = FALSE; static bool insideIDL = FALSE; //!< processing IDL code? static bool insideJava = FALSE; //!< processing Java code? @@ -160,7 +161,7 @@ static bool insideCode; static bool needsSemi; static int depthIf; -//static int initializerSharpCount; +static int initBracketCount; static QCString memberGroupRelates; static QCString memberGroupInside; static QCString xrefItemKey; @@ -2059,7 +2060,7 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] <FindMembers>"=" { current->bodyLine = yyLineNr; lastInitializerContext = YY_START; - //initializerSharpCount=0; + initBracketCount=0; BEGIN(ReadInitializer); } /* Read initializer rules */ @@ -2079,18 +2080,20 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] } <ReadInitializer>[;,] { //printf(">> initializer `%s' <<\n",current->initializer.data()); - //if (initializerSharpCount==0) - //{ if (*yytext==';' || lastInitializerContext==FindFields) { unput(*yytext); BEGIN(lastInitializerContext); } - //} - //else - //{ - // current->initializer+=*yytext; - //} + else if (*yytext==',' && initBracketCount==0) // for "int a=0,b=0" + { + unput(*yytext); + BEGIN(lastInitializerContext); + } + else + { + current->initializer+=*yytext; + } } <ReadInitializer>\" { if (insideIDL && insideCppQuote) @@ -2105,7 +2108,6 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] BEGIN(CopyString); } } - /* <ReadInitializer>"->" { current->initializer+=yytext; } @@ -2115,15 +2117,14 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] <ReadInitializer>">>" { current->initializer+=yytext; } -<ReadInitializer>\< { - initializerSharpCount++; +<ReadInitializer>[<\[{(] { + initBracketCount++; current->initializer+=*yytext; } -<ReadInitializer>\> { - initializerSharpCount--; +<ReadInitializer>[>\]})] { + initBracketCount--; current->initializer+=*yytext; } - */ <ReadInitializer>{CHARLIT} { if (insidePHP) { @@ -2373,7 +2374,7 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] } <FindFields>"=" { lastInitializerContext = YY_START; - //initializerSharpCount=0; + initBracketCount=0; BEGIN(ReadInitializer); } <FindFields>"," { @@ -2670,7 +2671,7 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] } <MemberSpec>"=" { lastInitializerContext=YY_START; - //initializerSharpCount=0; + initBracketCount=0; BEGIN(ReadInitializer); /* BEGIN(MemberSpecSkip); */ } @@ -3137,6 +3138,7 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] //current->args += *yytext; //BEGIN(FuncPtrInit); lastInitializerContext=YY_START; + initBracketCount=0; BEGIN(ReadInitializer); } <FuncPtrInit>[{;] { @@ -5002,6 +5004,14 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] insideFormula=TRUE; BEGIN(ReadFormulaLong); } +<Doc,JavaDoc,LineDoc,ClassDocBrief,PageDoc,ClassDoc,AfterDoc,AfterDocLine,AfterDocBrief,CopyArgComment,CopyArgCommentLine>{CMD}"f{"[^}\n]+"}" { + lastFormulaContext = YY_START; + formulaText="\\begin"; + formulaEnd=&yytext[2]; + formulaText+=formulaEnd; + insideFormula=TRUE; + BEGIN(ReadFormulaLong); + } <ReadFormulaShort>{CMD}"f$" { formulaText+="$"; if (lastFormulaContext==ClassDocBrief || @@ -5037,8 +5047,16 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] BEGIN(lastFormulaContext); } } -<ReadFormulaLong>{CMD}"f]" { - formulaText+="\\]"; +<ReadFormulaLong>{CMD}"f"[\}\]] { + if (yytext[2]==']') + { + formulaText+="\\]"; + } + else + { + formulaText+="\\end"; + formulaText+=formulaEnd; + } if (lastFormulaContext==ClassDocBrief || lastFormulaContext==LineDoc || lastFormulaContext==JavaDoc || diff --git a/src/util.cpp b/src/util.cpp index 52d2889..77983bc 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -452,6 +452,11 @@ QCString resolveTypeDef(Definition *context,const QCString &qualifiedName, if (scopeIndex!=-1) // strip scope part for the name { resName=qualifiedName.right(qualifiedName.length()-scopeIndex-2); + if (resName.isEmpty()) + { + // qualifiedName was of form A:: ! + return result; + } } MemberDef *md=0; while (mContext && md==0) @@ -2602,7 +2607,7 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,const Argument *a { QCString type = arg->type; QCString name = arg->name; - printf("extractCanonicalType(type=%s,name=%s)\n",type.data(),name.data()); + //printf("extractCanonicalType(type=%s,name=%s)\n",type.data(),name.data()); if ((type=="const" || type=="volatile") && !name.isEmpty()) { // name is part of type => correct type+=" "; @@ -2634,7 +2639,7 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,const Argument *a canType += type.mid(p,i-p); QCString word = type.mid(i,l); ClassDef *cd = getResolvedClass(d,fs,word); - printf("word %s => %s\n",word.data(),cd?cd->qualifiedName().data():"<none>"); + //printf("word %s => %s\n",word.data(),cd?cd->qualifiedName().data():"<none>"); if (cd) { canType+=cd->qualifiedName(); @@ -2654,7 +2659,7 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,const Argument *a p=i+l; } canType += type.right(type.length()-p); - printf("result = %s\n",canType.data()); + //printf("result = %s\n",canType.data()); return removeRedundantWhiteSpace(canType); } @@ -2961,7 +2966,8 @@ bool getDefs(const QCString &scName,const QCString &memberName, QCString mScope; if (memberName.left(9)!="operator " && // treat operator conversion methods // as a special case - (im=memberName.findRev("::"))!=-1 + (im=memberName.findRev("::"))!=-1 && + im<(int)memberName.length()-2 // not A:: ) { mScope=memberName.left(im); @@ -2973,6 +2979,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, //printf("mScope=`%s' mName=`%s'\n",mScope.data(),mName.data()); + if (mName.isEmpty()) printf("memberName=%s\n",memberName.data()); MemberName *mn = Doxygen::memberNameSDict[mName]; if (!forceEmptyScope && mn && !(scopeName.isEmpty() && mScope.isEmpty())) { |