Commit 7e2f4c79 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Release-1.4.3-20050615

parent 365d0dd9
......@@ -92,7 +92,9 @@ EXCLUDE = src/code.cpp \
src/searchindex.cpp \
src/searchindex.h \
src/commentcnv.cpp \
src/commentscan.cpp
src/commentscan.cpp \
src/pycode.cpp \
src/pyscanner.cpp
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
......
DOXYGEN Version 1.4.3-20050530
DOXYGEN Version 1.4.3-20050615
Please read the installation section of the manual
(http://www.doxygen.org/install.html) for instructions.
--------
Dimitri van Heesch (30 May 2005)
Dimitri van Heesch (15 June 2005)
DOXYGEN Version 1.4.3_20050530
DOXYGEN Version 1.4.3_20050615
Please read INSTALL for compilation instructions.
......@@ -17,4 +17,4 @@ to subscribe to the lists or to visit the archives.
Enjoy,
Dimitri van Heesch (dimitri@stack.nl) (30 May 2005)
Dimitri van Heesch (dimitri@stack.nl) (15 June 2005)
1.4.3-20050530
1.4.3-20050615
......@@ -36,7 +36,7 @@ INPUT = index.doc install.doc starting.doc docblocks.doc lists.doc \
autolink.doc output.doc external.doc faq.doc trouble.doc history.doc features.doc \
doxygen_usage.doc doxytag_usage.doc \
doxywizard_usage.doc installdox_usage.doc \
config.doc commands.doc htmlcmds.doc language.doc \
config.doc commands.doc htmlcmds.doc xmlcmds.doc language.doc \
perlmod.doc perlmod_tree.doc arch.doc
FILE_PATTERNS = *.cpp *.h *.doc
EXAMPLE_PATH = ../examples
......
.TH DOXYGEN "1" "DATE" "doxygen VERSION" "User Commands"
.SH NAME
doxygen \- manual page for doxygen VERSION
doxygen \- documentation system for various programming languages
.SH DESCRIPTION
Doxygen version VERSION
Copyright Dimitri van Heesch 1997-2005
Doxygen is a documentation system for C++, C, Java, Objective-C, IDL
(Corba and Microsoft flavors) and to some extent PHP, C#, and D.
.PP
You can use doxygen in a number of ways:
.TP
......@@ -40,5 +40,7 @@ doxygen \fB\-e\fR rtf extensionsFile
.PP
If \fB\-s\fR is specified the comments in the config file will be omitted.
If configName is omitted `Doxyfile' will be used as a default.
.SH AUTHOR
Doxygen version VERSION, Copyright Dimitri van Heesch 1997-2005
.SH SEE ALSO
doxytag(1), doxywizard(1).
......@@ -22,11 +22,11 @@
Plain text will do, but for more fancy or structured output HTML tags
and/or some of doxygen's special commands can be used.
<li>Supports C/C++, Java, (Corba and Microsoft) Java,
IDL, and to some extent C# and PHP sources.
IDL, C#, Objective-C and to some extent D and PHP sources.
<li>Supports documentation of files, namespaces, classes, structs, unions,
templates, variables, functions, typedefs, enums and defines.
<li>JavaDoc (1.1), Qt-Doc, and KDOC compatible.
<li>Automatically generates class diagrams in HTML (as clickable
<li>JavaDoc (1.1), Qt-Doc, and ECMA-334 (C# spec.) compatible.
<li>Automatically generates class and collaboration diagrams in HTML (as clickable
image maps) and \f$\mbox{\LaTeX}\f$ (as Encapsulated PostScript images).
<li>Uses the dot tool of the Graphviz tool kit to generate
include dependency graphs, collaboration diagrams, and
......@@ -76,8 +76,9 @@
<li>Can cope with large projects easily.
</UL>
Although doxygen can be used in any C or C++ project, it was specifically
designed to be used for projects that make use of Troll Tech's
Although doxygen can be used in any C or C++ project,
initially it was specifically designed to be used for projects that make
use of Troll Tech's
<A HREF="http://www.trolltech.com/products/qt.html">Qt toolkit</A>. I have tried to make doxygen
`Qt-compatible'. That is: Doxygen can read the documentation contained in
the Qt source code and create a class browser that looks very similar to the
......
......@@ -17,9 +17,10 @@
/*! \page htmlcmds HTML Commands
Here is a list of all HTML commands that may be used inside the
documentation. Note that all attributes of a HTML tag are passed on to
the HTML output only (the HREF and NAME attributes for the A tag are the
only exception).
documentation. Note that although these HTML tags are translated to the
proper commands for outer formats other than HTML, all attributes
of a HTML tag are passed on to the HTML output only
(the HREF and NAME attributes for the A tag are the only exception).
<ul>
<li><tt>\<A HREF="..."\></tt> Starts a HTML hyper-link (HTML only).
......
......@@ -97,6 +97,8 @@ The second part forms a reference manual:
used within the documentation.
<li>Section \ref htmlcmds shows an overview of the HTML commands that
can be used within the documentation.
<li>Section \ref xmlcmds shows an overview of the XML commands that
can be used within the documentation.
</ul>
The third part provides information for developers:
......@@ -186,6 +188,7 @@ Thanks go to:
<li>Tim Mensch for adding the todo command.
<li>Christian Hammond for redesigning the web-site.
<li>Ken Wong for providing the HTML tree view code.
<li>Talin for adding support for C# style comments with XML markup.
<li>Petr Prikryl for coordinating the internationalisation support.
All language maintainers for providing translations into many languages.
<li>Gerald Steffens of <a href="http://www.e-trend.de">E-trend</a>
......
/******************************************************************************
*
*
*
* Copyright (C) 1997-2005 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
/*! \page xmlcmds XML Commands
Doxygen supports most of the XML commands that are typically used in C#
code comments. The XML tags are defined in Appendix E of the
<a href="http://www.ecma-international.org/publications/standards/Ecma-334.htm">ECMA-334</a>
standard, which defines the C# language. Unfortunately, the specification is
not very precise and a number of the examples given are of poor quality.
Here is the list of tags supported by doxygen:
<ul>
<li><tt>\<c\></tt> Identifies inline text that should be rendered as a
piece of code. Similar to using <tt>\<tt\></tt>text<tt>\</tt\></tt>.
<li><tt>\<code\></tt> Set one or more lines of source code or program output.
Note that this command behaves like <tt>\\code ... \\endcode</tt>
for C# code, but it behaves like the HTML equivalent
<tt>\<code\>...\</code\></tt> for other languages.
<li><tt>\<description\></tt> Part of a <tt>\<list\></tt> command, describes an item.
<li><tt>\<example\></tt> Marks a block of text as an example, ignored by doxygen.
<li><tt>\<exception cref="member"\></tt> Identifies the exception a
method can throw.
<li><tt>\<include\></tt> Can be used to import a piece of XML from an external
file. Ignored by doxygen at the moment.
<li><tt>\<item\></tt> List item. Can only be used inside a <tt>\<list\></tt> context.
<li><tt>\<list type="type"\></tt> Starts a list, supported types are <tt>bullet</tt>
or <tt>number</tt>. A list consists of a number of <tt>\<item\></tt> tags.
<li><tt>\<para\></tt> Identifies a paragraph of text.
<li><tt>\<param name="paramName"\></tt> Marks a piece of text as the documentation
for parameter "paramName". Similar to
using \ref cmdparam "\\param".
<li><tt>\<paramref name="paramName"\></tt> Refers to a parameter with name
"paramName". Similar to using \ref cmda "\\a".
<li><tt>\<permission\></tt> Identifies the security accessibility of a member.
Ignored by doygen.
<li><tt>\<remarks\></tt> Identifies the detailed description.
<li><tt>\<returns\></tt> Marks a piece of text as the return value of a
function or method. Similar to using \ref cmdreturn "\\return".
<li><tt>\<see cref="member"\></tt> Refers to a member. Similar to \ref cmdref "\\ref".
<li><tt>\<seealso cref="member"\></tt> Starts a "See also" section referring
to "member". Similar to using \ref cmdsa "\\sa" member.
<li><tt>\<summary\></tt> Identifies the brief description.
Similar to using \ref cmdbrief "\\brief".
<li><tt>\<value\></tt> Identifies a property. Ignored by doxygen.
</ul>
Here is an example of a typical piece of code using some of the above commands:
\code
/// <summary>
/// A search engine.
/// </summary>
class Engine
{
/// <summary>
/// The Search method takes a series of parameters to specify the search criterion
/// and returns a dataset containing the result set.
/// </summary>
/// <param name="connectionString">the connection string to connect to the
/// database holding the content to search</param>
/// <param name="maxRows">The maximum number of rows to
/// return in the result set</param>
/// <param name="searchString">The text that we are searching for</param>
/// <returns>A DataSet instance containing the matching rows. It contains a maximum
/// number of rows specified by the maxRows parameter</returns>
public DataSet Search(string connectionString, int maxRows, int searchString)
{
DataSet ds = new DataSet();
return ds;
}
}
\endcode
*/
......@@ -47,6 +47,7 @@ clean: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen Makefile.doxytag
distclean: clean
-$(RM) scanner.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \
ce_parse.cpp ce_parse.h doxytag.cpp tag.cpp commentscan.cpp \
declinfo.cpp defargs.cpp commentcnv.cpp doctokenizer.cpp
declinfo.cpp defargs.cpp commentcnv.cpp doctokenizer.cpp \
pycode.cpp pyscanner.cpp
FORCE:
......@@ -100,7 +100,6 @@ CommandMap cmdMap[] =
{ "$", CMD_DOLLAR },
{ "#", CMD_HASH },
{ "%", CMD_PERCENT },
//{ "~", CMD_LANGSWITCH },
{ "_internalref", CMD_INTERNALREF },
{ "dot", CMD_DOT },
{ "enddot", CMD_ENDDOT },
......@@ -112,42 +111,6 @@ CommandMap cmdMap[] =
//----------------------------------------------------------------------------
int CmdMapper::map(const char *name)
{
return instance()->find(name);
}
void CmdMapper::freeInstance()
{
delete m_instance; m_instance=0;
}
CmdMapper *CmdMapper::instance()
{
if (m_instance==0) m_instance = new CmdMapper;
return m_instance;
}
CmdMapper::CmdMapper() : m_map(89)
{
m_map.setAutoDelete(TRUE);
CommandMap *p = cmdMap;
while (p->cmdName)
{
m_map.insert(p->cmdName,new int(p->cmdId));
p++;
}
}
int CmdMapper::find(const char *name)
{
int *result = m_map.find(name);
if (result) return *result; else return CMD_UNKNOWN;
}
CmdMapper *CmdMapper::m_instance=0;
//----------------------------------------------------------------------------
CommandMap htmlTagMap[] =
{
{ "strong", HTML_BOLD },
......@@ -188,43 +151,37 @@ CommandMap htmlTagMap[] =
{ "h6", HTML_H6 },
{ "span", HTML_SPAN },
{ "div", HTML_DIV },
{ "c", XML_C },
// { "code", XML_CODE }, <= ambigious <code> is also a HTML tag
{ "description",XML_DESCRIPTION },
{ "example", XML_EXAMPLE },
{ "exception", XML_EXCEPTION },
{ "include", XML_INCLUDE },
{ "item", XML_ITEM },
{ "list", XML_LIST },
{ "para", XML_PARA },
{ "param", XML_PARAM },
{ "paramref", XML_PARAMREF },
{ "permission", XML_PERMISSION },
{ "remarks", XML_REMARKS },
{ "returns", XML_RETURNS },
{ "see", XML_SEE },
{ "seealso", XML_SEEALSO },
{ "summary", XML_SUMMARY },
{ "value", XML_VALUE },
{ 0, 0 }
};
//----------------------------------------------------------------------------
int HtmlTagMapper::map(const char *name)
{
return instance()->find(name);
}
void HtmlTagMapper::freeInstance()
{
delete m_instance; m_instance=0;
}
HtmlTagMapper *HtmlTagMapper::instance()
{
if (m_instance==0) m_instance = new HtmlTagMapper;
return m_instance;
}
Mapper *Mappers::cmdMapper = new Mapper(cmdMap);
Mapper *Mappers::htmlTagMapper = new Mapper(htmlTagMap);
HtmlTagMapper::HtmlTagMapper() : m_map(89)
void Mappers::freeMappers()
{
m_map.setAutoDelete(TRUE);
CommandMap *p = htmlTagMap;
while (p->cmdName)
{
m_map.insert(p->cmdName,new int(p->cmdId));
p++;
}
}
int HtmlTagMapper::find(const char *name)
{
int *result = m_map.find(name);
if (result) return *result; else return HTML_UNKNOWN;
delete cmdMapper; cmdMapper = 0;
delete htmlTagMapper; htmlTagMapper = 0;
}
HtmlTagMapper *HtmlTagMapper::m_instance=0;
//----------------------------------------------------------------------------
......@@ -111,67 +111,92 @@ enum CommandType
enum HtmlTagType
{
HTML_UNKNOWN = 0,
HTML_CENTER = 1,
HTML_TABLE = 2,
HTML_CAPTION = 3,
HTML_SMALL = 4,
HTML_CODE = 5,
HTML_IMG = 6,
HTML_PRE = 7,
HTML_SUB = 8,
HTML_SUP = 9,
HTML_TR = 10,
HTML_TD = 11,
HTML_TH = 12,
HTML_OL = 13,
HTML_UL = 14,
HTML_LI = 15,
HTML_EMPHASIS = 16,
HTML_HR = 17,
HTML_DL = 18,
HTML_DT = 19,
HTML_DD = 20,
HTML_BR = 21,
HTML_A = 22,
HTML_BOLD = 23,
HTML_P = 24,
HTML_H1 = 25,
HTML_H2 = 26,
HTML_H3 = 27,
HTML_H4 = 28,
HTML_H5 = 29,
HTML_H6 = 30,
HTML_SPAN = 31,
HTML_DIV = 32
HTML_UNKNOWN = 0,
HTML_CENTER = 1,
HTML_TABLE = 2,
HTML_CAPTION = 3,
HTML_SMALL = 4,
HTML_CODE = 5,
HTML_IMG = 6,
HTML_PRE = 7,
HTML_SUB = 8,
HTML_SUP = 9,
HTML_TR = 10,
HTML_TD = 11,
HTML_TH = 12,
HTML_OL = 13,
HTML_UL = 14,
HTML_LI = 15,
HTML_EMPHASIS = 16,
HTML_HR = 17,
HTML_DL = 18,
HTML_DT = 19,
HTML_DD = 20,
HTML_BR = 21,
HTML_A = 22,
HTML_BOLD = 23,
HTML_P = 24,
HTML_H1 = 25,
HTML_H2 = 26,
HTML_H3 = 27,
HTML_H4 = 28,
HTML_H5 = 29,
HTML_H6 = 30,
HTML_SPAN = 31,
HTML_DIV = 32,
XML_CmdMask = 0x100,
XML_C = XML_CmdMask + 0,
XML_CODE = XML_CmdMask + 1,
XML_DESCRIPTION= XML_CmdMask + 2,
XML_EXAMPLE = XML_CmdMask + 3,
XML_EXCEPTION = XML_CmdMask + 4,
XML_INCLUDE = XML_CmdMask + 5,
XML_ITEM = XML_CmdMask + 6,
XML_LIST = XML_CmdMask + 7,
XML_PARA = XML_CmdMask + 8,
XML_PARAM = XML_CmdMask + 9,
XML_PARAMREF = XML_CmdMask + 10,
XML_PERMISSION = XML_CmdMask + 11,
XML_REMARKS = XML_CmdMask + 12,
XML_RETURNS = XML_CmdMask + 13,
XML_SEE = XML_CmdMask + 14,
XML_SEEALSO = XML_CmdMask + 15,
XML_SUMMARY = XML_CmdMask + 16,
XML_VALUE = XML_CmdMask + 17
};
class CmdMapper
class Mapper
{
public:
static int map(const char *name);
static void freeInstance();
int map(const char *n)
{
QCString name=n;
int *result;
return !name.isEmpty() && (result=m_map.find(name.lower())) ? *result: 0;
}
Mapper(const CommandMap *cm) : m_map(89)
{
m_map.setAutoDelete(TRUE);
const CommandMap *p = cm;
while (p->cmdName)
{
m_map.insert(p->cmdName,new int(p->cmdId));
p++;
}
}
private:
static CmdMapper *instance();
CmdMapper();
int find(const char *name);
QDict<int> m_map;
static CmdMapper *m_instance;
};
class HtmlTagMapper
struct Mappers
{
public:
static int map(const char *name);
static void freeInstance();
private:
static HtmlTagMapper *instance();
HtmlTagMapper();
int find(const char *name);
QDict<int> m_map;
static HtmlTagMapper *m_instance;
static void freeMappers();
static Mapper *cmdMapper;
static Mapper *htmlTagMapper;
};
......
......@@ -21,13 +21,14 @@
#include "qtbc.h"
#include <stdio.h>
class BaseCodeDocInterface;
class CodeOutputInterface;
class FileDef;
class MemberDef;
extern void parseCode(BaseCodeDocInterface &,const char *,const QCString &,
extern void parseCCode(CodeOutputInterface &,const char *,const QCString &,
bool ,const char *,FileDef *fd=0,
int startLine=-1,int endLine=-1,bool inlineFragment=FALSE);
extern void initParseCodeContext();
extern void setParameterList(MemberDef *md);
int startLine=-1,int endLine=-1,bool inlineFragment=FALSE,
MemberDef *memberDef=0);
extern void resetCCodeParserState();
#endif
......@@ -27,7 +27,6 @@
#include <qdir.h>
#include "qtbc.h"
#include "scanner.h"
#include "entry.h"
#include "doxygen.h"
#include "message.h"
......@@ -50,7 +49,7 @@
* statics
*/
static BaseCodeDocInterface * g_code;
static CodeOutputInterface * g_code;
static ClassSDict g_codeClassSDict(17);
static QCString g_curClassName;
......@@ -346,11 +345,8 @@ class CallContext
void clear()
{
DBG_CTX((stderr,"** Clear call context\n"));
Ctx *ctx = m_classList.getLast();
if (ctx)
{
ctx->cd=0;
}
m_classList.clear();
m_classList.append(new Ctx);
}
ClassDef *getClass() const
{
......@@ -549,7 +545,7 @@ static void codifyLines(char *text)
* line numbers for each line. If \a text contains newlines, the link will be
* split into multiple links with the same destination, one for each line.
*/
static void writeMultiLineCodeLink(BaseCodeDocInterface &ol,
static void writeMultiLineCodeLink(CodeOutputInterface &ol,
const char *ref,const char *file,
const char *anchor,const char *text)
{
......@@ -600,7 +596,7 @@ static void addParmType()
g_parmName.resize(0) ;
}
void setParameterList(MemberDef *md)
static void setParameterList(MemberDef *md)
{
g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : "";
ArgumentList *al = md->argumentList();
......@@ -614,7 +610,7 @@ void setParameterList(MemberDef *md)
if (i!=-1) g_parmType = g_parmType.left(i);
i = g_parmType.find('&');
if (i!=-1) g_parmType = g_parmType.left(i);
if (g_parmType.left(6)=="const ") g_parmType = g_parmType.right(g_parmType.length()-6);
g_parmType.stripPrefix("const ");
g_parmType=g_parmType.stripWhiteSpace();
g_theVarContext.addVariable(g_parmType,g_parmName);
a = al->next();
......@@ -767,7 +763,7 @@ static void addDocCrossReference(MemberDef *src,MemberDef *dst)
static bool getLinkInScope(const QCString &c, // scope
const QCString &m, // member
const char *memberText, // exact text
BaseCodeDocInterface &ol,
CodeOutputInterface &ol,
const char *text
)
{
......@@ -825,7 +821,7 @@ static bool getLinkInScope(const QCString &c, // scope
static bool getLink(const char *className,
const char *memberName,
BaseCodeDocInterface &ol,
CodeOutputInterface &ol,
const char *text=0)
{
QCString m=removeRedundantWhiteSpace(memberName);
......@@ -843,7 +839,7 @@ static bool getLink(const char *className,
return TRUE;
}
static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName,
static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
bool typeOnly=FALSE)
{
int i=0;
......@@ -963,7 +959,7 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName,
}
}
static bool generateClassMemberLink(BaseCodeDocInterface &ol,ClassDef *mcd,const char *memName)
static bool generateClassMemberLink(CodeOutputInterface &ol,ClassDef *mcd,const char *memName)
{
if (mcd)
{
......@@ -1025,7 +1021,7 @@ static bool generateClassMemberLink(BaseCodeDocInterface &ol,ClassDef *mcd,const
return FALSE;
}
static void generateMemberLink(BaseCodeDocInterface &ol,const QCString &varName,
static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName,
char *memName)
{
//printf("generateMemberLink(object=%s,mem=%s) classScope=%s\n",
......@@ -1120,7 +1116,7 @@ static void generateMemberLink(BaseCodeDocInterface &ol,const QCString &varName,
return;
}
static void generateFunctionLink(BaseCodeDocInterface &ol,char *funcName)
static void generateFunctionLink(CodeOutputInterface &ol,char *funcName)
{
//CodeClassDef *ccd=0;
ClassDef *ccd=0;
......@@ -2412,7 +2408,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
g_code->codify(yytext);
endFontClass();
}
<MemberCall2,FuncCall>[a-z_A-Z][:a-z_A-Z0-9]*({B}*"<"[^\n\<\>]*">")? {
<MemberCall2,FuncCall>[a-z_A-Z][:a-z_A-Z0-9]*({B}*"<"[^\n\[\](){}<>]*">")? {
addParmType();
g_parmName=yytext;
generateClassOrGlobalLink(*g_code,yytext,!g_insideBody);
......@@ -2812,7 +2808,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
}
}
<*>"//"[!/][^\n]*\n { // strip special one-line comment
if (YY_START==SkipComment) REJECT;
if (YY_START==SkipComment || YY_START==SkipString) REJECT;
if (Config_getBool("STRIP_CODE_COMMENTS"))
{
char c[2]; c[0]='\n'; c[1]=0;
......@@ -2863,6 +2859,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
}
}
<*>"/*"[!*]/[^/*] { // special C comment block half way a line
if (YY_START==SkipString) REJECT;
if (Config_getBool("STRIP_CODE_COMMENTS"))
{
g_lastSpecialCContext = YY_START;
......@@ -2880,7 +2877,9 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
BEGIN(SkipComment);
}
}
<*>"/*"("!"?)"*/" { if (!Config_getBool("STRIP_CODE_COMMENTS"))
<*>"/*"("!"?)"*/" {
if (YY_START==SkipString) REJECT;
if (!Config_getBool("STRIP_CODE_COMMENTS"))
{
startFontClass("comment");
g_code->codify(yytext);
......@@ -2984,7 +2983,7 @@ static void restoreObjCContext()
}
}
void initParseCodeContext()
void resetCCodeParserState()
{
//printf("***initParseCodeContext()\n");
g_theVarContext.clear();
......@@ -2994,9 +2993,10 @@ void initParseCodeContext()
g_anchorCount = 0;
}
void parseCode(BaseCodeDocInterface &od,const char *className,const QCString &s,
void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s,
bool exBlock, const char *exName,FileDef *fd,
int startLine,int endLine,bool inlineFragment)
int startLine,int endLine,bool inlineFragment,
MemberDef *memberDef)
{
//printf("***parseCode()\n");
if (s.isEmpty()) return;
......@@ -3048,6 +3048,7 @@ void parseCode(BaseCodeDocInterface &od,const char *className,const QCString &s,
g_args.resize(0);
g_parmName.resize(0);
g_parmType.resize(0);
if (memberDef) setParameterList(memberDef);
codeYYrestart( codeYYin );
BEGIN( Body );
codeYYlex();
......
......@@ -454,9 +454,16 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'"))
<CondLine>[ \t]*
<CComment,ReadLine>[\\@]"cond"[ \t]*\n |
<CondLine>. { // forgot section id?
bool oldSkip=g_skip;
startCondSection(" "); // fake section id causing the section to be hidden unconditionally
if (g_condCtx==CComment && !oldSkip && g_skip)
{
//printf("** Adding terminator for comment!\n");
ADDCHAR('*');
ADDCHAR('/');
}
if (*yytext=='\n') g_lineNr++;
if (YY_START==CondLine) BEGIN(g_condCtx);
BEGIN(g_condCtx);
}
<CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]* { // expand alias
QCString *pValue=Doxygen::aliasDict[yytext+1];
......
......@@ -42,7 +42,6 @@
#include "outputlist.h"
#include "membergroup.h"
#include "reflist.h"
#include "code.h"
#include "debug.h"
#include "parserintf.h"
......@@ -715,6 +714,7 @@ ID "$"?[a-z_A-Z][a-z_A-Z0-9]*
LABELID [a-z_A-Z][a-z_A-Z0-9\-]*
SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?)
SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})
MAILADR [a-z_A-Z0-9.+\-]+"@"[a-z_A-Z0-9\-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+
%option noyywrap
......@@ -770,6 +770,9 @@ SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})
* words and whitespace and other characters (#,?!, etc).
* grouping commands (e.g. @{ and @})
* language switch (e.g. \~english or \~).
* mail adress (e.g. dimitri@stack.nl).
* quoted text, such as "foo@bar"
* XML commands, <summary></summary><remarks></remarks>
*/
<Comment>{CMD}{CMD}[a-z_A-Z]+{B}* { // escaped command
......@@ -778,6 +781,12 @@ SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})
<Comment>{CMD}{CMD}"~"[a-z_A-Z]* { // escaped command
addOutput(yytext);
}
<Comment>{MAILADR} { // mail adress
addOutput(yytext);
}
<Comment>"\""[^"\n]*"\"" { // quoted text
addOutput(yytext);
}
<Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!)
addOutput(yytext);
}
......@@ -791,6 +800,14 @@ SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})
// continue with the same input
REJECT;
}
<Comment>"<summary>" { // start of a .NET XML style brief description
setOutput(OutputBrief);
}
<Comment>"<remarks>"|"</summary>" { // start of a .NET XML style detailed description
setOutput(OutputDoc);
}
<Comment>"</remarks>" { // end of a brief or detailed description
}
<Comment>"<!--" {
BEGIN(HtmlComment);
}
......
......@@ -1722,7 +1722,7 @@ void Config::create()
"SHOW_DIRECTORIES",
"If the sources in your project are distributed over multiple directories \n"
"then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy \n"
"in the documentation.\n",
"in the documentation. The default is YES.\n",
TRUE
);
cs = addString( "FILE_VERSION_FILTER",
......
......@@ -28,7 +28,6 @@
#include "defargs.h"
#include "outputgen.h"
#include "dot.h"
#include "code.h"
#include <qdir.h>
#include <qfile.h>
......
......@@ -32,6 +32,7 @@
#include "pagedef.h"
#include "section.h"
#include "htags.h"
#include "parserintf.h"
#if defined(_MSC_VER) || defined(__BORLANDC__)
#define popen _popen
......@@ -81,6 +82,11 @@ Definition::Definition(const char *df,int dl,
{
//QCString ns;
m_defFileName = df;
int lastDot = m_defFileName.findRev('.');
if (lastDot!=-1)
{
m_defFileExt = m_defFileName.mid(lastDot);
}
m_defLine = dl;
m_name=name;
if (m_name!="<globalScope>")
......@@ -459,12 +465,23 @@ void Definition::writeInlineCode(OutputList &ol,const char *scopeName)
actualStart,actualEnd,codeFragment)
)
{
initParseCodeContext();
ParserInterface *pIntf = Doxygen::parserManager->getParser(m_defFileExt);
pIntf->resetCodeParserState();
//printf("Read:\n`%s'\n\n",codeFragment.data());
if (definitionType()==TypeMember) setParameterList((MemberDef *)this);
MemberDef *thisMd = 0;
if (definitionType()==TypeMember) thisMd = (MemberDef *)this;
ol.startCodeFragment();
parseCode(ol,scopeName,codeFragment,FALSE,0,
m_bodyDef,actualStart,actualEnd,TRUE);
pIntf->parseCode(ol, // codeOutIntf
scopeName, // scope
codeFragment, // input
FALSE, // isExample
0, // exampleName
m_bodyDef, // fileDef
actualStart, // startLine
actualEnd, // endLine
TRUE, // inlineFragment
thisMd // memberDef
);
ol.endCodeFragment();
ol.newParagraph();
}
......
......@@ -117,6 +117,9 @@ class Definition
/*! returns the file in which this definition was found */
QCString getDefFileName() const { return m_defFileName; }
/*! returns the file in which this definition was found */
QCString getDefFileExtension() const { return m_defFileExt; }
/*! returns the line number at which the definition was found */
int getDefLine() const { return m_defLine; }
......@@ -207,6 +210,7 @@ class Definition
// where the item was found
QCString m_defFileName;
int m_defLine;
QCString m_defFileExt;
/*! The class, namespace in which this class is located
*/
......
This diff is collapsed.
......@@ -885,6 +885,7 @@ class DocHtmlList : public CompAccept<DocHtmlList>, public DocNode
void accept(DocVisitor *v) { CompAccept<DocHtmlList>::accept(this,v); }
const HtmlAttribList &attribs() const { return m_attribs; }
int parse();
int parseXml();
private:
DocNode * m_parent;
......@@ -909,6 +910,8 @@ class DocSimpleSect : public CompAccept<DocSimpleSect>, public DocNode
void accept(DocVisitor *v);
int parse(bool userTitle);
int parseRcs();
int parseXml();
void appendLinkWord(const QString &word);
private:
DocNode * m_parent;
......@@ -930,7 +933,7 @@ class DocParamSect : public CompAccept<DocParamSect>, public DocNode
};
DocParamSect(DocNode *parent,Type t)
: m_parent(parent), m_type(t) {}
int parse(const QString &cmdName,Direction d);
int parse(const QString &cmdName,bool xmlContext,Direction d);
Kind kind() const { return Kind_ParamSect; }
Type type() const { return m_type; }
DocNode *parent() const { return m_parent; }
......@@ -962,9 +965,10 @@ class DocPara : public CompAccept<DocPara>, public DocNode
int handleCommand(const QString &cmdName);
int handleHtmlStartTag(const QString &tagName,const HtmlAttribList &tagHtmlAttribs);
int handleHtmlEndTag(const QString &tagName);
int handleSimpleSection(DocSimpleSect::Type t);
int handleSimpleSection(DocSimpleSect::Type t,bool xmlContext=FALSE);
int handleXRefItem();
int handleParamSection(const QString &cmdName,DocParamSect::Type t,
bool xmlContext,
int direction);
void handleIncludeOperator(const QString &cmdName,DocIncOperator::Type t);
void handleImage(const QString &cmdName);
......@@ -973,7 +977,9 @@ class DocPara : public CompAccept<DocPara>, public DocNode
void handleLink(const QString &cmdName,bool isJavaLink);
void handleRef(const QString &cmdName);
void handleSection(const QString &cmdName);
int handleStartCode();
int handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level);
bool injectToken(int tok,const QString &tokText);
//int handleLanguageSwitch();
private:
......@@ -989,11 +995,10 @@ class DocParamList : public DocNode
public:
DocParamList(DocNode *parent,DocParamSect::Type t,DocParamSect::Direction d)
: m_parent(parent) , m_type(t), m_dir(d), m_isFirst(TRUE), m_isLast(TRUE)
{ m_paragraph=new DocPara(this); }
virtual ~DocParamList() { delete m_paragraph; }
{ m_paragraphs.setAutoDelete(TRUE); }
virtual ~DocParamList() { }
Kind kind() const { return Kind_ParamList; }
DocNode *parent() const { return m_parent; }
//const QStrList &parameters() { return m_params; }
const QList<DocNode> &parameters() { return m_params; }
DocParamSect::Type type() const { return m_type; }
DocParamSect::Direction direction() const { return m_dir; }
......@@ -1004,15 +1009,17 @@ class DocParamList : public DocNode
void accept(DocVisitor *v)
{
v->visitPre(this);
m_paragraph->accept(v);
QListIterator<DocPara> cli(m_paragraphs);
DocNode *n;
for (cli.toFirst();(n=cli.current());++cli) n->accept(v);
v->visitPost(this);
}
int parse(const QString &cmdName);
int parseXml(const QString &paramName);
private:
DocNode * m_parent;
DocPara * m_paragraph;
//QStrList m_params;
QList<DocPara> m_paragraphs;
QList<DocNode> m_params;
DocParamSect::Type m_type;
DocParamSect::Direction m_dir;
......@@ -1078,6 +1085,7 @@ class DocHtmlListItem : public CompAccept<DocHtmlListItem>, public DocNode
DocNode *parent() const { return m_parent; }
void accept(DocVisitor *v) { CompAccept<DocHtmlListItem>::accept(this,v); }
int parse();
int parseXml();
private:
DocNode * m_parent;
......
......@@ -57,7 +57,8 @@ enum Tokens
RetVal_TableHCell = 0x1000E,
RetVal_EndTable = 0x1000F,
RetVal_Internal = 0x10010,
RetVal_SwitchLang = 0x10011
RetVal_SwitchLang = 0x10011,
RetVal_CloseXml = 0x10012
};
struct TokenInfo
......@@ -92,6 +93,7 @@ struct TokenInfo
// html tag
HtmlAttribList attribs;
bool endTag;
bool emptyTag;
// whitespace
QString chars;
......@@ -124,6 +126,7 @@ void doctokenizerYYsetStatePara();
void doctokenizerYYsetStateTitle();
void doctokenizerYYsetStateTitleAttrValue();
void doctokenizerYYsetStateCode();
void doctokenizerYYsetStateXmlCode();
void doctokenizerYYsetStateHtmlOnly();
void doctokenizerYYsetStateManOnly();
void doctokenizerYYsetStateLatexOnly();
......
......@@ -136,72 +136,6 @@ static int computeIndent(const char *str,int length)
return indent;
}
/*! converts input string \a opt into a list of Html Attributes. Each
* attribute is a name, value pair. The result is stored in g_token->attribs
*/
static void parseHtmlAttribs(const char *att)
{
//printf("parseHtmlAttribs(%s)\n",att);
QCString attribs=att;
int len = attribs.length();
char c;
int i=0,startName,endName,startAttrib,endAttrib;
while (i<len)
{
c=attribs.at(i);
// skip spaces
while (i<len && c==' ') { c=attribs.at(++i); }
startName=i;
// search for end of name
while (i<len && c!=' ' && c!='=') { c=attribs.at(++i); }
endName=i;
HtmlAttrib opt;
opt.name = attribs.mid(startName,endName-startName).lower();
// skip spaces
while (i<len && c==' ') { c=attribs.at(++i); }
if (attribs.at(i)=='=') // option has value
{
c=attribs.at(++i);
// skip spaces
while (i<len && c==' ') { c=attribs.at(++i); }
if (attribs.at(i)=='\'') // option '...'
{
c=attribs.at(++i);
startAttrib=i;
// search for matching quote
while (i<len && c!='\'') { c=attribs.at(++i); }
endAttrib=i;
if (i<len) c=attribs.at(++i);
}
else if (attribs.at(i)=='"') // option "..."
{
c=attribs.at(++i);
startAttrib=i;
// search for matching quote
while (i<len && c!='"') { c=attribs.at(++i); }
endAttrib=i;
if (i<len) c=attribs.at(++i);
}
else // value without any quotes
{
startAttrib=i;
// search for separator
while (i<len && c!=' ') { c=attribs.at(++i); }
endAttrib=i;
if (i<len) c=attribs.at(++i);
}
opt.value = attribs.mid(startAttrib,endAttrib-startAttrib);
}
else // start next option
{
}
//printf("=====> Adding option name=<%s> value=<%s>\n",
// opt.name.data(),opt.value.data());
g_token->attribs.append(&opt);
}
}
//--------------------------------------------------------------------------
static void processSection()
......@@ -231,27 +165,96 @@ static void processSection()
static void handleHtmlTag()
{
g_token->name = yytext;
QCString tagText=yytext;
g_token->attribs.clear();
g_token->endTag = FALSE;
g_token->emptyTag = FALSE;
// Check for end tag
int startNamePos=1;
if (g_token->name.at(1)=='/') startNamePos++;
int attSep=0;
while (attSep<yyleng && !isspace(yytext[attSep]))
if (tagText.at(1)=='/')
{
attSep++;
g_token->endTag = TRUE;
startNamePos++;
}
if (attSep!=yyleng) // tag has one or more options
// Parse the name portion
int i = startNamePos;
for (i=startNamePos; i < yyleng; i++)
{
parseHtmlAttribs(g_token->name.mid(attSep+1,g_token->name.length()-attSep-2));
g_token->name=g_token->name.mid(startNamePos,attSep-1).lower();
// Check for valid HTML/XML name chars (including namespaces)
char c = tagText.at(i);
if (!(isalnum(c) || c=='-' || c=='_' || c==':')) break;
}
else // tag without options, strip brackets
g_token->name = tagText.mid(startNamePos,i-startNamePos);
// Parse the attributes. Each attribute is a name, value pair
// The result is stored in g_token->attribs.
int startName,endName,startAttrib,endAttrib;
while (i<yyleng)
{
g_token->name=g_token->name.mid(startNamePos,g_token->name.length()-startNamePos-1).lower();
char c=tagText.at(i);
// skip spaces
while (i<yyleng && c==' ') { c=tagText.at(++i); }
// check for end of the tag
if (c == '>') break;
// Check for XML style "empty" tag.
if (c == '/')
{
g_token->emptyTag = TRUE;
break;
}
startName=i;
// search for end of name
while (i<yyleng && c!=' ' && c!='=') { c=tagText.at(++i); }
endName=i;
HtmlAttrib opt;
opt.name = tagText.mid(startName,endName-startName).lower();
// skip spaces
while (i<yyleng && c==' ') { c=tagText.at(++i); }
if (tagText.at(i)=='=') // option has value
{
c=tagText.at(++i);
// skip spaces
while (i<yyleng && c==' ') { c=tagText.at(++i); }
if (tagText.at(i)=='\'') // option '...'
{
c=tagText.at(++i);
startAttrib=i;
// search for matching quote
while (i<yyleng && c!='\'') { c=tagText.at(++i); }
endAttrib=i;
if (i<yyleng) c=tagText.at(++i);
}
else if (tagText.at(i)=='"') // option "..."
{
c=tagText.at(++i);
startAttrib=i;
// search for matching quote
while (i<yyleng && c!='"') { c=tagText.at(++i); }
endAttrib=i;
if (i<yyleng) c=tagText.at(++i);
}
else // value without any quotes
{
startAttrib=i;
// search for separator
while (i<yyleng && c!=' ') { c=tagText.at(++i); }
endAttrib=i;
if (i<yyleng) c=tagText.at(++i);
}
opt.value = tagText.mid(startAttrib,endAttrib-startAttrib);
}
else // start next option
{
}
//printf("=====> Adding option name=<%s> value=<%s>\n",
// opt.name.data(),opt.value.data());
g_token->attribs.append(&opt);
}
g_token->endTag = startNamePos==2;
}
static QString stripEmptyLines(const char *s)
{
int result=0,p=0;
......@@ -287,6 +290,7 @@ WS [ \t\r\n]
NONWS [^ \t\r\n]
BLANK [ \t\r]
ID [a-z_A-Z][a-z_A-Z0-9]*
MAILADR [a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+
OPTSTARS ("//"{BLANK}*)?"*"*{BLANK}*
LISTITEM {BLANK}*{OPTSTARS}"-"("#")?{WS}
ENDLIST {BLANK}*{OPTSTARS}"."{BLANK}*\n
......@@ -326,7 +330,7 @@ WORD1 "%"?{CHARWORD}+|"{"|"}"|("\""[^"\n]*"\"")
WORD2 "."|","|"("|")"|"["|"]"|":"|";"|"\?"
WORD1NQ "%"?{CHARWORDQ}+
WORD2NQ "."|","|"("|")"|"["|"]"|":"|";"|"\?"
HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*{WS}*">"
HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*{WS}*(("/")?)">"
HTMLKEYL "strong"|"center"|"table"|"caption"|"small"|"code"|"dfn"|"var"|"img"|"pre"|"sub"|"sup"|"tr"|"td"|"th"|"ol"|"ul"|"li"|"tt"|"kbd"|"em"|"hr"|"dl"|"dt"|"dd"|"br"|"i"|"a"|"b"|"p"
HTMLKEYU "STRONG"|"CENTER"|"TABLE"|"CAPTION"|"SMALL"|"CODE"|"DFN"|"VAR"|"IMG"|"PRE"|"SUB"|"SUP"|"TR"|"TD"|"TH"|"OL"|"UL"|"LI"|"TT"|"KBD"|"EM"|"HR"|"DL"|"DT"|"DD"|"BR"|"I"|"A"|"B"|"P"
HTMLKEYW {HTMLKEYL}|{HTMLKEYU}
......@@ -344,6 +348,7 @@ REFWORD ("#"|"::")?({ID}("."|"#"|"::"|"-"))*({ID}(":")?){FUNCARG}?
%x St_TitleA
%x St_TitleV
%x St_Code
%x St_XmlCode
%x St_HtmlOnly
%x St_ManOnly
%x St_LatexOnly
......@@ -445,7 +450,7 @@ REFWORD ("#"|"::")?({ID}("."|"#"|"::"|"-"))*({ID}(":")?){FUNCARG}?
g_token->isEMailAddr=FALSE;
return TK_URL;
}
<St_Para>[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+ { // Mail address
<St_Para>{MAILADR} { // Mail address
g_token->name=yytext;
g_token->isEMailAddr=TRUE;
return TK_URL;
......@@ -539,9 +544,12 @@ REFWORD ("#"|"::")?({ID}("."|"#"|"::"|"-"))*({ID}(":")?){FUNCARG}?
<St_Code>{WS}*{CMD}"endcode" {
return RetVal_OK;
}
<St_Code>[^\\@\n]+ |
<St_Code>\n |
<St_Code>. {
<St_XmlCode>{WS}*"</code>" {
return RetVal_OK;
}
<St_Code,St_XmlCode>[^\\@\n]+ |
<St_Code,St_XmlCode>\n |
<St_Code,St_XmlCode>. {
g_token->verb+=yytext;
}
<St_HtmlOnly>{CMD}"endhtmlonly" {
......@@ -942,6 +950,12 @@ void doctokenizerYYsetStateCode()
BEGIN(St_Code);
}
void doctokenizerYYsetStateXmlCode()
{
g_token->verb="";
BEGIN(St_XmlCode);
}
void doctokenizerYYsetStateHtmlOnly()
{
g_token->verb="";
......
......@@ -24,7 +24,6 @@
#include "util.h"
#include "config.h"
#include "language.h"
#include "scanner.h"
#include "defargs.h"
#include "docparser.h"
#include "debug.h"
......
......@@ -36,7 +36,6 @@
#include "logos.h"
#include "instdox.h"
#include "message.h"
#include "code.h"
#include "config.h"
#include "util.h"
#include "pre.h"
......@@ -67,6 +66,7 @@
#include "searchindex.h"
#include "parserintf.h"
#include "htags.h"
#include "pyscanner.h"
#if defined(_MSC_VER) || defined(__BORLANDC__)
#define popen _popen
......@@ -125,6 +125,7 @@ QDict<int> * Doxygen::htmlDirMap = 0;
QCache<LookupInfo> Doxygen::lookupCache(20000,20000);
DirSDict Doxygen::directories(17);
SDict<DirRelation> Doxygen::dirRelations(257);
ParserManager *Doxygen::parserManager = 0;
static StringList inputFiles;
static StringDict excludeNameDict(1009); // sections
......@@ -7310,60 +7311,8 @@ static void copyStyleSheet()
}
}
#if 0
static void readFiles(const QCString &tmpFile)
{
QFile outFile(tmpFile);
if (outFile.open(IO_WriteOnly))
{
QTextStream out(&outFile);
QCString *s=inputFiles.first();
while (s)
{
QCString fileName=*s;
//bool multiLineIsBrief = Config_getBool("MULTILINE_CPP_IS_BRIEF");
out << (char)6;
out << fileName;
out << (char)6;
out << '\n';
QFileInfo fi(fileName);
BufStr preBuf(fi.size()+4096);
BufStr *bufPtr = &preBuf;
if (Config_getBool("ENABLE_PREPROCESSING"))
{
msg("Preprocessing %s...\n",s->data());
preprocessFile(fileName,*bufPtr);
}
else
{
msg("Reading %s...\n",s->data());
copyAndFilterFile(fileName,*bufPtr);
}
bufPtr->addChar('\n'); /* to prevent problems under Windows ? */
BufStr convBuf(bufPtr->curPos()+1024);
convertCppComments(&preBuf,&convBuf,fileName);
out.writeRawBytes(convBuf.data(),convBuf.curPos());
s=inputFiles.next();
//printf("-------> adding new line\n");
}
}
}
#endif
static void parseFiles(Entry *root)
{
ParserInterface *defaultParser = new CLanguageScanner;
ParserManager *parserManager = new ParserManager(defaultParser);
// register any additional parsers here...
QCString *s=inputFiles.first();
while (s)
......@@ -7372,12 +7321,14 @@ static void parseFiles(Entry *root)
QCString extension;
int ei = fileName.findRev('.');
if (ei!=-1) extension=fileName.right(fileName.length()-ei);
ParserInterface *parser = Doxygen::parserManager->getParser(extension);
QFileInfo fi(fileName);
BufStr preBuf(fi.size()+4096);
BufStr *bufPtr = &preBuf;
if (Config_getBool("ENABLE_PREPROCESSING"))
if (Config_getBool("ENABLE_PREPROCESSING") &&
parser->needsPreprocessing(extension))
{
msg("Preprocessing %s...\n",s->data());
preprocessFile(fileName,*bufPtr);
......@@ -7396,8 +7347,7 @@ static void parseFiles(Entry *root)
convBuf.addChar('\0');
ParserInterface *parser = parserManager->getParser(extension);
parser->parse(fileName,convBuf.data(),root);
parser->parseInput(fileName,convBuf.data(),root);
s=inputFiles.next();
}
......@@ -7792,6 +7742,12 @@ void initDoxygen()
Doxygen::runningTime.start();
initPreprocessor();
ParserInterface *defaultParser = new CLanguageScanner;
Doxygen::parserManager = new ParserManager(defaultParser);
Doxygen::parserManager->registerParser(".py",new PythonLanguageScanner);
// register any additional parsers here...
Doxygen::sectionDict.setAutoDelete(TRUE);
Doxygen::inputNameList.setAutoDelete(TRUE);
Doxygen::memberNameSDict.setAutoDelete(TRUE);
......@@ -7820,13 +7776,13 @@ void cleanUpDoxygen()
delete Doxygen::exampleSDict;
delete Doxygen::globalScope;
delete Doxygen::xrefLists;
delete Doxygen::parserManager;
cleanUpPreprocessor();
Config::deleteInstance();
QTextCodec::deleteAllCodecs();
delete theTranslator;
delete outputList;
CmdMapper::freeInstance();
HtmlTagMapper::freeInstance();
Mappers::freeMappers();
//delete Doxygen::symbolMap; <- we cannot do this unless all static lists
// (such as Doxygen::namespaceSDict)
// with objects based on Definition are made
......
......@@ -42,6 +42,7 @@ class PageSDict;
class PageDef;
class SearchIndex;
class DirDef;
class ParserManager;
typedef QList<QCString> StringList;
typedef QDict<FileDef> FileDict;
......@@ -116,6 +117,7 @@ class Doxygen
static QCache<LookupInfo> lookupCache;
static DirSDict directories;
static SDict<DirRelation> dirRelations;
static ParserManager *parserManager;
};
void initDoxygen();
......
......@@ -28,18 +28,18 @@
#include "outputlist.h"
#include "dot.h"
#include "message.h"
#include "code.h"
#include "docparser.h"
#include "ftvhelp.h"
#include "searchindex.h"
#include "htags.h"
#include "parserintf.h"
#if defined(_MSC_VER) || defined(__BORLANDC__)
#define popen _popen
#define pclose _pclose
#endif
class DevNullCodeDocInterface : public BaseCodeDocInterface
class DevNullCodeDocInterface : public CodeOutputInterface
{
public:
virtual void codify(const char *) {}
......@@ -653,9 +653,10 @@ void FileDef::writeSource(OutputList &ol)
ol.endTextLink();
}
initParseCodeContext();
ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension());
pIntf->resetCodeParserState();
ol.startCodeFragment();
parseCode(ol,0,
pIntf->parseCode(ol,0,
fileToString(absFilePath(),Config_getBool("FILTER_SOURCE_FILES")),
FALSE,0,this
);
......@@ -667,7 +668,10 @@ void FileDef::writeSource(OutputList &ol)
void FileDef::parseSource()
{
DevNullCodeDocInterface devNullIntf;
parseCode(devNullIntf,0,
ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension());
pIntf->resetCodeParserState();
pIntf->parseCode(
devNullIntf,0,
fileToString(absFilePath(),Config_getBool("FILTER_SOURCE_FILES")),
FALSE,0,this
);
......
......@@ -22,11 +22,11 @@
#include "language.h"
#include "doxygen.h"
#include "outputgen.h"
#include "code.h"
#include "dot.h"
#include "message.h"
#include "config.h"
#include "htmlgen.h"
#include "parserintf.h"
static const int NUM_HTML_LIST_TYPES = 4;
......@@ -49,8 +49,10 @@ static QString htmlAttribsToString(const HtmlAttribList &attribs)
//-------------------------------------------------------------------------
HtmlDocVisitor::HtmlDocVisitor(QTextStream &t,BaseCodeDocInterface &ci)
: DocVisitor(DocVisitor_Html), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
HtmlDocVisitor::HtmlDocVisitor(QTextStream &t,CodeOutputInterface &ci,
const char *langExt)
: DocVisitor(DocVisitor_Html), m_t(t), m_ci(ci), m_insidePre(FALSE),
m_hide(FALSE), m_langExt(langExt)
{
}
......@@ -196,7 +198,9 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
{
case DocVerbatim::Code: // fall though
m_t << PREFRAG_START;
parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile());
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,s->context(),s->text().latin1(),
s->isExample(),s->exampleFile());
m_t << PREFRAG_END;
break;
case DocVerbatim::Verbatim:
......@@ -253,7 +257,9 @@ void HtmlDocVisitor::visit(DocInclude *inc)
{
case DocInclude::Include:
m_t << PREFRAG_START;
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile());
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,inc->context(),inc->text().latin1(),
inc->isExample(),inc->exampleFile());
m_t << PREFRAG_END;
break;
case DocInclude::IncWithLines:
......@@ -261,7 +267,11 @@ void HtmlDocVisitor::visit(DocInclude *inc)
m_t << PREFRAG_START;
QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() );
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile(), &fd);
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,inc->context(),
inc->text().latin1(),
inc->isExample(),
inc->exampleFile(), &fd);
m_t << PREFRAG_END;
}
break;
......@@ -291,7 +301,13 @@ void HtmlDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
if (!m_hide) parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile());
if (!m_hide)
{
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,op->context(),
op->text().latin1(),op->isExample(),
op->exampleFile());
}
pushEnabled();
m_hide=TRUE;
}
......
......@@ -21,16 +21,17 @@
#include "docvisitor.h"
#include <qstack.h>
#include <qcstring.h>
class QTextStream;
class BaseCodeDocInterface;
class CodeOutputInterface;
class QString;
/*! @brief Concrete visitor implementation for HTML output. */
class HtmlDocVisitor : public DocVisitor
{
public:
HtmlDocVisitor(QTextStream &t,BaseCodeDocInterface &ci);
HtmlDocVisitor(QTextStream &t,CodeOutputInterface &ci,const char *langExt);
//--------------------------------------
// visitor functions for leaf nodes
......@@ -77,8 +78,6 @@ class HtmlDocVisitor : public DocVisitor
void visitPost(DocHtmlList *) ;
void visitPre(DocHtmlListItem *);
void visitPost(DocHtmlListItem *);
//void visitPre(DocHtmlPre *);
//void visitPost(DocHtmlPre *);
void visitPre(DocHtmlDescList *);
void visitPost(DocHtmlDescList *);
void visitPre(DocHtmlDescTitle *);
......@@ -111,8 +110,6 @@ class HtmlDocVisitor : public DocVisitor
void visitPost(DocSecRefItem *);
void visitPre(DocSecRefList *);
void visitPost(DocSecRefList *);
//void visitPre(DocLanguage *);
//void visitPost(DocLanguage *);
void visitPre(DocParamSect *);
void visitPost(DocParamSect *);
void visitPre(DocParamList *);
......@@ -147,10 +144,11 @@ class HtmlDocVisitor : public DocVisitor
//--------------------------------------
QTextStream &m_t;
BaseCodeDocInterface &m_ci;
CodeOutputInterface &m_ci;
bool m_insidePre;
bool m_hide;
QStack<bool> m_enabled;
QCString m_langExt;
};
#endif
......@@ -1418,9 +1418,9 @@ void HtmlGenerator::endParamList()
t << "</dl>";
}
void HtmlGenerator::printDoc(DocNode *n)
void HtmlGenerator::printDoc(DocNode *n,const char *langExt)
{
HtmlDocVisitor *visitor = new HtmlDocVisitor(t,*this);
HtmlDocVisitor *visitor = new HtmlDocVisitor(t,*this,langExt);
n->accept(visitor);
delete visitor;
}
......
......@@ -45,7 +45,7 @@ class HtmlGenerator : public OutputGenerator
bool isEnabled(OutputType o) { return (o==Html && active); }
OutputGenerator *get(OutputType o) { return (o==Html) ? this : 0; }
void printDoc(DocNode *);
void printDoc(DocNode *,const char *);
void startFile(const char *name,const char *manName,const char *title);
void writeFooter();
......
......@@ -25,7 +25,6 @@
#include "message.h"
#include "index.h"
#include "doxygen.h"
#include "code.h"
#include "config.h"
#include "filedef.h"
#include "outputlist.h"
......
......@@ -21,10 +21,10 @@
#include "language.h"
#include "doxygen.h"
#include "outputgen.h"
#include "code.h"
#include "dot.h"
#include "util.h"
#include "message.h"
#include "parserintf.h"
static QString escapeLabelName(const char *s)
{
......@@ -79,10 +79,11 @@ QString LatexDocVisitor::escapeMakeIndexChars(const char *s)
}
LatexDocVisitor::LatexDocVisitor(QTextStream &t,BaseCodeDocInterface &ci,
bool insideTabbing)
LatexDocVisitor::LatexDocVisitor(QTextStream &t,CodeOutputInterface &ci,
const char *langExt,bool insideTabbing)
: DocVisitor(DocVisitor_Latex), m_t(t), m_ci(ci), m_insidePre(FALSE),
m_insideItem(FALSE), m_hide(FALSE), m_insideTabbing(insideTabbing)
m_insideItem(FALSE), m_hide(FALSE), m_insideTabbing(insideTabbing),
m_langExt(langExt)
{
}
......@@ -251,7 +252,9 @@ void LatexDocVisitor::visit(DocVerbatim *s)
{
case DocVerbatim::Code:
m_t << "\n\n\\footnotesize\\begin{verbatim}";
parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile());
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,s->context(),s->text().latin1(),
s->isExample(),s->exampleFile());
m_t << "\\end{verbatim}\n\\normalsize" << endl;
break;
case DocVerbatim::Verbatim:
......@@ -316,13 +319,20 @@ void LatexDocVisitor::visit(DocInclude *inc)
m_t << "\n\n\\footnotesize\\begin{verbatim}";
QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() );
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile(), &fd);
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,inc->context(),
inc->text().latin1(),
inc->isExample(),
inc->exampleFile(), &fd);
m_t << "\\end{verbatim}\n\\normalsize" << endl;
}
break;
case DocInclude::Include:
m_t << "\n\n\\footnotesize\\begin{verbatim}";
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile());
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,inc->context(),
inc->text().latin1(),inc->isExample(),
inc->exampleFile());
m_t << "\\end{verbatim}\n\\normalsize" << endl;
break;
case DocInclude::DontInclude:
......@@ -350,7 +360,12 @@ void LatexDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
if (!m_hide) parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile());
if (!m_hide)
{
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,op->context(),op->text().latin1(),
op->isExample(),op->exampleFile());
}
pushEnabled();
m_hide=TRUE;
}
......
......@@ -21,16 +21,18 @@
#include "docvisitor.h"
#include <qstack.h>
#include <qcstring.h>
class QTextStream;
class BaseCodeDocInterface;
class CodeOutputInterface;
class QString;
/*! @brief Concrete visitor implementation for LaTeX output. */
class LatexDocVisitor : public DocVisitor
{
public:
LatexDocVisitor(QTextStream &t,BaseCodeDocInterface &ci,bool insideTabbing);
LatexDocVisitor(QTextStream &t,CodeOutputInterface &ci,
const char *langExt,bool insideTabbing);
//--------------------------------------
// visitor functions for leaf nodes
......@@ -150,12 +152,13 @@ class LatexDocVisitor : public DocVisitor
//--------------------------------------
QTextStream &m_t;
BaseCodeDocInterface &m_ci;
CodeOutputInterface &m_ci;
bool m_insidePre;
bool m_insideItem;
bool m_hide;
bool m_insideTabbing;
QStack<bool> m_enabled;
QCString m_langExt;
};
#endif
......@@ -1542,9 +1542,9 @@ void LatexGenerator::endParamList()
}
void LatexGenerator::printDoc(DocNode *n)
void LatexGenerator::printDoc(DocNode *n,const char *langExt)
{
LatexDocVisitor *visitor = new LatexDocVisitor(t,*this,insideTabbing);
LatexDocVisitor *visitor = new LatexDocVisitor(t,*this,langExt,insideTabbing);
n->accept(visitor);
delete visitor;
}
......
......@@ -43,7 +43,7 @@ class LatexGenerator : public OutputGenerator
bool isEnabled(OutputType o) { return (o==Latex && active); }
OutputGenerator *get(OutputType o) { return (o==Latex) ? this : 0; }
void printDoc(DocNode *);
void printDoc(DocNode *,const char *);
void startFile(const char *name,const char *manName,const char *title);
void writeFooter() {}
......
......@@ -75,6 +75,8 @@ HEADERS = bufstr.h \
pngenc.h \
pre.h \
printdocvisitor.h \
pycode.h \
pyscanner.h \
qtbc.h \
reflist.h \
rtfdocvisitor.h \
......@@ -176,6 +178,8 @@ SOURCES = ce_lex.cpp \
perlmodgen.cpp \
pngenc.cpp \
pre.cpp \
pycode.cpp \
pyscanner.cpp \
reflist.cpp \
rtfdocvisitor.cpp \
rtfgen.cpp \
......
......@@ -51,6 +51,12 @@ sub GenerateDep {
#$ GenerateDep("code.cpp","code.l");
$(LEX) -PcodeYY -t code.l | $(INCBUFSIZE) >code.cpp
#$ GenerateDep("pyscanner.cpp","pyscanner.l");
$(LEX) -PpyscanYY -t pyscanner.l | $(INCBUFSIZE) >pyscanner.cpp
#$ GenerateDep("pycode.cpp","pycode.l");
$(LEX) -PpycodeYY -t pycode.l | $(INCBUFSIZE) >pycode.cpp
#$ GenerateDep("pre.cpp","pre.l");
$(LEX) -PpreYY -t pre.l | $(INCBUFSIZE) >pre.cpp
......
......@@ -26,10 +26,12 @@
#include "util.h"
#include "message.h"
#include <qfileinfo.h>
#include "parserintf.h"
ManDocVisitor::ManDocVisitor(QTextStream &t,BaseCodeDocInterface &ci)
ManDocVisitor::ManDocVisitor(QTextStream &t,CodeOutputInterface &ci,
const char *langExt)
: DocVisitor(DocVisitor_Man), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_firstCol(TRUE),
m_indent(0)
m_indent(0), m_langExt(langExt)
{
}
......@@ -186,7 +188,9 @@ void ManDocVisitor::visit(DocVerbatim *s)
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile());
Doxygen::parserManager->getParser(0/*TODO*/)
->parseCode(m_ci,s->context(),s->text().latin1(),
s->isExample(),s->exampleFile());
if (!m_firstCol) m_t << endl;
m_t << ".fi" << endl;
m_t << ".PP" << endl;
......@@ -231,7 +235,11 @@ void ManDocVisitor::visit(DocInclude *inc)
m_t << ".nf" << endl;
QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() );
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile(), &fd);
Doxygen::parserManager->getParser(0/*TODO*/)
->parseCode(m_ci,inc->context(),
inc->text().latin1(),
inc->isExample(),
inc->exampleFile(), &fd);
if (!m_firstCol) m_t << endl;
m_t << ".fi" << endl;
m_t << ".PP" << endl;
......@@ -242,7 +250,10 @@ void ManDocVisitor::visit(DocInclude *inc)
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile());
Doxygen::parserManager->getParser(0/*TODO*/)
->parseCode(m_ci,inc->context(),
inc->text().latin1(),inc->isExample(),
inc->exampleFile());
if (!m_firstCol) m_t << endl;
m_t << ".fi" << endl;
m_t << ".PP" << endl;
......@@ -283,7 +294,12 @@ void ManDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
if (!m_hide) parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile());
if (!m_hide)
{
Doxygen::parserManager->getParser(0/*TODO*/)
->parseCode(m_ci,op->context(),op->text().latin1(),
op->isExample(),op->exampleFile());
}
pushEnabled();
m_hide=TRUE;
}
......
......@@ -21,16 +21,17 @@
#include "docvisitor.h"
#include <qstack.h>
#include <qcstring.h>
class QTextStream;
class BaseCodeDocInterface;
class CodeOutputInterface;
class QString;
/*! @brief Concrete visitor implementation for LaTeX output. */
class ManDocVisitor : public DocVisitor
{
public:
ManDocVisitor(QTextStream &t,BaseCodeDocInterface &ci);
ManDocVisitor(QTextStream &t,CodeOutputInterface &ci,const char *langExt);
//--------------------------------------
// visitor functions for leaf nodes
......@@ -142,12 +143,13 @@ class ManDocVisitor : public DocVisitor
//--------------------------------------
QTextStream &m_t;
BaseCodeDocInterface &m_ci;
CodeOutputInterface &m_ci;
bool m_insidePre;
bool m_hide;
bool m_firstCol;
int m_indent;
QStack<bool> m_enabled;
QCString m_langExt;
};
#endif
......@@ -627,9 +627,9 @@ void ManGenerator::endParamList()
{
}
void ManGenerator::printDoc(DocNode *n)
void ManGenerator::printDoc(DocNode *n,const char *langExt)
{
ManDocVisitor *visitor = new ManDocVisitor(t,*this);
ManDocVisitor *visitor = new ManDocVisitor(t,*this,langExt);
n->accept(visitor);
delete visitor;
firstCol=FALSE;
......
......@@ -40,7 +40,7 @@ class ManGenerator : public OutputGenerator
bool isEnabled(OutputType o) { return (o==Man && active); }
OutputGenerator *get(OutputType o) { return (o==Man) ? this : 0; }
void printDoc(DocNode *);
void printDoc(DocNode *,const char *);
static void init();
void startFile(const char *name,const char *manName,const char *title);
......
......@@ -33,6 +33,7 @@
#include "docparser.h"
#include "dot.h"
#include "searchindex.h"
#include "parserintf.h"
//-----------------------------------------------------------------------------
......@@ -1577,9 +1578,10 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
else
ol.parseText(theTranslator->trInitialValue());
ol.endBold();
initParseCodeContext();
ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension());
pIntf->resetCodeParserState();
ol.startCodeFragment();
parseCode(ol,scopeName,init,FALSE,0);
pIntf->parseCode(ol,scopeName,init,FALSE,0);
ol.endCodeFragment();
}
......
......@@ -24,7 +24,6 @@
#include "namespacedef.h"
#include "filedef.h"
#include "language.h"
#include "scanner.h"
#include "groupdef.h"
#include "doxygen.h"
#include "docparser.h"
......
......@@ -39,7 +39,7 @@ class GroupDef;
/*! \brief Output interface for code parser.
*/
class BaseCodeDocInterface
class CodeOutputInterface
{
public:
/*! Writes an ASCII string to the output. This function should keep
......@@ -78,7 +78,7 @@ class BaseCodeDocInterface
* or a list of formats (see OutputList). This interface
* contains functions that generate fragments of the output.
*/
class BaseOutputDocInterface : public BaseCodeDocInterface
class BaseOutputDocInterface : public CodeOutputInterface
{
public:
enum ParamListTypes { Param, RetVal, Exception };
......@@ -272,7 +272,7 @@ class OutputGenerator : public BaseOutputDocInterface
void pushGeneratorState();
void popGeneratorState();
virtual void printDoc(DocNode *) = 0;
virtual void printDoc(DocNode *,const char *langExt) = 0;
///////////////////////////////////////////////////////////////
// structural output interface
......
......@@ -26,6 +26,7 @@
#include "outputgen.h"
#include "config.h"
#include "message.h"
#include "definition.h"
#include "docparser.h"
......@@ -163,7 +164,9 @@ void OutputList::parseDoc(const char *fileName,int startLine,
og=outputs->first();
while (og)
{
if (og->isEnabled()) og->printDoc(root);
//printf("og->printDoc(extension=%s)\n",
// ctx?ctx->getDefFileExtension().data():"<null>");
if (og->isEnabled()) og->printDoc(root,ctx?ctx->getDefFileExtension():0);
og=outputs->next();
}
......@@ -186,7 +189,7 @@ void OutputList::parseText(const QCString &textStr)
og=outputs->first();
while (og)
{
if (og->isEnabled()) og->printDoc(root);
if (og->isEnabled()) og->printDoc(root,0);
og=outputs->next();
}
......
......@@ -21,6 +21,9 @@
#include <qdict.h>
class Entry;
class FileDef;
class CodeOutputInterface;
class MemberDef;
/** \brief Abstract interface for programming language parsers.
*
......@@ -31,13 +34,58 @@ class Entry;
class ParserInterface
{
public:
/** Parses a single file.
/** Parses a single input file with the goal to build an Entry tree.
* @param[in] fileName The full name of the file.
* @param[in] fileBuf The contents of the file (zero terminated).
* @param[in,out] root The root of the tree of Entry *nodes
* representing the information extracted from the file.
*/
virtual void parse(const char *fileName,const char *fileBuf,Entry *root) = 0;
virtual void parseInput(const char *fileName,
const char *fileBuf,
Entry *root) = 0;
/** Returns TRUE if the language identified by \a extension needs
* the C preprocessor to be run before feed the result to the input
* parser.
* @see parseInput()
*/
virtual bool needsPreprocessing(const QCString &extension) = 0;
/** 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] 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.
* @param[in] exampleName Name of the example.
* @param[in] fileDef File definition to which the code
* is associated.
* @param[in] startLine Starting line in case of a code fragment.
* @param[in] endLine Ending line of the code fragment.
* @param[in] inlineFragment Code fragment that is to be shown inline
* as part of the documentation.
* @param[in] memberDef Member definition to which the code
* is associated (non null in case of an inline fragment
* for a member).
*/
virtual void parseCode(CodeOutputInterface &codeOutIntf,
const char *scopeName,
const QCString &input,
bool isExampleBlock,
const char *exampleName=0,
FileDef *fileDef=0,
int startLine=-1,
int endLine=-1,
bool inlineFragment=FALSE,
MemberDef *memberDef=0
) = 0;
/** Resets the state of the code parser.
* Since multiple code fragments can together form a single example, an
* explicit function is used to reset the code parser state.
* @see parseCode()
*/
virtual void resetCodeParserState() = 0;
/** Callback function called by the comment block scanner.
* It provides a string \a text containing the prototype of a function
......@@ -60,6 +108,8 @@ class ParserInterface
virtual void handleGroupEndCommand() = 0;
};
//-----------------------------------------------------------------------------
/** \brief Manages programming language parsers.
*
* This class manages the language parsers in the system. One can
......@@ -70,13 +120,13 @@ class ParserManager
public:
/** Creates the parser manager object.
* @param defaultParser The default parser that is used when
* no explicit extension has been register for
* no explicit extension has been registered for
* a given input file.
*/
ParserManager(ParserInterface *defaultParser)
: m_defaultParser(defaultParser) {}
/** Registers a new parser.
/** Registers an additional parser.
* @param[in] extension The file extension that will trigger
* the use of this parser (e.g. ".py", or ".bas").
* @param[in] parser The parser that is to be used for the
......@@ -87,8 +137,8 @@ class ParserManager
m_parsers.insert(extension,parser);
}
/** Gets the interface to the parser associated with given \a extension,
* if there is no parser explicitly registered for the supplied extension,
/** Gets the interface to the parser associated with given \a extension.
* If there is no parser explicitly registered for the supplied extension,
* the interface to the default parser will be returned.
*/
ParserInterface *getParser(const char *extension)
......
/******************************************************************************
*
*
*
* Copyright (C) 1997-2005 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
/* This code is based on the work done by the MoxyPyDoxy team
* (Linda Leong, Mike Rivera, Kim Truong, and Gabriel Estrada), executed
* as part of CS179e (Compiler design project) at the UC Riverside,
* under supervision of Peter H. Fröhlic.
*/
#ifndef PYCODE_H
#define PYCODE_H
#include "qtbc.h"
#include <stdio.h>
class CodeOutputInterface;
class FileDef;
class MemberDef;
extern void parsePythonCode(CodeOutputInterface &,const char *,const QCString &,
bool ,const char *,FileDef *fd=0,
int startLine=-1,int endLine=-1,bool inlineFragment=FALSE,
MemberDef *memberDef=0);
extern void resetPythonCodeParserState();
#endif
This diff is collapsed.
/******************************************************************************
*
*
*
* Copyright (C) 1997-2005 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
/* This code is based on the work done by the MoxyPyDoxy team
* (Linda Leong, Mike Rivera, Kim Truong, and Gabriel Estrada), executed
* as part of CS179e (Compiler design project) at the UC Riverside,
* under supervision of Peter H. Fröhlic.
*/
#ifndef PYSCANNER_H
#define PYSCANNER_H
#include "parserintf.h"
/** \brief Python Language parser using state-based lexical scanning.
*
* This is the Python language parser for doxygen.
*/
class PythonLanguageScanner : public ParserInterface
{
public:
void parseInput(const char * fileName,
const char *fileBuf,
Entry *root);
bool needsPreprocessing(const QCString &extension);
void parseCode(CodeOutputInterface &codeOutIntf,
const char *scopeName,
const QCString &input,
bool isExampleBlock,
const char *exampleName=0,
FileDef *fileDef=0,
int startLine=-1,
int endLine=-1,
bool inlineFragment=FALSE,
MemberDef *memberDef=0
);
void resetCodeParserState();
void parsePrototype(const char *text);
void handleGroupStartCommand(const char *header);
void handleGroupEndCommand();
};
#endif
This diff is collapsed.
......@@ -21,20 +21,21 @@
#include "language.h"
#include "doxygen.h"
#include "outputgen.h"
#include "code.h"
#include "dot.h"
#include "util.h"
#include "rtfstyle.h"
#include "message.h"
#include <qfileinfo.h>
#include "parserintf.h"
#define DBG_RTF(x) m_t << x
//#define DBG_RTF(x) do {} while(0)
RTFDocVisitor::RTFDocVisitor(QTextStream &t,BaseCodeDocInterface &ci)
RTFDocVisitor::RTFDocVisitor(QTextStream &t,CodeOutputInterface &ci,
const char *langExt)
: DocVisitor(DocVisitor_RTF), m_t(t), m_ci(ci), m_insidePre(FALSE),
m_hide(FALSE), m_indentLevel(0), m_lastIsPara(FALSE)
m_hide(FALSE), m_indentLevel(0), m_lastIsPara(FALSE), m_langExt(langExt)
{
}
......@@ -322,7 +323,9 @@ void RTFDocVisitor::visit(DocVerbatim *s)
m_t << "{" << endl;
m_t << "\\par" << endl;
m_t << rtf_Style_Reset << getStyle("CodeExample");
parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile());
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,s->context(),s->text().latin1(),
s->isExample(),s->exampleFile());
//m_t << "\\par" << endl;
m_t << "}" << endl;
break;
......@@ -401,7 +404,11 @@ void RTFDocVisitor::visit(DocInclude *inc)
m_t << rtf_Style_Reset << getStyle("CodeExample");
QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() );
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile(), &fd);
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,inc->context(),
inc->text().latin1(),
inc->isExample(),
inc->exampleFile(), &fd);
m_t << "\\par" << endl;
m_t << "}" << endl;
}
......@@ -410,7 +417,10 @@ void RTFDocVisitor::visit(DocInclude *inc)
m_t << "{" << endl;
m_t << "\\par" << endl;
m_t << rtf_Style_Reset << getStyle("CodeExample");
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile());
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,inc->context(),
inc->text().latin1(),inc->isExample(),
inc->exampleFile());
m_t << "\\par" << endl;
m_t << "}" << endl;
break;
......@@ -449,7 +459,12 @@ void RTFDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
if (!m_hide) parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile());
if (!m_hide)
{
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,op->context(),op->text().latin1(),
op->isExample(),op->exampleFile());
}
pushEnabled();
m_hide=TRUE;
}
......
......@@ -21,16 +21,17 @@
#include "docvisitor.h"
#include <qstack.h>
#include <qcstring.h>
class QTextStream;
class BaseCodeDocInterface;
class CodeOutputInterface;
class QString;
/*! @brief Concrete visitor implementation for RTF output. */
class RTFDocVisitor : public DocVisitor
{
public:
RTFDocVisitor(QTextStream &t,BaseCodeDocInterface &ci);
RTFDocVisitor(QTextStream &t,CodeOutputInterface &ci,const char *langExt);
//--------------------------------------
// visitor functions for leaf nodes
......@@ -149,12 +150,13 @@ class RTFDocVisitor : public DocVisitor
//--------------------------------------
QTextStream &m_t;
BaseCodeDocInterface &m_ci;
CodeOutputInterface &m_ci;
bool m_insidePre;
bool m_hide;
int m_indentLevel;
QStack<bool> m_enabled;
bool m_lastIsPara;
QCString m_langExt;
};
#endif
......@@ -2483,9 +2483,9 @@ void RTFGenerator::endParamList()
t << "}";
}
void RTFGenerator::printDoc(DocNode *n)
void RTFGenerator::printDoc(DocNode *n,const char *langExt)
{
RTFDocVisitor *visitor = new RTFDocVisitor(t,*this);
RTFDocVisitor *visitor = new RTFDocVisitor(t,*this,langExt);
n->accept(visitor);
delete visitor;
}
......
......@@ -43,7 +43,7 @@ class RTFGenerator : public OutputGenerator
bool isEnabled(OutputType o) { return (o==RTF && active); }
OutputGenerator *get(OutputType o) { return (o==RTF) ? this : 0; }
void printDoc(DocNode *);
void printDoc(DocNode *,const char *);
void startFile(const char *name,const char *manName,const char *title);
void writeFooter() {}
......
......@@ -24,32 +24,30 @@
*
* This is the language parser for doxygen. It is somewhat fuzzy and
* supports C++ and various languages that are closely related to C++,
* such as C,C#,Objective-C,Java,PHP,and IDL.
* such as C, C#, Objective-C, Java, PHP, and IDL.
*/
class CLanguageScanner : public ParserInterface
{
public:
void parse(const char *fileName,const char *fileBuf,Entry *root);
void parseInput(const char *fileName,
const char *fileBuf,
Entry *root);
bool needsPreprocessing(const QCString &extension);
void parseCode(CodeOutputInterface &codeOutIntf,
const char *scopeName,
const QCString &input,
bool isExampleBlock,
const char *exampleName=0,
FileDef *fileDef=0,
int startLine=-1,
int endLine=-1,
bool inlineFragment=FALSE,
MemberDef *memberDef=0
);
void resetCodeParserState();
void parsePrototype(const char *text);
void handleGroupStartCommand(const char *header);
void handleGroupEndCommand();
};
#if 0
#include "qtbc.h"
class OutputList;
class Entry;
// Public interface provided by the language scanner
void parseMain(Entry *,const char *fileName);
// Internal callback interface for comment block scanner
void parsePrototype(const QCString &text);
void handleGroupStartCommand(const char *header);
void handleGroupEndCommand();
#endif
#endif
......@@ -41,6 +41,7 @@
#include "defargs.h"
#include "language.h"
#include "commentscan.h"
#include "code.h"
#define YY_NEVER_INTERACTIVE 1
......@@ -1843,6 +1844,42 @@ IDLATTR ("["[^\]]*"]"){BN}*
handleGroupStartCommand(current->name);
current = tmp;
initEntry();
if (yytext[1]=='/')
{
if (yytext[2]=='!' || yytext[2]=='/')
{
docBlockContext = YY_START;
docBlockInBody = FALSE;
docBlockJavaStyle = FALSE;
docBlock.resize(0);
docBlockTerm = 0;
startCommentBlock(TRUE);
BEGIN(DocLine);
}
else
{
lastCContext=YY_START;
BEGIN(SkipCxxComment);
}
}
else
{
if (yytext[2]=='!' || yytext[2]=='*')
{
docBlockContext = YY_START;
docBlockInBody = FALSE;
docBlock.resize(0);
docBlockJavaStyle = yytext[2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF");
docBlockTerm = 0;
startCommentBlock(FALSE);
BEGIN(DocBlock);
}
else
{
lastCContext=YY_START;
BEGIN(SkipComment);
}
}
}
<FindMembers,FindFields,ReadInitializer>"//"([!/]?){B}*{CMD}"}".*|"/*"([!*]?){B}*{CMD}"}".*"*/" {
handleGroupEndCommand();
......@@ -4540,12 +4577,42 @@ static void handleGroupEndCommand()
//----------------------------------------------------------------------------
void CLanguageScanner::parse(const char *fileName,const char *fileBuf,Entry *root)
void CLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root)
{
g_thisParser = this;
::parseMain(fileName,fileBuf,root);
}
void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf,
const char * scopeName,
const QCString & input,
bool isExampleBlock,
const char * exampleName,
FileDef * fileDef,
int startLine,
int endLine,
bool inlineFragment,
MemberDef *memberDef
)
{
::parseCCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
fileDef,startLine,endLine,inlineFragment,memberDef);
}
bool CLanguageScanner::needsPreprocessing(const QCString &extension)
{
QCString fe=extension.lower();
return
!( fe==".java" || fe==".as" || fe==".cs" || fe==".d" || fe==".php" ||
fe==".php4" || fe==".inc" || fe==".phtml" || fe==".m" || fe==".mm"
);
}
void CLanguageScanner::resetCodeParserState()
{
::resetCCodeParserState();
}
void CLanguageScanner::parsePrototype(const char *text)
{
::parsePrototype(text);
......
......@@ -2698,6 +2698,8 @@ static QCString getCanonicalTypeForIdentifier(
symName=word;
}
//printf("symName=%s templSpec=%s\n",symName.data(),templSpec.data());
if (!symName.isEmpty() && !templSpec.isEmpty() &&
(defList=Doxygen::symbolMap->find(symName+templSpec)) &&
defList->count()==1) // word without scope but with template specs
......@@ -2733,6 +2735,10 @@ static QCString getCanonicalTypeForIdentifier(
if (cd) // known type
{
result = cd->qualifiedNameWithTemplateParameters();
if (cd->isTemplate())
{
*tSpec="";
}
}
else if (mType && mType->isEnumerate()) // an enum
{
......@@ -2799,15 +2805,15 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,const Argument *a
// then resolve any identifiers inside.
{
static QRegExp re("[a-z_A-Z][a-z_A-Z0-9]*");
int p=0,l,i;
int tp=0,tl,ti;
// for each identifier template specifier
while ((i=re.match(templSpec,p,&l))!=-1)
while ((ti=re.match(templSpec,tp,&tl))!=-1)
{
canType += templSpec.mid(p,i-p);
canType += getCanonicalTypeForIdentifier(d,fs,word,0);
p=i+l;
canType += templSpec.mid(tp,ti-tp);
canType += getCanonicalTypeForIdentifier(d,fs,templSpec.mid(ti,tl),0);
tp=ti+tl;
}
canType+=templSpec.right(templSpec.length()-p);
canType+=templSpec.right(templSpec.length()-tp);
}
pp=p;
......
......@@ -22,13 +22,13 @@
#include "doxygen.h"
#include "outputgen.h"
#include "xmlgen.h"
#include "code.h"
#include "dot.h"
#include "message.h"
#include "util.h"
#include <qfileinfo.h>
#include "parserintf.h"
XmlDocVisitor::XmlDocVisitor(QTextStream &t,BaseCodeDocInterface &ci)
XmlDocVisitor::XmlDocVisitor(QTextStream &t,CodeOutputInterface &ci)
: DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
{
}
......@@ -169,7 +169,9 @@ void XmlDocVisitor::visit(DocVerbatim *s)
{
case DocVerbatim::Code: // fall though
m_t << "<programlisting>";
parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile());
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,s->context(),s->text().latin1(),
s->isExample(),s->exampleFile());
m_t << "</programlisting>";
break;
case DocVerbatim::Verbatim:
......@@ -219,13 +221,21 @@ void XmlDocVisitor::visit(DocInclude *inc)
m_t << "<programlisting>";
QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() );
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile(), &fd);
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,inc->context(),
inc->text().latin1(),
inc->isExample(),
inc->exampleFile(), &fd);
m_t << "</programlisting>";
}
break;
case DocInclude::Include:
m_t << "<programlisting>";
parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile());
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,inc->context(),
inc->text().latin1(),
inc->isExample(),
inc->exampleFile());
m_t << "</programlisting>";
break;
case DocInclude::DontInclude:
......@@ -259,7 +269,13 @@ void XmlDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
if (!m_hide) parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile());
if (!m_hide)
{
Doxygen::parserManager->getParser(m_langExt)
->parseCode(m_ci,op->context(),
op->text().latin1(),op->isExample(),
op->exampleFile());
}
pushEnabled();
m_hide=TRUE;
}
......
......@@ -21,16 +21,17 @@
#include "docvisitor.h"
#include <qstack.h>
#include <qcstring.h>
class QTextStream;
class BaseCodeDocInterface;
class CodeOutputInterface;
class QString;
/*! @brief Concrete visitor implementation for XML output. */
class XmlDocVisitor : public DocVisitor
{
public:
XmlDocVisitor(QTextStream &t,BaseCodeDocInterface &ci);
XmlDocVisitor(QTextStream &t,CodeOutputInterface &ci);
//--------------------------------------
// visitor functions for leaf nodes
......@@ -145,10 +146,11 @@ class XmlDocVisitor : public DocVisitor
//--------------------------------------
QTextStream &m_t;
BaseCodeDocInterface &m_ci;
CodeOutputInterface &m_ci;
bool m_insidePre;
bool m_hide;
QStack<bool> m_enabled;
QCString m_langExt;
};
#endif
......@@ -28,13 +28,13 @@
#include "defargs.h"
#include "outputgen.h"
#include "dot.h"
#include "code.h"
#include "pagedef.h"
#include "filename.h"
#include "version.h"
#include "xmldocvisitor.h"
#include "docparser.h"
#include "language.h"
#include "parserintf.h"
#include <qdir.h>
#include <qfile.h>
......@@ -222,7 +222,7 @@ template<class T> class ValStack
};
class XMLCodeGenerator : public BaseCodeDocInterface
class XMLCodeGenerator : public CodeOutputInterface
{
public:
......@@ -443,14 +443,15 @@ static void writeXMLDocBlock(QTextStream &t,
void writeXMLCodeBlock(QTextStream &t,FileDef *fd)
{
initParseCodeContext();
ParserInterface *pIntf=Doxygen::parserManager->getParser(fd->getDefFileExtension());
pIntf->resetCodeParserState();
XMLCodeGenerator *xmlGen = new XMLCodeGenerator(t);
parseCode(*xmlGen,
0,
fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES")),
FALSE,
0,
fd);
pIntf->parseCode(*xmlGen,
0,
fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES")),
FALSE,
0,
fd);
xmlGen->finish();
delete xmlGen;
}
......@@ -563,9 +564,10 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De
case Private: t << "private"; break;
case Package: t << "package"; break;
}
t << "\" static=\"";
if (md->isStatic()) t << "yes"; else t << "no";
t << "\"";
t << " static=\"";
if (md->isStatic()) t << "yes"; else t << "no";
t << "\"";
if (isFunc)
......@@ -573,22 +575,24 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De
ArgumentList *al = md->argumentList();
t << " const=\"";
if (al && al->constSpecifier) t << "yes"; else t << "no";
t << "\"";
t << "\" explicit=\"";
t << " explicit=\"";
if (md->isExplicit()) t << "yes"; else t << "no";
t << "\"";
t << "\" inline=\"";
t << " inline=\"";
if (md->isInline()) t << "yes"; else t << "no";
t << "\"";
t << "\" virt=\"";
switch (md->virtualness())
{
case Normal: t << "non-virtual"; break;
case Virtual: t << "virtual"; break;
case Pure: t << "pure-virtual"; break;
default: ASSERT(0);
}
t << " virt=\"";
switch (md->virtualness())
{
case Normal: t << "non-virtual"; break;
case Virtual: t << "virtual"; break;
case Pure: t << "pure-virtual"; break;
default: ASSERT(0);
}
t << "\"";
}
......@@ -598,15 +602,16 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De
//t << " volatile=\"";
//if (al && al->volatileSpecifier) t << "yes"; else t << "no";
t << "\" mutable=\"";
t << " mutable=\"";
if (md->isMutable()) t << "yes"; else t << "no";
t << "\"";
}
else if (md->memberType() == MemberDef::Property)
{
t << " readable=\"";
if (md->isReadable()) t << "yes"; else t << "no";
t << "\"";
t << "\" writable=\"";
if (md->isWritable()) t << "yes"; else t << "no";
t << "\"";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment