diff options
-rw-r--r-- | src/code.h | 4 | ||||
-rw-r--r-- | src/code.l | 50 | ||||
-rw-r--r-- | src/dbusxmlscanner.cpp | 1 | ||||
-rw-r--r-- | src/dbusxmlscanner.h | 1 | ||||
-rw-r--r-- | src/definition.cpp | 1 | ||||
-rw-r--r-- | src/docbookgen.cpp | 2 | ||||
-rw-r--r-- | src/docbookvisitor.cpp | 10 | ||||
-rw-r--r-- | src/filedef.cpp | 2 | ||||
-rw-r--r-- | src/fortranscanner.h | 1 | ||||
-rw-r--r-- | src/fortranscanner.l | 1 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 8 | ||||
-rw-r--r-- | src/latexdocvisitor.cpp | 11 | ||||
-rw-r--r-- | src/mandocvisitor.cpp | 21 | ||||
-rw-r--r-- | src/markdown.cpp | 3 | ||||
-rw-r--r-- | src/markdown.h | 1 | ||||
-rw-r--r-- | src/memberdef.cpp | 2 | ||||
-rw-r--r-- | src/parserintf.h | 4 | ||||
-rw-r--r-- | src/pycode.h | 4 | ||||
-rw-r--r-- | src/pyscanner.h | 1 | ||||
-rw-r--r-- | src/pyscanner.l | 1 | ||||
-rw-r--r-- | src/rtfdocvisitor.cpp | 11 | ||||
-rw-r--r-- | src/scanner.h | 1 | ||||
-rw-r--r-- | src/scanner.l | 3 | ||||
-rw-r--r-- | src/tclscanner.h | 1 | ||||
-rw-r--r-- | src/tclscanner.l | 2 | ||||
-rw-r--r-- | src/util.cpp | 20 | ||||
-rw-r--r-- | src/vhdldocgen.cpp | 1 | ||||
-rw-r--r-- | src/vhdlscanner.h | 1 | ||||
-rw-r--r-- | src/vhdlscanner.l | 1 | ||||
-rw-r--r-- | src/xmldocvisitor.cpp | 10 | ||||
-rw-r--r-- | src/xmlgen.cpp | 2 |
31 files changed, 156 insertions, 26 deletions
@@ -18,6 +18,8 @@ #ifndef CODE_H #define CODE_H +#include "types.h" + class CodeOutputInterface; class FileDef; class MemberDef; @@ -25,7 +27,7 @@ class QCString; class Definition; void parseCCode(CodeOutputInterface &,const char *,const QCString &, - bool ,const char *,FileDef *fd, + SrcLangExt lang, bool isExample, const char *exName,FileDef *fd, int startLine,int endLine,bool inlineFragment, MemberDef *memberDef,bool showLineNumbers,Definition *searchCtx); void resetCCodeParserState(); @@ -112,6 +112,9 @@ static int g_memCallContext; static int g_lastCContext; static bool g_insideObjC; +static bool g_insideJava; +static bool g_insideCS; +static bool g_insidePHP; static bool g_insideProtocolList; static bool g_lexInit = FALSE; @@ -927,7 +930,14 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName { className+="-p"; } - className = substitute(className,"\\","::"); // for PHP namespaces + if (g_insidePHP) + { + className = substitute(className,"\\","::"); // for PHP namespaces + } + else if (g_insideCS || g_insideJava) + { + className = substitute(className,".","::"); // for PHP namespaces + } ClassDef *cd=0,*lcd=0; MemberDef *md=0; bool isLocal=FALSE; @@ -1747,8 +1757,10 @@ static int yyread(char *buf,int max_size) B [ \t] BN [ \t\n\r] ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* -SEP ("::"|"\\") +SEP ("::"|"\\") +SEPCS (".") SCOPENAME ({SEP}{BN}*)?({ID}{BN}*{SEP}{BN}*)*("~"{BN}*)?{ID} +SCOPENAMECS ({SEPCS}{BN}*)?({ID}{BN}*{SEPCS}{BN}*)*("~"{BN}*)?{ID} TEMPLIST "<"[^\"\}\{\(\)\/\n\>]*">" SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID}) SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+ @@ -2492,6 +2504,20 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" generateClassOrGlobalLink(*g_code,yytext); g_name+=yytext; } +<Body>{SCOPENAMECS}/{BN}*[;,)\]] { // "int var;" or "var, var2" or "debug(f) macro" + if (!g_insideCS && !g_insideJava) + { + REJECT; + } + else + { + addType(); + // changed this to generateFunctionLink, see bug 624514 + //generateClassOrGlobalLink(*g_code,yytext,FALSE,TRUE); + generateFunctionLink(*g_code,yytext); + g_name+=yytext; + } + } <Body>{SCOPENAME}/{BN}*[;,)\]] { // "int var;" or "var, var2" or "debug(f) macro" addType(); // changed this to generateFunctionLink, see bug 624514 @@ -2499,6 +2525,18 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" generateFunctionLink(*g_code,yytext); g_name+=yytext; } +<Body>{SCOPENAMECS}/{B}* { // p->func() + if (!g_insideCS && !g_insideJava) + { + REJECT; + } + else + { + addType(); + generateClassOrGlobalLink(*g_code,yytext); + g_name+=yytext; + } + } <Body>{SCOPENAME}/{B}* { // p->func() addType(); generateClassOrGlobalLink(*g_code,yytext); @@ -3514,7 +3552,7 @@ void resetCCodeParserState() } void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, - bool exBlock, const char *exName,FileDef *fd, + SrcLangExt lang,bool exBlock, const char *exName,FileDef *fd, int startLine,int endLine,bool inlineFragment, MemberDef *memberDef,bool showLineNumbers,Definition *searchCtx) { @@ -3562,11 +3600,13 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, g_sourceFileDef = new FileDef("",(exName?exName:"generated")); cleanupSourceDef = TRUE; } + g_insideObjC = lang==SrcLangExt_ObjC; + g_insideJava = lang==SrcLangExt_Java; + g_insideCS = lang==SrcLangExt_CSharp; + g_insidePHP = lang==SrcLangExt_PHP; if (g_sourceFileDef) { setCurrentDoc("l00001"); - g_insideObjC = g_sourceFileDef->name().lower().right(2)==".m" || - g_sourceFileDef->name().lower().right(3)==".mm"; } g_currentDefinition = 0; g_currentMemberDef = 0; diff --git a/src/dbusxmlscanner.cpp b/src/dbusxmlscanner.cpp index bfb5cd0..12168dd 100644 --- a/src/dbusxmlscanner.cpp +++ b/src/dbusxmlscanner.cpp @@ -861,6 +861,7 @@ bool DBusXMLScanner::needsPreprocessing(const QCString & /* extension */) void DBusXMLScanner::parseCode(CodeOutputInterface & /* codeOutIntf */, const char * /* scopeName */, const QCString & /* input */, + SrcLangExt /* lang */, bool /* isExampleBlock */, const char * /* exampleName */, FileDef * /* fileDef */, diff --git a/src/dbusxmlscanner.h b/src/dbusxmlscanner.h index a0ead5a..64ba1a7 100644 --- a/src/dbusxmlscanner.h +++ b/src/dbusxmlscanner.h @@ -42,6 +42,7 @@ public: void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, diff --git a/src/definition.cpp b/src/definition.cpp index fe1afb7..5cde4ce 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1044,6 +1044,7 @@ void Definition::writeInlineCode(OutputList &ol,const char *scopeName) pIntf->parseCode(ol, // codeOutIntf scopeName, // scope codeFragment, // input + m_impl->lang, // lang FALSE, // isExample 0, // exampleName m_impl->body->fileDef, // fileDef diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 3c81eda..09a78bd 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -370,11 +370,13 @@ static void writeDocbookDocBlock(FTextStream &t, void writeDocbookCodeBlock(FTextStream &t,FileDef *fd) { ParserInterface *pIntf=Doxygen::parserManager->getParser(fd->getDefFileExtension()); + SrcLangExt langExt = getLanguageFromFileName(fd->getDefFileExtension()); pIntf->resetCodeParserState(); DocbookCodeGenerator *docbookGen = new DocbookCodeGenerator(t); pIntf->parseCode(*docbookGen, // codeOutIntf 0, // scopeName fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES")), + langExt, // lang FALSE, // isExampleBlock 0, // exampleName fd, // fileDef diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index aa750db..ad5965d 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -249,12 +249,13 @@ void DocbookDocVisitor::visit(DocStyleChange *s) void DocbookDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; + SrcLangExt langExt = getLanguageFromFileName(m_langExt); switch(s->type()) { case DocVerbatim::Code: // fall though m_t << "<programlisting>"; Doxygen::parserManager->getParser(m_langExt) - ->parseCode(m_ci,s->context(),s->text(), + ->parseCode(m_ci,s->context(),s->text(),langExt, s->isExample(),s->exampleFile()); m_t << "</programlisting>"; break; @@ -346,6 +347,7 @@ void DocbookDocVisitor::visit(DocAnchor *anc) void DocbookDocVisitor::visit(DocInclude *inc) { if (m_hide) return; + SrcLangExt langExt = getLanguageFromFileName(inc->extension()); switch(inc->type()) { case DocInclude::IncWithLines: @@ -356,6 +358,7 @@ void DocbookDocVisitor::visit(DocInclude *inc) Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), + langExt, inc->isExample(), inc->exampleFile(), &fd); m_t << "</programlisting>"; @@ -366,6 +369,7 @@ void DocbookDocVisitor::visit(DocInclude *inc) Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), + langExt, inc->isExample(), inc->exampleFile()); m_t << "</programlisting>"; @@ -385,6 +389,7 @@ void DocbookDocVisitor::visit(DocInclude *inc) ->parseCode(m_ci, inc->context(), extractBlock(inc->text(),inc->blockId()), + langExt, inc->isExample(), inc->exampleFile() ); @@ -404,6 +409,7 @@ void DocbookDocVisitor::visit(DocIncOperator *op) pushEnabled(); m_hide = TRUE; } + SrcLangExt langExt = getLanguageFromFileName(m_langExt); if (op->type()!=DocIncOperator::Skip) { popEnabled(); @@ -411,7 +417,7 @@ void DocbookDocVisitor::visit(DocIncOperator *op) { Doxygen::parserManager->getParser(m_langExt) ->parseCode(m_ci,op->context(), - op->text(),op->isExample(), + op->text(),langExt,op->isExample(), op->exampleFile()); } pushEnabled(); diff --git a/src/filedef.cpp b/src/filedef.cpp index 784ebff..a2e2d12 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -879,6 +879,7 @@ void FileDef::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) ol.startCodeFragment(); pIntf->parseCode(ol,0, fileToString(absFilePath(),filterSourceFiles,TRUE), + getLanguage(), FALSE,0,this ); ol.endCodeFragment(); @@ -917,6 +918,7 @@ void FileDef::parseSource(bool sameTu,QStrList &filesInSameTu) pIntf->parseCode( devNullIntf,0, fileToString(absFilePath(),filterSourceFiles,TRUE), + getLanguage(), FALSE,0,this ); } diff --git a/src/fortranscanner.h b/src/fortranscanner.h index c70f948..e834698 100644 --- a/src/fortranscanner.h +++ b/src/fortranscanner.h @@ -39,6 +39,7 @@ class FortranLanguageScanner : public ParserInterface void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 278367c..08fe095 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -2306,6 +2306,7 @@ void FortranLanguageScanner::parseInput(const char *fileName, void FortranLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, const char * scopeName, const QCString & input, + SrcLangExt /*lang*/, bool isExampleBlock, const char * exampleName, FileDef * fileDef, diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 767fa5b..6fe4f35 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -417,6 +417,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s) { lang = s->language(); } + SrcLangExt langExt = getLanguageFromFileName(lang); switch(s->type()) { case DocVerbatim::Code: @@ -426,6 +427,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s) ->parseCode(m_ci, s->context(), s->text(), + langExt, s->isExample(), s->exampleFile(), 0, // fileDef @@ -526,6 +528,7 @@ void HtmlDocVisitor::visit(DocAnchor *anc) void HtmlDocVisitor::visit(DocInclude *inc) { if (m_hide) return; + SrcLangExt langExt = getLanguageFromFileName(inc->extension()); switch(inc->type()) { case DocInclude::Include: @@ -535,6 +538,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) ->parseCode(m_ci, inc->context(), inc->text(), + langExt, inc->isExample(), inc->exampleFile(), 0, // fileDef @@ -558,6 +562,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) ->parseCode(m_ci, inc->context(), inc->text(), + langExt, inc->isExample(), inc->exampleFile(), &fd, // fileDef, @@ -592,6 +597,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) ->parseCode(m_ci, inc->context(), extractBlock(inc->text(),inc->blockId()), + langExt, inc->isExample(), inc->exampleFile(), 0, @@ -619,6 +625,7 @@ void HtmlDocVisitor::visit(DocIncOperator *op) pushEnabled(); m_hide=TRUE; } + SrcLangExt langExt = getLanguageFromFileName(m_langExt); if (op->type()!=DocIncOperator::Skip) { popEnabled(); @@ -629,6 +636,7 @@ void HtmlDocVisitor::visit(DocIncOperator *op) m_ci, op->context(), op->text(), + langExt, op->isExample(), op->exampleFile(), 0, // fileDef diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 25f8c46..cdcf8b4 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -339,13 +339,14 @@ void LatexDocVisitor::visit(DocVerbatim *s) { lang = s->language(); } + SrcLangExt langExt = getLanguageFromFileName(lang); switch(s->type()) { case DocVerbatim::Code: { m_t << "\n\\begin{DoxyCode}\n"; Doxygen::parserManager->getParser(lang) - ->parseCode(m_ci,s->context(),s->text(), + ->parseCode(m_ci,s->context(),s->text(),langExt, s->isExample(),s->exampleFile()); m_t << "\\end{DoxyCode}\n"; } @@ -435,6 +436,7 @@ void LatexDocVisitor::visit(DocAnchor *anc) void LatexDocVisitor::visit(DocInclude *inc) { if (m_hide) return; + SrcLangExt langExt = getLanguageFromFileName(inc->extension()); switch(inc->type()) { case DocInclude::IncWithLines: @@ -445,6 +447,7 @@ void LatexDocVisitor::visit(DocInclude *inc) Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), + langExt, inc->isExample(), inc->exampleFile(), &fd); m_t << "\\end{DoxyCodeInclude}" << endl; @@ -454,7 +457,7 @@ void LatexDocVisitor::visit(DocInclude *inc) m_t << "\n\\begin{DoxyCodeInclude}\n"; Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), - inc->text(),inc->isExample(), + inc->text(),langExt,inc->isExample(), inc->exampleFile()); m_t << "\\end{DoxyCodeInclude}\n"; break; @@ -474,6 +477,7 @@ void LatexDocVisitor::visit(DocInclude *inc) ->parseCode(m_ci, inc->context(), extractBlock(inc->text(),inc->blockId()), + langExt, inc->isExample(), inc->exampleFile() ); @@ -493,13 +497,14 @@ void LatexDocVisitor::visit(DocIncOperator *op) pushEnabled(); m_hide = TRUE; } + SrcLangExt langExt = getLanguageFromFileName(m_langExt); if (op->type()!=DocIncOperator::Skip) { popEnabled(); if (!m_hide) { Doxygen::parserManager->getParser(m_langExt) - ->parseCode(m_ci,op->context(),op->text(), + ->parseCode(m_ci,op->context(),op->text(),langExt, op->isExample(),op->exampleFile()); } pushEnabled(); diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index e854bfc..18f93bb 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -193,14 +193,21 @@ void ManDocVisitor::visit(DocStyleChange *s) void ManDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; + QCString lang = m_langExt; + if (!s->language().isEmpty()) // explicit language setting + { + lang = s->language(); + } + SrcLangExt langExt = getLanguageFromFileName(lang); switch (s->type()) { case DocVerbatim::Code: // fall though if (!m_firstCol) m_t << endl; m_t << ".PP" << endl; m_t << ".nf" << endl; - Doxygen::parserManager->getParser(0/*TODO*/) + Doxygen::parserManager->getParser(lang) ->parseCode(m_ci,s->context(),s->text(), + langExt, s->isExample(),s->exampleFile()); if (!m_firstCol) m_t << endl; m_t << ".fi" << endl; @@ -240,6 +247,7 @@ void ManDocVisitor::visit(DocAnchor *) void ManDocVisitor::visit(DocInclude *inc) { if (m_hide) return; + SrcLangExt langExt = getLanguageFromFileName(inc->extension()); switch(inc->type()) { case DocInclude::IncWithLines: @@ -252,6 +260,7 @@ void ManDocVisitor::visit(DocInclude *inc) Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), + langExt, inc->isExample(), inc->exampleFile(), &fd); if (!m_firstCol) m_t << endl; @@ -266,7 +275,9 @@ void ManDocVisitor::visit(DocInclude *inc) m_t << ".nf" << endl; Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), - inc->text(),inc->isExample(), + inc->text(), + langExt, + inc->isExample(), inc->exampleFile()); if (!m_firstCol) m_t << endl; m_t << ".fi" << endl; @@ -295,6 +306,7 @@ void ManDocVisitor::visit(DocInclude *inc) ->parseCode(m_ci, inc->context(), extractBlock(inc->text(),inc->blockId()), + langExt, inc->isExample(), inc->exampleFile() ); @@ -308,6 +320,7 @@ void ManDocVisitor::visit(DocInclude *inc) void ManDocVisitor::visit(DocIncOperator *op) { + SrcLangExt langExt = getLanguageFromFileName(m_langExt); //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n", // op->type(),op->isFirst(),op->isLast(),op->text().data()); if (op->isFirst()) @@ -326,8 +339,8 @@ void ManDocVisitor::visit(DocIncOperator *op) popEnabled(); if (!m_hide) { - Doxygen::parserManager->getParser(0/*TODO*/) - ->parseCode(m_ci,op->context(),op->text(), + Doxygen::parserManager->getParser(m_langExt) + ->parseCode(m_ci,op->context(),op->text(),langExt, op->isExample(),op->exampleFile()); } pushEnabled(); diff --git a/src/markdown.cpp b/src/markdown.cpp index a3ac468..8f8feff 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -2341,6 +2341,7 @@ void MarkdownFileParser::parseInput(const char *fileName, void MarkdownFileParser::parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName, FileDef *fileDef, @@ -2356,7 +2357,7 @@ void MarkdownFileParser::parseCode(CodeOutputInterface &codeOutIntf, if (pIntf!=this) { pIntf->parseCode( - codeOutIntf,scopeName,input,isExampleBlock,exampleName, + codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName, fileDef,startLine,endLine,inlineFragment,memberDef,showLineNumbers,searchCtx); } } diff --git a/src/markdown.h b/src/markdown.h index 71884d5..daabc33 100644 --- a/src/markdown.h +++ b/src/markdown.h @@ -39,6 +39,7 @@ class MarkdownFileParser : public ParserInterface void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, diff --git a/src/memberdef.cpp b/src/memberdef.cpp index c5bf787..b3fdc68 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -2701,7 +2701,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension()); pIntf->resetCodeParserState(); ol.startCodeFragment(); - pIntf->parseCode(ol,scopeName,m_impl->initializer,FALSE,0,getFileDef(), + pIntf->parseCode(ol,scopeName,m_impl->initializer,lang,FALSE,0,getFileDef(), -1,-1,TRUE,this,FALSE,this); ol.endCodeFragment(); } diff --git a/src/parserintf.h b/src/parserintf.h index 0274c13..40c82dc 100644 --- a/src/parserintf.h +++ b/src/parserintf.h @@ -21,6 +21,8 @@ #include <qdict.h> #include <qstrlist.h> +#include "types.h" + class Entry; class FileDef; class CodeOutputInterface; @@ -79,6 +81,7 @@ class ParserInterface /** Parses a source file or fragment with the goal to produce * highlighted and cross-referenced output. * @param[in] codeOutIntf Abstract interface for writing the result. + * @param[in] lang The programming language of the code fragment. * @param[in] scopeName Name of scope to which the code belongs. * @param[in] input Actual code in the form of a string * @param[in] isExampleBlock TRUE iff the code is part of an example. @@ -99,6 +102,7 @@ class ParserInterface virtual void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, diff --git a/src/pycode.h b/src/pycode.h index ef9d47c..bdaef55 100644 --- a/src/pycode.h +++ b/src/pycode.h @@ -25,13 +25,15 @@ #ifndef PYCODE_H #define PYCODE_H +#include "types.h" + class CodeOutputInterface; class FileDef; class MemberDef; class QCString; class Definition; -extern void parsePythonCode(CodeOutputInterface &,const char *,const QCString &, +extern void parsePythonCode(CodeOutputInterface &,const char *,const QCString &, bool ,const char *,FileDef *fd, int startLine,int endLine,bool inlineFragment, MemberDef *memberDef,bool showLineNumbers,Definition *searchCtx); diff --git a/src/pyscanner.h b/src/pyscanner.h index 707edbd..5cc69d9 100644 --- a/src/pyscanner.h +++ b/src/pyscanner.h @@ -46,6 +46,7 @@ class PythonLanguageScanner : public ParserInterface void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, diff --git a/src/pyscanner.l b/src/pyscanner.l index 69b7558..69523d2 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -1700,6 +1700,7 @@ bool PythonLanguageScanner::needsPreprocessing(const QCString &) void PythonLanguageScanner::parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt /*lang*/, bool isExampleBlock, const char *exampleName, FileDef *fileDef, diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 2d07957..9489145 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -420,6 +420,7 @@ void RTFDocVisitor::visit(DocVerbatim *s) { lang = s->language(); } + SrcLangExt langExt = getLanguageFromFileName(lang); switch(s->type()) { case DocVerbatim::Code: // fall though @@ -427,7 +428,7 @@ void RTFDocVisitor::visit(DocVerbatim *s) m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); Doxygen::parserManager->getParser(lang) - ->parseCode(m_ci,s->context(),s->text(), + ->parseCode(m_ci,s->context(),s->text(),langExt, s->isExample(),s->exampleFile()); //m_t << "\\par" << endl; m_t << "}" << endl; @@ -527,6 +528,7 @@ void RTFDocVisitor::visit(DocAnchor *anc) void RTFDocVisitor::visit(DocInclude *inc) { if (m_hide) return; + SrcLangExt langExt = getLanguageFromFileName(inc->extension()); DBG_RTF("{\\comment RTFDocVisitor::visit(DocInclude)}\n"); switch(inc->type()) { @@ -540,6 +542,7 @@ void RTFDocVisitor::visit(DocInclude *inc) Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), + langExt, inc->isExample(), inc->exampleFile(), &fd); m_t << "\\par"; @@ -552,7 +555,7 @@ void RTFDocVisitor::visit(DocInclude *inc) m_t << rtf_Style_Reset << getStyle("CodeExample"); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), - inc->text(),inc->isExample(), + inc->text(),langExt,inc->isExample(), inc->exampleFile()); m_t << "\\par"; m_t << "}" << endl; @@ -577,6 +580,7 @@ void RTFDocVisitor::visit(DocInclude *inc) ->parseCode(m_ci, inc->context(), extractBlock(inc->text(),inc->blockId()), + langExt, inc->isExample(), inc->exampleFile() ); @@ -591,6 +595,7 @@ void RTFDocVisitor::visit(DocIncOperator *op) //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n", // op->type(),op->isFirst(),op->isLast(),op->text().data()); DBG_RTF("{\\comment RTFDocVisitor::visit(DocIncOperator)}\n"); + SrcLangExt langExt = getLanguageFromFileName(m_langExt); if (op->isFirst()) { if (!m_hide) @@ -608,7 +613,7 @@ void RTFDocVisitor::visit(DocIncOperator *op) if (!m_hide) { Doxygen::parserManager->getParser(m_langExt) - ->parseCode(m_ci,op->context(),op->text(), + ->parseCode(m_ci,op->context(),op->text(),langExt, op->isExample(),op->exampleFile()); } pushEnabled(); diff --git a/src/scanner.h b/src/scanner.h index 54a3c1c..f26accb 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -41,6 +41,7 @@ class CLanguageScanner : public ParserInterface void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, diff --git a/src/scanner.l b/src/scanner.l index 4ae410e..f9ecefc 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -6827,6 +6827,7 @@ void CLanguageScanner::parseInput(const char *fileName, void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, const char * scopeName, const QCString & input, + SrcLangExt lang, bool isExampleBlock, const char * exampleName, FileDef * fileDef, @@ -6838,7 +6839,7 @@ void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, Definition *searchCtx ) { - ::parseCCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName, + ::parseCCode(codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName, fileDef,startLine,endLine,inlineFragment,memberDef, showLineNumbers,searchCtx); } diff --git a/src/tclscanner.h b/src/tclscanner.h index a7c0dde..7cd93b9 100644 --- a/src/tclscanner.h +++ b/src/tclscanner.h @@ -40,6 +40,7 @@ class TclLanguageScanner : public ParserInterface void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, diff --git a/src/tclscanner.l b/src/tclscanner.l index 73b2b58..2129bf0 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -2560,6 +2560,7 @@ tcl_inf("%s\n",fileName); void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, const char * scopeName, const QCString & input, + SrcLangExt lang, bool isExampleBlock, const char * exampleName, FileDef * fileDef, @@ -2572,6 +2573,7 @@ void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, ) { (void)scopeName; + (void)lang; (void)exampleName; (void)fileDef; (void)endLine; diff --git a/src/util.cpp b/src/util.cpp index 0c36fc0..e0f3241 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1593,6 +1593,12 @@ ClassDef *getResolvedClass(Definition *scope, { result = getResolvedClassRec(scope,fileScope,n,pTypeDef,pTemplSpec,pResolvedType); } + if (result==0) // for nested classes imported via tag files, the scope may not + // present, so we check the class name directly as well. + // See also bug701314 + { + result = getClass(n); + } if (!mayBeUnlinkable && result && !result->isLinkable()) { if (!mayBeHidden || !result->isHidden()) @@ -3901,7 +3907,7 @@ static void findMembersWithSpecificName(MemberName *mn, * file fd. */ bool getDefs(const QCString &scName, - const QCString &memberName, + const QCString &mbName, const char *args, MemberDef *&md, ClassDef *&cd, @@ -3915,10 +3921,12 @@ bool getDefs(const QCString &scName, ) { fd=0, md=0, cd=0, nd=0, gd=0; - if (memberName.isEmpty()) return FALSE; /* empty name => nothing to link */ + if (mbName.isEmpty()) return FALSE; /* empty name => nothing to link */ QCString scopeName=scName; + QCString memberName=mbName; scopeName = substitute(scopeName,"\\","::"); // for PHP + memberName = substitute(memberName,"\\","::"); // for PHP //printf("Search for name=%s args=%s in scope=%s forceEmpty=%d\n", // memberName.data(),args,scopeName.data(),forceEmptyScope); @@ -4507,6 +4515,14 @@ bool resolveRef(/* in */ const char *scName, { return resolveRef(scName,name,inSeeBlock,resContext,resMember,FALSE,0,checkScope); } + if (bracePos!=-1) // Try without parameters as well, could be a contructor invocation + { + *resContext=getClass(fullName.left(bracePos)); + if (*resContext) + { + return TRUE; + } + } //printf("resolveRef: %s not found!\n",name); return FALSE; diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 7f898d6..a9af81a 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -2583,6 +2583,7 @@ void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname) pIntf->parseCode(ol, // codeOutIntf 0, // scope codeFragment, // input + SrcLangExt_VHDL, // lang FALSE, // isExample 0, // exampleName mdef->getFileDef(), // fileDef diff --git a/src/vhdlscanner.h b/src/vhdlscanner.h index 12c2d13..6ad8316 100644 --- a/src/vhdlscanner.h +++ b/src/vhdlscanner.h @@ -59,6 +59,7 @@ class VHDLLanguageScanner : public ParserInterface void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, diff --git a/src/vhdlscanner.l b/src/vhdlscanner.l index 934a985..d114218 100644 --- a/src/vhdlscanner.l +++ b/src/vhdlscanner.l @@ -796,6 +796,7 @@ void VHDLLanguageScanner::parseInput(const char *fileName, void VHDLLanguageScanner::parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, + SrcLangExt lang, bool isExampleBlock, const char *exampleName, FileDef *fileDef, diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index add18e3..f93b12d 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -246,12 +246,13 @@ void XmlDocVisitor::visit(DocStyleChange *s) void XmlDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; + SrcLangExt langExt = getLanguageFromFileName(m_langExt); switch(s->type()) { case DocVerbatim::Code: // fall though m_t << "<programlisting>"; Doxygen::parserManager->getParser(m_langExt) - ->parseCode(m_ci,s->context(),s->text(), + ->parseCode(m_ci,s->context(),s->text(),langExt, s->isExample(),s->exampleFile()); m_t << "</programlisting>"; break; @@ -310,6 +311,7 @@ void XmlDocVisitor::visit(DocAnchor *anc) void XmlDocVisitor::visit(DocInclude *inc) { if (m_hide) return; + SrcLangExt langExt = getLanguageFromFileName(inc->extension()); switch(inc->type()) { case DocInclude::IncWithLines: @@ -320,6 +322,7 @@ void XmlDocVisitor::visit(DocInclude *inc) Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), + langExt, inc->isExample(), inc->exampleFile(), &fd); m_t << "</programlisting>"; @@ -330,6 +333,7 @@ void XmlDocVisitor::visit(DocInclude *inc) Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), + langExt, inc->isExample(), inc->exampleFile()); m_t << "</programlisting>"; @@ -352,6 +356,7 @@ void XmlDocVisitor::visit(DocInclude *inc) ->parseCode(m_ci, inc->context(), extractBlock(inc->text(),inc->blockId()), + langExt, inc->isExample(), inc->exampleFile() ); @@ -373,6 +378,7 @@ void XmlDocVisitor::visit(DocIncOperator *op) pushEnabled(); m_hide = TRUE; } + SrcLangExt langExt = getLanguageFromFileName(m_langExt); if (op->type()!=DocIncOperator::Skip) { popEnabled(); @@ -380,7 +386,7 @@ void XmlDocVisitor::visit(DocIncOperator *op) { Doxygen::parserManager->getParser(m_langExt) ->parseCode(m_ci,op->context(), - op->text(),op->isExample(), + op->text(),langExt,op->isExample(), op->exampleFile()); } pushEnabled(); diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index f189831..6f98b3c 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -456,11 +456,13 @@ static void writeXMLDocBlock(FTextStream &t, void writeXMLCodeBlock(FTextStream &t,FileDef *fd) { ParserInterface *pIntf=Doxygen::parserManager->getParser(fd->getDefFileExtension()); + SrcLangExt langExt = getLanguageFromFileName(fd->getDefFileExtension()); pIntf->resetCodeParserState(); XMLCodeGenerator *xmlGen = new XMLCodeGenerator(t); pIntf->parseCode(*xmlGen, // codeOutIntf 0, // scopeName fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES")), + langExt, // lang FALSE, // isExampleBlock 0, // exampleName fd, // fileDef |