diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2003-11-21 13:10:40 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2003-11-21 13:10:40 (GMT) |
commit | 4d3dea2f08f3bed73db5c3b8dc3772e46decb479 (patch) | |
tree | b21e4aeb8cabee272c641732f0e77e90433030e3 /src | |
parent | 8a5c51f2c968dee1283dce092e1ccc0d3df91f0e (diff) | |
download | Doxygen-4d3dea2f08f3bed73db5c3b8dc3772e46decb479.zip Doxygen-4d3dea2f08f3bed73db5c3b8dc3772e46decb479.tar.gz Doxygen-4d3dea2f08f3bed73db5c3b8dc3772e46decb479.tar.bz2 |
Release-1.3.5
Diffstat (limited to 'src')
-rw-r--r-- | src/code.l | 36 | ||||
-rw-r--r-- | src/doxygen.cpp | 151 | ||||
-rw-r--r-- | src/latexgen.cpp | 3 | ||||
-rw-r--r-- | src/scanner.l | 52 | ||||
-rw-r--r-- | src/util.cpp | 37 |
5 files changed, 179 insertions, 100 deletions
@@ -53,7 +53,7 @@ static BaseCodeDocInterface * g_code; static ClassSDict g_codeClassSDict(17); -static ClassDef *g_curClassDef; +//static ClassDef *g_curClassDef; static QCString g_curClassName; static QStrList g_curClassBases; @@ -99,6 +99,7 @@ static int g_sharpCount = 0; static int g_lastSpecialCContext; static int g_lastStringContext; +static int g_lastVerbStringContext; static int g_memCallContext; static int g_lastCContext; @@ -733,7 +734,8 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, if (md==0) // not found as a typedef { md = setCallContextForVar(clName); - if (md && g_currentDefinition!=0 && !isAccessibleFrom(g_currentDefinition,g_sourceFileDef,md)==-1) + if (md && g_currentDefinition!=0 && + isAccessibleFrom(g_currentDefinition,g_sourceFileDef,md)==-1) { md=0; // variable not accessible } @@ -1084,6 +1086,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" %option noyywrap %x SkipString +%x SkipVerbString %x SkipCPP %x SkipComment %x SkipCxxComment @@ -1300,9 +1303,9 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" //printf("***** g_curClassName=%s\n",g_curClassName.data()); if (getResolvedClass(g_currentDefinition,g_sourceFileDef,g_curClassName)==0) { - g_curClassDef=new ClassDef("<code>",1, + ClassDef *ncd=new ClassDef("<code>",1, g_curClassName,ClassDef::Class); - g_codeClassSDict.append(g_curClassName,g_curClassDef); + g_codeClassSDict.append(g_curClassName,ncd); // insert base classes. char *s=g_curClassBases.first(); while (s) @@ -1312,7 +1315,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" if (bcd==0) bcd=getResolvedClass(g_currentDefinition,g_sourceFileDef,s); if (bcd) { - g_curClassDef->insertBaseClass(bcd,s,Public,Normal); + ncd->insertBaseClass(bcd,s,Public,Normal); } s=g_curClassBases.next(); } @@ -1497,6 +1500,23 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" <SkipString>\\. { g_code->codify(yytext); } +<SkipVerbString>[^"\n]+ { + g_code->codify(yytext); + } +<SkipVerbString>\"\" { // escaped quote + g_code->codify(yytext); + } +<SkipVerbString>\" { // end of string + g_code->codify(yytext); + endFontClass(); + BEGIN( g_lastVerbStringContext ); + } +<SkipVerbString>. { + g_code->codify(yytext); + } +<SkipVerbString>\n { + g_code->codify(yytext); + } <Body>":" { g_code->codify(yytext); g_name.resize(0);g_type.resize(0); @@ -2069,6 +2089,12 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" } BEGIN( SkipComment ) ; } +<*>@\" { // C# verbatim string + startFontClass("stringliteral"); + g_code->codify(yytext); + g_lastVerbStringContext=YY_START; + BEGIN(SkipVerbString); + } <*>"//" { startFontClass("comment"); g_code->codify(yytext); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 03db72d..6e0a6a4 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -2289,88 +2289,91 @@ static void buildFunctionList(Entry *root) //printf("combining function with prototype found=%d in namespace %s\n", // found,nsName.data()); - // merge argument lists - //mergeArguments(root->argList,md->argumentList()); - // merge documentation - if (md->documentation().isEmpty() && !root->doc.isEmpty()) + if (found) { - md->setDocumentation(root->doc,root->docFile,root->docLine); - md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); - md->setDocsForDefinition(!root->proto); - ArgumentList *argList = new ArgumentList; - stringToArgumentList(root->args,argList); - //printf("root->argList=%p\n",root->argList); - //if (root->argList) - //{ - // ArgumentListIterator ali1(*root->argList); - // ArgumentListIterator ali2(*argList); - // Argument *sa,*da; - // for (;(sa=ali1.current()) && (da=ali2.current());++ali1,++ali2) - // { - // printf("sa->name=%s (doc=%s) da->name=%s (doc=%s)\n", - // sa->name.data(),sa->docs.data(), - // da->name.data(),da->docs.data() - // ); - // if (!sa->docs.isEmpty() && da->docs.isEmpty()) - // { - // da->docs=sa->docs.copy(); - // } - // } - //} - if (root->proto) + // merge argument lists + //mergeArguments(root->argList,md->argumentList()); + // merge documentation + if (md->documentation().isEmpty() && !root->doc.isEmpty()) { - //printf("setDeclArgumentList to %p\n",argList); - md->setDeclArgumentList(argList); + md->setDocumentation(root->doc,root->docFile,root->docLine); + md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); + md->setDocsForDefinition(!root->proto); + ArgumentList *argList = new ArgumentList; + stringToArgumentList(root->args,argList); + //printf("root->argList=%p\n",root->argList); + //if (root->argList) + //{ + // ArgumentListIterator ali1(*root->argList); + // ArgumentListIterator ali2(*argList); + // Argument *sa,*da; + // for (;(sa=ali1.current()) && (da=ali2.current());++ali1,++ali2) + // { + // printf("sa->name=%s (doc=%s) da->name=%s (doc=%s)\n", + // sa->name.data(),sa->docs.data(), + // da->name.data(),da->docs.data() + // ); + // if (!sa->docs.isEmpty() && da->docs.isEmpty()) + // { + // da->docs=sa->docs.copy(); + // } + // } + //} + if (root->proto) + { + //printf("setDeclArgumentList to %p\n",argList); + md->setDeclArgumentList(argList); + } + else + { + md->setArgumentList(argList); + } } - else + else if (!md->documentation().isEmpty() && !root->doc.isEmpty() && nd==rnd) { - md->setArgumentList(argList); + warn(root->docFile,root->docLine,"Warning: member %s: ignoring the detailed description found here, since another one was found at line %d of file %s!",md->name().data(),md->docLine(),md->docFile().data()); } - } - else if (!md->documentation().isEmpty() && !root->doc.isEmpty()) - { - warn(root->docFile,root->docLine,"Warning: member %s: ignoring the detailed description found here, since another one was found at line %d of file %s!",md->name().data(),md->docLine(),md->docFile().data()); - } - if (md->briefDescription().isEmpty() && !root->brief.isEmpty()) - { - md->setBriefDescription(root->brief,root->briefFile,root->briefLine); - } - else if (!md->briefDescription().isEmpty() && !root->brief.isEmpty()) - { - warn(root->briefFile,root->briefLine,"Warning: member %s: ignoring the brief description found here, since another one was found at line %d of file %s!",md->name().data(),md->briefLine(),md->briefFile().data()); - } - - md->addSectionsToDefinition(root->anchors); + if (md->briefDescription().isEmpty() && !root->brief.isEmpty()) + { + md->setBriefDescription(root->brief,root->briefFile,root->briefLine); + } + else if (!md->briefDescription().isEmpty() && !root->brief.isEmpty() && nd==rnd) + { + warn(root->briefFile,root->briefLine,"Warning: member %s: ignoring the brief description found here, since another one was found at line %d of file %s!",md->name().data(),md->briefLine(),md->briefFile().data()); + } - md->enableCallGraph(md->hasCallGraph() || root->callGraph); + md->addSectionsToDefinition(root->anchors); - // merge ingroup specifiers - if (md->getGroupDef()==0 && root->groups->first()!=0) - { - //printf("new member is grouped, existing member not\n"); - // if we do addMemberToGroups here an undocumented declaration may prevent - // the documented implementation below it from being added - //addMemberToGroups(root,md); - //GroupDef *gd=Doxygen::groupSDict[root->groups->first()->groupname.data()]; - //if (gd) - //{ - // bool success = gd->insertMember(md); - // if (success) - // { - // md->setGroupDef(gd, root->groups->first()->pri, root->fileName, root->startLine, !root->doc.isEmpty()); - // } - //} - addMemberToGroups(root,md); - } - else if (md->getGroupDef()!=0 && root->groups->count()==0) - { - //printf("existing member is grouped, new member not\n"); - root->groups->append(new Grouping(md->getGroupDef()->name(), md->getGroupPri())); - } - else if (md->getGroupDef()!=0 && root->groups->first()!=0) - { - //printf("both members are grouped\n"); + md->enableCallGraph(md->hasCallGraph() || root->callGraph); + + // merge ingroup specifiers + if (md->getGroupDef()==0 && root->groups->first()!=0) + { + //printf("new member is grouped, existing member not\n"); + // if we do addMemberToGroups here an undocumented declaration may prevent + // the documented implementation below it from being added + //addMemberToGroups(root,md); + //GroupDef *gd=Doxygen::groupSDict[root->groups->first()->groupname.data()]; + //if (gd) + //{ + // bool success = gd->insertMember(md); + // if (success) + // { + // md->setGroupDef(gd, root->groups->first()->pri, root->fileName, root->startLine, !root->doc.isEmpty()); + // } + //} + addMemberToGroups(root,md); + } + else if (md->getGroupDef()!=0 && root->groups->count()==0) + { + //printf("existing member is grouped, new member not\n"); + root->groups->append(new Grouping(md->getGroupDef()->name(), md->getGroupPri())); + } + else if (md->getGroupDef()!=0 && root->groups->first()!=0) + { + //printf("both members are grouped\n"); + } } } } diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 273dd74..b80fea0 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -248,7 +248,8 @@ static void writeDefaultHeaderPart1(QTextStream &t) "\\usepackage{float}\n" "\\usepackage{textcomp}\n" "\\usepackage{alltt}\n" - "\\usepackage{ae,aecompl,aeguill}\n"; + //"\\usepackage{ae,aecompl,aeguill}\n" + ; if (Config_getBool("PDF_HYPERLINKS")) { t << "\\usepackage{times}" << endl; diff --git a/src/scanner.l b/src/scanner.l index 98a568a..e4f12a4 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -79,6 +79,7 @@ static int lastSkipHtmlCommentContext; static int lastIfContext; static int lastInternalDocContext; static int lastPreLineCtrlContext; +static int lastSkipVerbStringContext;; static int nextDefContext; static int overloadContext; static Protection protection; @@ -143,6 +144,7 @@ static QCString *pCopyRoundString; static QCString *pCopyCurlyString; static QCString *pCopyQuotedString; static QCString *pSkipDoc; +static QCString *pSkipVerbString; static QStack<Grouping> autoGroupStack; static Grouping lastDefGroup( "", Grouping::GROUPING_LOWEST ); @@ -719,6 +721,7 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] %x DefinePHP %x DefinePHPEnd %x OldStyleArgs +%x SkipVerbString %% @@ -1769,6 +1772,31 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] current->initializer+=*yytext; yyLineNr++; } +<ReadInitializer>"@\"" { + current->initializer+=yytext; + if (!insideCS) REJECT; + // C# verbatim string + lastSkipVerbStringContext=YY_START; + pSkipVerbString=¤t->initializer; + BEGIN(SkipVerbString); + } +<SkipVerbString>[^\n"]+ { + *pSkipVerbString+=yytext; + } +<SkipVerbString>"\"\"" { // quote escape + *pSkipVerbString+=yytext; + } +<SkipVerbString>"\"" { + *pSkipVerbString+=*yytext; + BEGIN(lastSkipVerbStringContext); + } +<SkipVerbString>\n { + *pSkipVerbString+=*yytext; + yyLineNr++; + } +<SkipVerbString>. { + *pSkipVerbString+=*yytext; + } <ReadInitializer>. { current->initializer+=*yytext; } @@ -1991,13 +2019,18 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] /* <FindFieldArg>"," { unput(*yytext); BEGIN(FindFields); } */ -<ReadBody,ReadNSBody>[^\r\n\#{}"'/]* { current->program += yytext ; } +<ReadBody,ReadNSBody>[^\r\n\#{}"@'/]* { current->program += yytext ; } <ReadBody,ReadNSBody>"//".* { current->program += yytext ; } <ReadBody,ReadNSBody>"#".* { if (! insidePHP) REJECT; current->program += yytext ; } -<ReadBody,ReadNSBody>\" { current->program += yytext ; +<ReadBody,ReadNSBody>@\" { current->program += yytext ; + pSkipVerbString = ¤t->program; + lastSkipVerbStringContext=YY_START; + BEGIN( SkipVerbString ); + } +<ReadBody,ReadNSBody>\" { current->program += yytext ; pCopyQuotedString = ¤t->program; lastStringContext=YY_START; BEGIN( CopyString ); @@ -2011,8 +2044,8 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] lastContext = ReadBody ; BEGIN( Comment ) ; } -<ReadBody,ReadNSBody>{CHARLIT} { current->program += yytext; } -<ReadBody,ReadNSBody>"{" { current->program += yytext ; +<ReadBody,ReadNSBody>{CHARLIT} { current->program += yytext; } +<ReadBody,ReadNSBody>"{" { current->program += yytext ; ++curlyCount ; } <ReadBody,ReadNSBody>"}" { //err("ReadBody count=%d\n",curlyCount); @@ -2992,7 +3025,7 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] yyLineNr++; //addToBody(yytext); } -<SkipCurly,SkipCurlyCpp>[^\n"'\\/{}]+ { +<SkipCurly,SkipCurlyCpp>[^\n"'@\\/{}]+ { //addToBody(yytext); } <SkipCurlyCpp>\n { @@ -3033,6 +3066,13 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] lastCContext = YY_START; BEGIN(SkipCxxComment); } +<SkipInits,SkipCurly,SkipCurlyCpp>@\" { + if (! insideCS) REJECT; + // C# verbatim string + lastSkipVerbStringContext=YY_START; + pSkipVerbString=¤t->initializer; + BEGIN(SkipVerbString); + } <SkipInits,SkipCurly,SkipCurlyCpp>{CHARLIT} { } <SkipInits,SkipCurly,SkipCurlyCpp>. { @@ -3657,7 +3697,7 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] current->name = "mainpage"; BEGIN( PageDocArg2 ); } -<Doc,JavaDoc>{B}*{CMD}"file"{B}* { +<Doc,LineDoc,JavaDoc>{B}*{CMD}"file"{B}* { current->section = Entry::FILEDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; diff --git a/src/util.cpp b/src/util.cpp index 4a0e1ab..d268f8e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -565,6 +565,7 @@ int isAccessibleFrom(Definition *scope,FileDef *fileScope,Definition *item, */ ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md,QCString *pTemplSpec) { + //printf("newResolveTypedef(md=%p,cachedVal=%p)\n",md,md->getCachedTypedefVal()); bool isCached = md->isTypedefValCached(); // value already cached if (isCached) { @@ -606,7 +607,14 @@ ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md,QCString *pTemplSpe } // remember computed value for next time - md->cacheTypedefVal(result); + if (result && result->getDefFileName()!="<code>") + // this check is needed to prevent that temporary classes that are + // introduced while parsing code fragments are being cached here. + { + //printf("setting cached typedef %p in result %p\n",md,result); + //printf("==> %s (%s,%d)\n",result->name().data(),result->getDefFileName().data(),result->getDefLine()); + md->cacheTypedefVal(result); + } g_resolvedTypedefs.remove(qname); // remove from the trace list @@ -3542,10 +3550,10 @@ QCString stripScope(const char *name) } /*! Convert nibble (range 0..15) to hex char */ -static char nibbleToHex(int n) -{ - return (n < 10) ? ('0'+n) : ('a'+n-10); -} +//static char nibbleToHex(int n) +//{ +// return (n < 10) ? ('0'+n) : ('a'+n-10); +//} /*! Converts a string to an XML-encoded string */ QCString convertToXML(const char *s) @@ -3564,16 +3572,17 @@ QCString convertToXML(const char *s) case '\'': result+="'"; break; case '"': result+="""; break; default: - if (c<0) - { - result+=(QCString)"&#x" + - nibbleToHex((((uchar)c)>>4)&0xf)+ - nibbleToHex(c&0xf)+";"; - } - else - { + //if (c<0) + //{ <- this doesn't work for languages that use + // characters with codes beyond 255 + // result+=(QCString)"&#x" + + // nibbleToHex((((uchar)c)>>4)&0xf)+ + // nibbleToHex(c&0xf)+";"; + //} + //else + //{ result+=c; - } + //} break; } } |