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 \ ...@@ -92,7 +92,9 @@ EXCLUDE = src/code.cpp \
src/searchindex.cpp \ src/searchindex.cpp \
src/searchindex.h \ src/searchindex.h \
src/commentcnv.cpp \ src/commentcnv.cpp \
src/commentscan.cpp src/commentscan.cpp \
src/pycode.cpp \
src/pyscanner.cpp
EXCLUDE_SYMLINKS = NO EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = EXCLUDE_PATTERNS =
EXAMPLE_PATH = EXAMPLE_PATH =
......
DOXYGEN Version 1.4.3-20050530 DOXYGEN Version 1.4.3-20050615
Please read the installation section of the manual Please read the installation section of the manual
(http://www.doxygen.org/install.html) for instructions. (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. Please read INSTALL for compilation instructions.
...@@ -17,4 +17,4 @@ to subscribe to the lists or to visit the archives. ...@@ -17,4 +17,4 @@ to subscribe to the lists or to visit the archives.
Enjoy, 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 \ ...@@ -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 \ autolink.doc output.doc external.doc faq.doc trouble.doc history.doc features.doc \
doxygen_usage.doc doxytag_usage.doc \ doxygen_usage.doc doxytag_usage.doc \
doxywizard_usage.doc installdox_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 perlmod.doc perlmod_tree.doc arch.doc
FILE_PATTERNS = *.cpp *.h *.doc FILE_PATTERNS = *.cpp *.h *.doc
EXAMPLE_PATH = ../examples EXAMPLE_PATH = ../examples
......
.TH DOXYGEN "1" "DATE" "doxygen VERSION" "User Commands" .TH DOXYGEN "1" "DATE" "doxygen VERSION" "User Commands"
.SH NAME .SH NAME
doxygen \- manual page for doxygen VERSION doxygen \- documentation system for various programming languages
.SH DESCRIPTION .SH DESCRIPTION
Doxygen version VERSION Doxygen is a documentation system for C++, C, Java, Objective-C, IDL
Copyright Dimitri van Heesch 1997-2005 (Corba and Microsoft flavors) and to some extent PHP, C#, and D.
.PP .PP
You can use doxygen in a number of ways: You can use doxygen in a number of ways:
.TP .TP
...@@ -40,5 +40,7 @@ doxygen \fB\-e\fR rtf extensionsFile ...@@ -40,5 +40,7 @@ doxygen \fB\-e\fR rtf extensionsFile
.PP .PP
If \fB\-s\fR is specified the comments in the config file will be omitted. 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. 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 .SH SEE ALSO
doxytag(1), doxywizard(1). doxytag(1), doxywizard(1).
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
Plain text will do, but for more fancy or structured output HTML tags Plain text will do, but for more fancy or structured output HTML tags
and/or some of doxygen's special commands can be used. and/or some of doxygen's special commands can be used.
<li>Supports C/C++, Java, (Corba and Microsoft) Java, <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, <li>Supports documentation of files, namespaces, classes, structs, unions,
templates, variables, functions, typedefs, enums and defines. templates, variables, functions, typedefs, enums and defines.
<li>JavaDoc (1.1), Qt-Doc, and KDOC compatible. <li>JavaDoc (1.1), Qt-Doc, and ECMA-334 (C# spec.) compatible.
<li>Automatically generates class diagrams in HTML (as clickable <li>Automatically generates class and collaboration diagrams in HTML (as clickable
image maps) and \f$\mbox{\LaTeX}\f$ (as Encapsulated PostScript images). image maps) and \f$\mbox{\LaTeX}\f$ (as Encapsulated PostScript images).
<li>Uses the dot tool of the Graphviz tool kit to generate <li>Uses the dot tool of the Graphviz tool kit to generate
include dependency graphs, collaboration diagrams, and include dependency graphs, collaboration diagrams, and
...@@ -76,8 +76,9 @@ ...@@ -76,8 +76,9 @@
<li>Can cope with large projects easily. <li>Can cope with large projects easily.
</UL> </UL>
Although doxygen can be used in any C or C++ project, it was specifically Although doxygen can be used in any C or C++ project,
designed to be used for projects that make use of Troll Tech's 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 <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 `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 the Qt source code and create a class browser that looks very similar to the
......
...@@ -17,9 +17,10 @@ ...@@ -17,9 +17,10 @@
/*! \page htmlcmds HTML Commands /*! \page htmlcmds HTML Commands
Here is a list of all HTML commands that may be used inside the 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 documentation. Note that although these HTML tags are translated to the
the HTML output only (the HREF and NAME attributes for the A tag are the proper commands for outer formats other than HTML, all attributes
only exception). 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> <ul>
<li><tt>\<A HREF="..."\></tt> Starts a HTML hyper-link (HTML only). <li><tt>\<A HREF="..."\></tt> Starts a HTML hyper-link (HTML only).
......
...@@ -97,6 +97,8 @@ The second part forms a reference manual: ...@@ -97,6 +97,8 @@ The second part forms a reference manual:
used within the documentation. used within the documentation.
<li>Section \ref htmlcmds shows an overview of the HTML commands that <li>Section \ref htmlcmds shows an overview of the HTML commands that
can be used within the documentation. 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> </ul>
The third part provides information for developers: The third part provides information for developers:
...@@ -186,6 +188,7 @@ Thanks go to: ...@@ -186,6 +188,7 @@ Thanks go to:
<li>Tim Mensch for adding the todo command. <li>Tim Mensch for adding the todo command.
<li>Christian Hammond for redesigning the web-site. <li>Christian Hammond for redesigning the web-site.
<li>Ken Wong for providing the HTML tree view code. <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. <li>Petr Prikryl for coordinating the internationalisation support.
All language maintainers for providing translations into many languages. All language maintainers for providing translations into many languages.
<li>Gerald Steffens of <a href="http://www.e-trend.de">E-trend</a> <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 ...@@ -47,6 +47,7 @@ clean: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen Makefile.doxytag
distclean: clean distclean: clean
-$(RM) scanner.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \ -$(RM) scanner.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \
ce_parse.cpp ce_parse.h doxytag.cpp tag.cpp commentscan.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: FORCE:
...@@ -100,7 +100,6 @@ CommandMap cmdMap[] = ...@@ -100,7 +100,6 @@ CommandMap cmdMap[] =
{ "$", CMD_DOLLAR }, { "$", CMD_DOLLAR },
{ "#", CMD_HASH }, { "#", CMD_HASH },
{ "%", CMD_PERCENT }, { "%", CMD_PERCENT },
//{ "~", CMD_LANGSWITCH },
{ "_internalref", CMD_INTERNALREF }, { "_internalref", CMD_INTERNALREF },
{ "dot", CMD_DOT }, { "dot", CMD_DOT },
{ "enddot", CMD_ENDDOT }, { "enddot", CMD_ENDDOT },
...@@ -112,42 +111,6 @@ CommandMap cmdMap[] = ...@@ -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[] = CommandMap htmlTagMap[] =
{ {
{ "strong", HTML_BOLD }, { "strong", HTML_BOLD },
...@@ -188,43 +151,37 @@ CommandMap htmlTagMap[] = ...@@ -188,43 +151,37 @@ CommandMap htmlTagMap[] =
{ "h6", HTML_H6 }, { "h6", HTML_H6 },
{ "span", HTML_SPAN }, { "span", HTML_SPAN },
{ "div", HTML_DIV }, { "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 } { 0, 0 }
}; };
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int HtmlTagMapper::map(const char *name) Mapper *Mappers::cmdMapper = new Mapper(cmdMap);
{ Mapper *Mappers::htmlTagMapper = new Mapper(htmlTagMap);
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;
}
HtmlTagMapper::HtmlTagMapper() : m_map(89) void Mappers::freeMappers()
{ {
m_map.setAutoDelete(TRUE); delete cmdMapper; cmdMapper = 0;
CommandMap *p = htmlTagMap; delete htmlTagMapper; htmlTagMapper = 0;
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;
} }
HtmlTagMapper *HtmlTagMapper::m_instance=0;
//----------------------------------------------------------------------------
...@@ -111,67 +111,92 @@ enum CommandType ...@@ -111,67 +111,92 @@ enum CommandType
enum HtmlTagType enum HtmlTagType
{ {
HTML_UNKNOWN = 0, HTML_UNKNOWN = 0,
HTML_CENTER = 1, HTML_CENTER = 1,
HTML_TABLE = 2, HTML_TABLE = 2,
HTML_CAPTION = 3, HTML_CAPTION = 3,
HTML_SMALL = 4, HTML_SMALL = 4,
HTML_CODE = 5, HTML_CODE = 5,
HTML_IMG = 6, HTML_IMG = 6,
HTML_PRE = 7, HTML_PRE = 7,
HTML_SUB = 8, HTML_SUB = 8,
HTML_SUP = 9, HTML_SUP = 9,
HTML_TR = 10, HTML_TR = 10,
HTML_TD = 11, HTML_TD = 11,
HTML_TH = 12, HTML_TH = 12,
HTML_OL = 13, HTML_OL = 13,
HTML_UL = 14, HTML_UL = 14,
HTML_LI = 15, HTML_LI = 15,
HTML_EMPHASIS = 16, HTML_EMPHASIS = 16,
HTML_HR = 17, HTML_HR = 17,
HTML_DL = 18, HTML_DL = 18,
HTML_DT = 19, HTML_DT = 19,
HTML_DD = 20, HTML_DD = 20,
HTML_BR = 21, HTML_BR = 21,
HTML_A = 22, HTML_A = 22,
HTML_BOLD = 23, HTML_BOLD = 23,
HTML_P = 24, HTML_P = 24,
HTML_H1 = 25, HTML_H1 = 25,
HTML_H2 = 26, HTML_H2 = 26,
HTML_H3 = 27, HTML_H3 = 27,
HTML_H4 = 28, HTML_H4 = 28,
HTML_H5 = 29, HTML_H5 = 29,
HTML_H6 = 30, HTML_H6 = 30,
HTML_SPAN = 31, HTML_SPAN = 31,
HTML_DIV = 32 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: public:
static int map(const char *name); int map(const char *n)
static void freeInstance(); {
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: private:
static CmdMapper *instance();
CmdMapper();
int find(const char *name);
QDict<int> m_map; QDict<int> m_map;
static CmdMapper *m_instance;
}; };
class HtmlTagMapper struct Mappers
{ {
public: static void freeMappers();
static int map(const char *name); static Mapper *cmdMapper;
static void freeInstance(); static Mapper *htmlTagMapper;
private:
static HtmlTagMapper *instance();
HtmlTagMapper();
int find(const char *name);
QDict<int> m_map;
static HtmlTagMapper *m_instance;
}; };
......
...@@ -21,13 +21,14 @@ ...@@ -21,13 +21,14 @@
#include "qtbc.h" #include "qtbc.h"
#include <stdio.h> #include <stdio.h>
class BaseCodeDocInterface; class CodeOutputInterface;
class FileDef; class FileDef;
class MemberDef; class MemberDef;
extern void parseCode(BaseCodeDocInterface &,const char *,const QCString &, extern void parseCCode(CodeOutputInterface &,const char *,const QCString &,
bool ,const char *,FileDef *fd=0, bool ,const char *,FileDef *fd=0,
int startLine=-1,int endLine=-1,bool inlineFragment=FALSE); int startLine=-1,int endLine=-1,bool inlineFragment=FALSE,
extern void initParseCodeContext(); MemberDef *memberDef=0);
extern void setParameterList(MemberDef *md); extern void resetCCodeParserState();
#endif #endif
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <qdir.h> #include <qdir.h>
#include "qtbc.h" #include "qtbc.h"
#include "scanner.h"
#include "entry.h" #include "entry.h"
#include "doxygen.h" #include "doxygen.h"
#include "message.h" #include "message.h"
...@@ -50,7 +49,7 @@ ...@@ -50,7 +49,7 @@
* statics * statics
*/ */
static BaseCodeDocInterface * g_code; static CodeOutputInterface * g_code;
static ClassSDict g_codeClassSDict(17); static ClassSDict g_codeClassSDict(17);
static QCString g_curClassName; static QCString g_curClassName;
...@@ -346,11 +345,8 @@ class CallContext ...@@ -346,11 +345,8 @@ class CallContext
void clear() void clear()
{ {
DBG_CTX((stderr,"** Clear call context\n")); DBG_CTX((stderr,"** Clear call context\n"));
Ctx *ctx = m_classList.getLast(); m_classList.clear();
if (ctx) m_classList.append(new Ctx);
{
ctx->cd=0;
}
} }
ClassDef *getClass() const ClassDef *getClass() const
{ {
...@@ -549,7 +545,7 @@ static void codifyLines(char *text) ...@@ -549,7 +545,7 @@ static void codifyLines(char *text)
* line numbers for each line. If \a text contains newlines, the link will be * 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. * 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 *ref,const char *file,
const char *anchor,const char *text) const char *anchor,const char *text)
{ {
...@@ -600,7 +596,7 @@ static void addParmType() ...@@ -600,7 +596,7 @@ static void addParmType()
g_parmName.resize(0) ; g_parmName.resize(0) ;
} }
void setParameterList(MemberDef *md) static void setParameterList(MemberDef *md)
{ {
g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : "";
ArgumentList *al = md->argumentList(); ArgumentList *al = md->argumentList();
...@@ -614,7 +610,7 @@ void setParameterList(MemberDef *md) ...@@ -614,7 +610,7 @@ void setParameterList(MemberDef *md)
if (i!=-1) g_parmType = g_parmType.left(i); if (i!=-1) g_parmType = g_parmType.left(i);
i = g_parmType.find('&'); i = g_parmType.find('&');
if (i!=-1) g_parmType = g_parmType.left(i); 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_parmType=g_parmType.stripWhiteSpace();
g_theVarContext.addVariable(g_parmType,g_parmName); g_theVarContext.addVariable(g_parmType,g_parmName);
a = al->next(); a = al->next();
...@@ -767,7 +763,7 @@ static void addDocCrossReference(MemberDef *src,MemberDef *dst) ...@@ -767,7 +763,7 @@ static void addDocCrossReference(MemberDef *src,MemberDef *dst)
static bool getLinkInScope(const QCString &c, // scope static bool getLinkInScope(const QCString &c, // scope
const QCString &m, // member const QCString &m, // member
const char *memberText, // exact text const char *memberText, // exact text
BaseCodeDocInterface &ol, CodeOutputInterface &ol,
const char *text const char *text
) )
{ {
...@@ -825,7 +821,7 @@ static bool getLinkInScope(const QCString &c, // scope ...@@ -825,7 +821,7 @@ static bool getLinkInScope(const QCString &c, // scope
static bool getLink(const char *className, static bool getLink(const char *className,
const char *memberName, const char *memberName,
BaseCodeDocInterface &ol, CodeOutputInterface &ol,
const char *text=0) const char *text=0)
{ {
QCString m=removeRedundantWhiteSpace(memberName); QCString m=removeRedundantWhiteSpace(memberName);
...@@ -843,7 +839,7 @@ static bool getLink(const char *className, ...@@ -843,7 +839,7 @@ static bool getLink(const char *className,
return TRUE; return TRUE;
} }
static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
bool typeOnly=FALSE) bool typeOnly=FALSE)
{ {
int i=0; int i=0;
...@@ -963,7 +959,7 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, ...@@ -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) if (mcd)
{ {
...@@ -1025,7 +1021,7 @@ static bool generateClassMemberLink(BaseCodeDocInterface &ol,ClassDef *mcd,const ...@@ -1025,7 +1021,7 @@ static bool generateClassMemberLink(BaseCodeDocInterface &ol,ClassDef *mcd,const
return FALSE; return FALSE;
} }
static void generateMemberLink(BaseCodeDocInterface &ol,const QCString &varName, static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName,
char *memName) char *memName)
{ {
//printf("generateMemberLink(object=%s,mem=%s) classScope=%s\n", //printf("generateMemberLink(object=%s,mem=%s) classScope=%s\n",
...@@ -1120,7 +1116,7 @@ static void generateMemberLink(BaseCodeDocInterface &ol,const QCString &varName, ...@@ -1120,7 +1116,7 @@ static void generateMemberLink(BaseCodeDocInterface &ol,const QCString &varName,
return; return;
} }
static void generateFunctionLink(BaseCodeDocInterface &ol,char *funcName) static void generateFunctionLink(CodeOutputInterface &ol,char *funcName)
{ {
//CodeClassDef *ccd=0; //CodeClassDef *ccd=0;
ClassDef *ccd=0; ClassDef *ccd=0;
...@@ -2412,7 +2408,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} ...@@ -2412,7 +2408,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
g_code->codify(yytext); g_code->codify(yytext);
endFontClass(); 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(); addParmType();
g_parmName=yytext; g_parmName=yytext;
generateClassOrGlobalLink(*g_code,yytext,!g_insideBody); generateClassOrGlobalLink(*g_code,yytext,!g_insideBody);
...@@ -2812,7 +2808,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} ...@@ -2812,7 +2808,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
} }
} }
<*>"//"[!/][^\n]*\n { // strip special one-line comment <*>"//"[!/][^\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")) if (Config_getBool("STRIP_CODE_COMMENTS"))
{ {
char c[2]; c[0]='\n'; c[1]=0; char c[2]; c[0]='\n'; c[1]=0;
...@@ -2863,6 +2859,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} ...@@ -2863,6 +2859,7 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
} }
} }
<*>"/*"[!*]/[^/*] { // special C comment block half way a line <*>"/*"[!*]/[^/*] { // special C comment block half way a line
if (YY_START==SkipString) REJECT;
if (Config_getBool("STRIP_CODE_COMMENTS")) if (Config_getBool("STRIP_CODE_COMMENTS"))
{ {
g_lastSpecialCContext = YY_START; g_lastSpecialCContext = YY_START;
...@@ -2880,7 +2877,9 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} ...@@ -2880,7 +2877,9 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
BEGIN(SkipComment); BEGIN(SkipComment);
} }
} }
<*>"/*"("!"?)"*/" { if (!Config_getBool("STRIP_CODE_COMMENTS")) <*>"/*"("!"?)"*/" {
if (YY_START==SkipString) REJECT;
if (!Config_getBool("STRIP_CODE_COMMENTS"))
{ {
startFontClass("comment"); startFontClass("comment");
g_code->codify(yytext); g_code->codify(yytext);
...@@ -2984,7 +2983,7 @@ static void restoreObjCContext() ...@@ -2984,7 +2983,7 @@ static void restoreObjCContext()
} }
} }
void initParseCodeContext() void resetCCodeParserState()
{ {
//printf("***initParseCodeContext()\n"); //printf("***initParseCodeContext()\n");
g_theVarContext.clear(); g_theVarContext.clear();
...@@ -2994,9 +2993,10 @@ void initParseCodeContext() ...@@ -2994,9 +2993,10 @@ void initParseCodeContext()
g_anchorCount = 0; 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, bool exBlock, const char *exName,FileDef *fd,
int startLine,int endLine,bool inlineFragment) int startLine,int endLine,bool inlineFragment,
MemberDef *memberDef)
{ {
//printf("***parseCode()\n"); //printf("***parseCode()\n");
if (s.isEmpty()) return; if (s.isEmpty()) return;
...@@ -3048,6 +3048,7 @@ void parseCode(BaseCodeDocInterface &od,const char *className,const QCString &s, ...@@ -3048,6 +3048,7 @@ void parseCode(BaseCodeDocInterface &od,const char *className,const QCString &s,
g_args.resize(0); g_args.resize(0);
g_parmName.resize(0); g_parmName.resize(0);
g_parmType.resize(0); g_parmType.resize(0);
if (memberDef) setParameterList(memberDef);
codeYYrestart( codeYYin ); codeYYrestart( codeYYin );
BEGIN( Body ); BEGIN( Body );
codeYYlex(); codeYYlex();
......
...@@ -454,9 +454,16 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'")) ...@@ -454,9 +454,16 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'"))
<CondLine>[ \t]* <CondLine>[ \t]*
<CComment,ReadLine>[\\@]"cond"[ \t]*\n | <CComment,ReadLine>[\\@]"cond"[ \t]*\n |
<CondLine>. { // forgot section id? <CondLine>. { // forgot section id?
bool oldSkip=g_skip;
startCondSection(" "); // fake section id causing the section to be hidden unconditionally 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 (*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 <CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]* { // expand alias
QCString *pValue=Doxygen::aliasDict[yytext+1]; QCString *pValue=Doxygen::aliasDict[yytext+1];
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "outputlist.h" #include "outputlist.h"
#include "membergroup.h" #include "membergroup.h"
#include "reflist.h" #include "reflist.h"
#include "code.h"
#include "debug.h" #include "debug.h"
#include "parserintf.h" #include "parserintf.h"
...@@ -715,6 +714,7 @@ ID "$"?[a-z_A-Z][a-z_A-Z0-9]* ...@@ -715,6 +714,7 @@ ID "$"?[a-z_A-Z][a-z_A-Z0-9]*
LABELID [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}?) SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?)
SCOPENAME "$"?(({ID}?{BN}*"::"{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 %option noyywrap
...@@ -770,6 +770,9 @@ SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) ...@@ -770,6 +770,9 @@ SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})
* words and whitespace and other characters (#,?!, etc). * words and whitespace and other characters (#,?!, etc).
* grouping commands (e.g. @{ and @}) * grouping commands (e.g. @{ and @})
* language switch (e.g. \~english or \~). * 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 <Comment>{CMD}{CMD}[a-z_A-Z]+{B}* { // escaped command
...@@ -778,6 +781,12 @@ SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) ...@@ -778,6 +781,12 @@ SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})
<Comment>{CMD}{CMD}"~"[a-z_A-Z]* { // escaped command <Comment>{CMD}{CMD}"~"[a-z_A-Z]* { // escaped command
addOutput(yytext); addOutput(yytext);
} }
<Comment>{MAILADR} { // mail adress
addOutput(yytext);
}
<Comment>"\""[^"\n]*"\"" { // quoted text
addOutput(yytext);
}
<Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!) <Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!)
addOutput(yytext); addOutput(yytext);
} }
...@@ -791,6 +800,14 @@ SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) ...@@ -791,6 +800,14 @@ SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})
// continue with the same input // continue with the same input
REJECT; 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>"<!--" { <Comment>"<!--" {
BEGIN(HtmlComment); BEGIN(HtmlComment);
} }
......
...@@ -1722,7 +1722,7 @@ void Config::create() ...@@ -1722,7 +1722,7 @@ void Config::create()
"SHOW_DIRECTORIES", "SHOW_DIRECTORIES",
"If the sources in your project are distributed over multiple directories \n" "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" "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 TRUE
); );
cs = addString( "FILE_VERSION_FILTER", cs = addString( "FILE_VERSION_FILTER",
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "defargs.h" #include "defargs.h"
#include "outputgen.h" #include "outputgen.h"
#include "dot.h" #include "dot.h"
#include "code.h"
#include <qdir.h> #include <qdir.h>
#include <qfile.h> #include <qfile.h>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "pagedef.h" #include "pagedef.h"
#include "section.h" #include "section.h"
#include "htags.h" #include "htags.h"
#include "parserintf.h"
#if defined(_MSC_VER) || defined(__BORLANDC__) #if defined(_MSC_VER) || defined(__BORLANDC__)
#define popen _popen #define popen _popen
...@@ -81,6 +82,11 @@ Definition::Definition(const char *df,int dl, ...@@ -81,6 +82,11 @@ Definition::Definition(const char *df,int dl,
{ {
//QCString ns; //QCString ns;
m_defFileName = df; m_defFileName = df;
int lastDot = m_defFileName.findRev('.');
if (lastDot!=-1)
{
m_defFileExt = m_defFileName.mid(lastDot);
}
m_defLine = dl; m_defLine = dl;
m_name=name; m_name=name;
if (m_name!="<globalScope>") if (m_name!="<globalScope>")
...@@ -459,12 +465,23 @@ void Definition::writeInlineCode(OutputList &ol,const char *scopeName) ...@@ -459,12 +465,23 @@ void Definition::writeInlineCode(OutputList &ol,const char *scopeName)
actualStart,actualEnd,codeFragment) actualStart,actualEnd,codeFragment)
) )
{ {
initParseCodeContext(); ParserInterface *pIntf = Doxygen::parserManager->getParser(m_defFileExt);
pIntf->resetCodeParserState();
//printf("Read:\n`%s'\n\n",codeFragment.data()); //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(); ol.startCodeFragment();
parseCode(ol,scopeName,codeFragment,FALSE,0, pIntf->parseCode(ol, // codeOutIntf
m_bodyDef,actualStart,actualEnd,TRUE); scopeName, // scope
codeFragment, // input
FALSE, // isExample
0, // exampleName
m_bodyDef, // fileDef
actualStart, // startLine
actualEnd, // endLine
TRUE, // inlineFragment
thisMd // memberDef
);
ol.endCodeFragment(); ol.endCodeFragment();
ol.newParagraph(); ol.newParagraph();
} }
......
...@@ -117,6 +117,9 @@ class Definition ...@@ -117,6 +117,9 @@ class Definition
/*! returns the file in which this definition was found */ /*! returns the file in which this definition was found */
QCString getDefFileName() const { return m_defFileName; } 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 */ /*! returns the line number at which the definition was found */
int getDefLine() const { return m_defLine; } int getDefLine() const { return m_defLine; }
...@@ -207,6 +210,7 @@ class Definition ...@@ -207,6 +210,7 @@ class Definition
// where the item was found // where the item was found
QCString m_defFileName; QCString m_defFileName;
int m_defLine; int m_defLine;
QCString m_defFileExt;
/*! The class, namespace in which this class is located /*! The class, namespace in which this class is located
*/ */
......
This diff is collapsed.
...@@ -885,6 +885,7 @@ class DocHtmlList : public CompAccept<DocHtmlList>, public DocNode ...@@ -885,6 +885,7 @@ class DocHtmlList : public CompAccept<DocHtmlList>, public DocNode
void accept(DocVisitor *v) { CompAccept<DocHtmlList>::accept(this,v); } void accept(DocVisitor *v) { CompAccept<DocHtmlList>::accept(this,v); }
const HtmlAttribList &attribs() const { return m_attribs; } const HtmlAttribList &attribs() const { return m_attribs; }
int parse(); int parse();
int parseXml();
private: private:
DocNode * m_parent; DocNode * m_parent;
...@@ -909,6 +910,8 @@ class DocSimpleSect : public CompAccept<DocSimpleSect>, public DocNode ...@@ -909,6 +910,8 @@ class DocSimpleSect : public CompAccept<DocSimpleSect>, public DocNode
void accept(DocVisitor *v); void accept(DocVisitor *v);
int parse(bool userTitle); int parse(bool userTitle);
int parseRcs(); int parseRcs();
int parseXml();
void appendLinkWord(const QString &word);
private: private:
DocNode * m_parent; DocNode * m_parent;
...@@ -930,7 +933,7 @@ class DocParamSect : public CompAccept<DocParamSect>, public DocNode ...@@ -930,7 +933,7 @@ class DocParamSect : public CompAccept<DocParamSect>, public DocNode
}; };
DocParamSect(DocNode *parent,Type t) DocParamSect(DocNode *parent,Type t)
: m_parent(parent), m_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; } Kind kind() const { return Kind_ParamSect; }
Type type() const { return m_type; } Type type() const { return m_type; }
DocNode *parent() const { return m_parent; } DocNode *parent() const { return m_parent; }
...@@ -962,9 +965,10 @@ class DocPara : public CompAccept<DocPara>, public DocNode ...@@ -962,9 +965,10 @@ class DocPara : public CompAccept<DocPara>, public DocNode
int handleCommand(const QString &cmdName); int handleCommand(const QString &cmdName);
int handleHtmlStartTag(const QString &tagName,const HtmlAttribList &tagHtmlAttribs); int handleHtmlStartTag(const QString &tagName,const HtmlAttribList &tagHtmlAttribs);
int handleHtmlEndTag(const QString &tagName); int handleHtmlEndTag(const QString &tagName);
int handleSimpleSection(DocSimpleSect::Type t); int handleSimpleSection(DocSimpleSect::Type t,bool xmlContext=FALSE);
int handleXRefItem(); int handleXRefItem();
int handleParamSection(const QString &cmdName,DocParamSect::Type t, int handleParamSection(const QString &cmdName,DocParamSect::Type t,
bool xmlContext,
int direction); int direction);
void handleIncludeOperator(const QString &cmdName,DocIncOperator::Type t); void handleIncludeOperator(const QString &cmdName,DocIncOperator::Type t);
void handleImage(const QString &cmdName); void handleImage(const QString &cmdName);
...@@ -973,7 +977,9 @@ class DocPara : public CompAccept<DocPara>, public DocNode ...@@ -973,7 +977,9 @@ class DocPara : public CompAccept<DocPara>, public DocNode
void handleLink(const QString &cmdName,bool isJavaLink); void handleLink(const QString &cmdName,bool isJavaLink);
void handleRef(const QString &cmdName); void handleRef(const QString &cmdName);
void handleSection(const QString &cmdName); void handleSection(const QString &cmdName);
int handleStartCode();
int handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level); int handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level);
bool injectToken(int tok,const QString &tokText);
//int handleLanguageSwitch(); //int handleLanguageSwitch();
private: private:
...@@ -989,11 +995,10 @@ class DocParamList : public DocNode ...@@ -989,11 +995,10 @@ class DocParamList : public DocNode
public: public:
DocParamList(DocNode *parent,DocParamSect::Type t,DocParamSect::Direction d) 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_parent(parent) , m_type(t), m_dir(d), m_isFirst(TRUE), m_isLast(TRUE)
{ m_paragraph=new DocPara(this); } { m_paragraphs.setAutoDelete(TRUE); }
virtual ~DocParamList() { delete m_paragraph; } virtual ~DocParamList() { }
Kind kind() const { return Kind_ParamList; } Kind kind() const { return Kind_ParamList; }
DocNode *parent() const { return m_parent; } DocNode *parent() const { return m_parent; }
//const QStrList &parameters() { return m_params; }
const QList<DocNode> &parameters() { return m_params; } const QList<DocNode> &parameters() { return m_params; }
DocParamSect::Type type() const { return m_type; } DocParamSect::Type type() const { return m_type; }
DocParamSect::Direction direction() const { return m_dir; } DocParamSect::Direction direction() const { return m_dir; }
...@@ -1004,15 +1009,17 @@ class DocParamList : public DocNode ...@@ -1004,15 +1009,17 @@ class DocParamList : public DocNode
void accept(DocVisitor *v) void accept(DocVisitor *v)
{ {
v->visitPre(this); 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); v->visitPost(this);
} }
int parse(const QString &cmdName); int parse(const QString &cmdName);
int parseXml(const QString &paramName);
private: private:
DocNode * m_parent; DocNode * m_parent;
DocPara * m_paragraph; QList<DocPara> m_paragraphs;
//QStrList m_params;
QList<DocNode> m_params; QList<DocNode> m_params;
DocParamSect::Type m_type; DocParamSect::Type m_type;
DocParamSect::Direction m_dir; DocParamSect::Direction m_dir;
...@@ -1078,6 +1085,7 @@ class DocHtmlListItem : public CompAccept<DocHtmlListItem>, public DocNode ...@@ -1078,6 +1085,7 @@ class DocHtmlListItem : public CompAccept<DocHtmlListItem>, public DocNode
DocNode *parent() const { return m_parent; } DocNode *parent() const { return m_parent; }
void accept(DocVisitor *v) { CompAccept<DocHtmlListItem>::accept(this,v); } void accept(DocVisitor *v) { CompAccept<DocHtmlListItem>::accept(this,v); }
int parse(); int parse();
int parseXml();
private: private:
DocNode * m_parent; DocNode * m_parent;
......
...@@ -57,7 +57,8 @@ enum Tokens ...@@ -57,7 +57,8 @@ enum Tokens
RetVal_TableHCell = 0x1000E, RetVal_TableHCell = 0x1000E,
RetVal_EndTable = 0x1000F, RetVal_EndTable = 0x1000F,
RetVal_Internal = 0x10010, RetVal_Internal = 0x10010,
RetVal_SwitchLang = 0x10011 RetVal_SwitchLang = 0x10011,
RetVal_CloseXml = 0x10012
}; };
struct TokenInfo struct TokenInfo
...@@ -92,6 +93,7 @@ struct TokenInfo ...@@ -92,6 +93,7 @@ struct TokenInfo
// html tag // html tag
HtmlAttribList attribs; HtmlAttribList attribs;
bool endTag; bool endTag;
bool emptyTag;
// whitespace // whitespace
QString chars; QString chars;
...@@ -124,6 +126,7 @@ void doctokenizerYYsetStatePara(); ...@@ -124,6 +126,7 @@ void doctokenizerYYsetStatePara();
void doctokenizerYYsetStateTitle(); void doctokenizerYYsetStateTitle();
void doctokenizerYYsetStateTitleAttrValue(); void doctokenizerYYsetStateTitleAttrValue();
void doctokenizerYYsetStateCode(); void doctokenizerYYsetStateCode();
void doctokenizerYYsetStateXmlCode();
void doctokenizerYYsetStateHtmlOnly(); void doctokenizerYYsetStateHtmlOnly();
void doctokenizerYYsetStateManOnly(); void doctokenizerYYsetStateManOnly();
void doctokenizerYYsetStateLatexOnly(); void doctokenizerYYsetStateLatexOnly();
......
...@@ -136,72 +136,6 @@ static int computeIndent(const char *str,int length) ...@@ -136,72 +136,6 @@ static int computeIndent(const char *str,int length)
return indent; 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() static void processSection()
...@@ -231,27 +165,96 @@ static void processSection() ...@@ -231,27 +165,96 @@ static void processSection()
static void handleHtmlTag() static void handleHtmlTag()
{ {
g_token->name = yytext; QCString tagText=yytext;
g_token->attribs.clear(); g_token->attribs.clear();
g_token->endTag = FALSE;
g_token->emptyTag = FALSE;
// Check for end tag
int startNamePos=1; int startNamePos=1;
if (g_token->name.at(1)=='/') startNamePos++; if (tagText.at(1)=='/')
int attSep=0;
while (attSep<yyleng && !isspace(yytext[attSep]))
{ {
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)); // Check for valid HTML/XML name chars (including namespaces)
g_token->name=g_token->name.mid(startNamePos,attSep-1).lower(); 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) static QString stripEmptyLines(const char *s)
{ {
int result=0,p=0; int result=0,p=0;
...@@ -287,6 +290,7 @@ WS [ \t\r\n] ...@@ -287,6 +290,7 @@ WS [ \t\r\n]
NONWS [^ \t\r\n] NONWS [^ \t\r\n]
BLANK [ \t\r] BLANK [ \t\r]
ID [a-z_A-Z][a-z_A-Z0-9]* 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}* OPTSTARS ("//"{BLANK}*)?"*"*{BLANK}*
LISTITEM {BLANK}*{OPTSTARS}"-"("#")?{WS} LISTITEM {BLANK}*{OPTSTARS}"-"("#")?{WS}
ENDLIST {BLANK}*{OPTSTARS}"."{BLANK}*\n ENDLIST {BLANK}*{OPTSTARS}"."{BLANK}*\n
...@@ -326,7 +330,7 @@ WORD1 "%"?{CHARWORD}+|"{"|"}"|("\""[^"\n]*"\"") ...@@ -326,7 +330,7 @@ WORD1 "%"?{CHARWORD}+|"{"|"}"|("\""[^"\n]*"\"")
WORD2 "."|","|"("|")"|"["|"]"|":"|";"|"\?" WORD2 "."|","|"("|")"|"["|"]"|":"|";"|"\?"
WORD1NQ "%"?{CHARWORDQ}+ WORD1NQ "%"?{CHARWORDQ}+
WORD2NQ "."|","|"("|")"|"["|"]"|":"|";"|"\?" 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" 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" 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} HTMLKEYW {HTMLKEYL}|{HTMLKEYU}
...@@ -344,6 +348,7 @@ REFWORD ("#"|"::")?({ID}("."|"#"|"::"|"-"))*({ID}(":")?){FUNCARG}? ...@@ -344,6 +348,7 @@ REFWORD ("#"|"::")?({ID}("."|"#"|"::"|"-"))*({ID}(":")?){FUNCARG}?
%x St_TitleA %x St_TitleA
%x St_TitleV %x St_TitleV
%x St_Code %x St_Code
%x St_XmlCode
%x St_HtmlOnly %x St_HtmlOnly
%x St_ManOnly %x St_ManOnly
%x St_LatexOnly %x St_LatexOnly
...@@ -445,7 +450,7 @@ REFWORD ("#"|"::")?({ID}("."|"#"|"::"|"-"))*({ID}(":")?){FUNCARG}? ...@@ -445,7 +450,7 @@ REFWORD ("#"|"::")?({ID}("."|"#"|"::"|"-"))*({ID}(":")?){FUNCARG}?
g_token->isEMailAddr=FALSE; g_token->isEMailAddr=FALSE;
return TK_URL; 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->name=yytext;
g_token->isEMailAddr=TRUE; g_token->isEMailAddr=TRUE;
return TK_URL; return TK_URL;
...@@ -539,9 +544,12 @@ REFWORD ("#"|"::")?({ID}("."|"#"|"::"|"-"))*({ID}(":")?){FUNCARG}? ...@@ -539,9 +544,12 @@ REFWORD ("#"|"::")?({ID}("."|"#"|"::"|"-"))*({ID}(":")?){FUNCARG}?
<St_Code>{WS}*{CMD}"endcode" { <St_Code>{WS}*{CMD}"endcode" {
return RetVal_OK; return RetVal_OK;
} }
<St_Code>[^\\@\n]+ | <St_XmlCode>{WS}*"</code>" {
<St_Code>\n | return RetVal_OK;
<St_Code>. { }
<St_Code,St_XmlCode>[^\\@\n]+ |
<St_Code,St_XmlCode>\n |
<St_Code,St_XmlCode>. {
g_token->verb+=yytext; g_token->verb+=yytext;
} }
<St_HtmlOnly>{CMD}"endhtmlonly" { <St_HtmlOnly>{CMD}"endhtmlonly" {
...@@ -942,6 +950,12 @@ void doctokenizerYYsetStateCode() ...@@ -942,6 +950,12 @@ void doctokenizerYYsetStateCode()
BEGIN(St_Code); BEGIN(St_Code);
} }
void doctokenizerYYsetStateXmlCode()
{
g_token->verb="";
BEGIN(St_XmlCode);
}
void doctokenizerYYsetStateHtmlOnly() void doctokenizerYYsetStateHtmlOnly()
{ {
g_token->verb=""; g_token->verb="";
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "util.h" #include "util.h"
#include "config.h" #include "config.h"
#include "language.h" #include "language.h"
#include "scanner.h"
#include "defargs.h" #include "defargs.h"
#include "docparser.h" #include "docparser.h"
#include "debug.h" #include "debug.h"
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "logos.h" #include "logos.h"
#include "instdox.h" #include "instdox.h"
#include "message.h" #include "message.h"
#include "code.h"
#include "config.h" #include "config.h"
#include "util.h" #include "util.h"
#include "pre.h" #include "pre.h"
...@@ -67,6 +66,7 @@ ...@@ -67,6 +66,7 @@
#include "searchindex.h" #include "searchindex.h"
#include "parserintf.h" #include "parserintf.h"
#include "htags.h" #include "htags.h"
#include "pyscanner.h"
#if defined(_MSC_VER) || defined(__BORLANDC__) #if defined(_MSC_VER) || defined(__BORLANDC__)
#define popen _popen #define popen _popen
...@@ -125,6 +125,7 @@ QDict<int> * Doxygen::htmlDirMap = 0; ...@@ -125,6 +125,7 @@ QDict<int> * Doxygen::htmlDirMap = 0;
QCache<LookupInfo> Doxygen::lookupCache(20000,20000); QCache<LookupInfo> Doxygen::lookupCache(20000,20000);
DirSDict Doxygen::directories(17); DirSDict Doxygen::directories(17);
SDict<DirRelation> Doxygen::dirRelations(257); SDict<DirRelation> Doxygen::dirRelations(257);
ParserManager *Doxygen::parserManager = 0;
static StringList inputFiles; static StringList inputFiles;
static StringDict excludeNameDict(1009); // sections static StringDict excludeNameDict(1009); // sections
...@@ -7310,60 +7311,8 @@ static void copyStyleSheet() ...@@ -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) static void parseFiles(Entry *root)
{ {
ParserInterface *defaultParser = new CLanguageScanner;
ParserManager *parserManager = new ParserManager(defaultParser);
// register any additional parsers here...
QCString *s=inputFiles.first(); QCString *s=inputFiles.first();
while (s) while (s)
...@@ -7372,12 +7321,14 @@ static void parseFiles(Entry *root) ...@@ -7372,12 +7321,14 @@ static void parseFiles(Entry *root)
QCString extension; QCString extension;
int ei = fileName.findRev('.'); int ei = fileName.findRev('.');
if (ei!=-1) extension=fileName.right(fileName.length()-ei); if (ei!=-1) extension=fileName.right(fileName.length()-ei);
ParserInterface *parser = Doxygen::parserManager->getParser(extension);
QFileInfo fi(fileName); QFileInfo fi(fileName);
BufStr preBuf(fi.size()+4096); BufStr preBuf(fi.size()+4096);
BufStr *bufPtr = &preBuf; BufStr *bufPtr = &preBuf;
if (Config_getBool("ENABLE_PREPROCESSING")) if (Config_getBool("ENABLE_PREPROCESSING") &&
parser->needsPreprocessing(extension))
{ {
msg("Preprocessing %s...\n",s->data()); msg("Preprocessing %s...\n",s->data());
preprocessFile(fileName,*bufPtr); preprocessFile(fileName,*bufPtr);
...@@ -7396,8 +7347,7 @@ static void parseFiles(Entry *root) ...@@ -7396,8 +7347,7 @@ static void parseFiles(Entry *root)
convBuf.addChar('\0'); convBuf.addChar('\0');
ParserInterface *parser = parserManager->getParser(extension); parser->parseInput(fileName,convBuf.data(),root);
parser->parse(fileName,convBuf.data(),root);
s=inputFiles.next(); s=inputFiles.next();
} }
...@@ -7792,6 +7742,12 @@ void initDoxygen() ...@@ -7792,6 +7742,12 @@ void initDoxygen()
Doxygen::runningTime.start(); Doxygen::runningTime.start();
initPreprocessor(); 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::sectionDict.setAutoDelete(TRUE);
Doxygen::inputNameList.setAutoDelete(TRUE); Doxygen::inputNameList.setAutoDelete(TRUE);
Doxygen::memberNameSDict.setAutoDelete(TRUE); Doxygen::memberNameSDict.setAutoDelete(TRUE);
...@@ -7820,13 +7776,13 @@ void cleanUpDoxygen() ...@@ -7820,13 +7776,13 @@ void cleanUpDoxygen()
delete Doxygen::exampleSDict; delete Doxygen::exampleSDict;
delete Doxygen::globalScope; delete Doxygen::globalScope;
delete Doxygen::xrefLists; delete Doxygen::xrefLists;
delete Doxygen::parserManager;
cleanUpPreprocessor(); cleanUpPreprocessor();
Config::deleteInstance(); Config::deleteInstance();
QTextCodec::deleteAllCodecs(); QTextCodec::deleteAllCodecs();
delete theTranslator; delete theTranslator;
delete outputList; delete outputList;
CmdMapper::freeInstance(); Mappers::freeMappers();
HtmlTagMapper::freeInstance();
//delete Doxygen::symbolMap; <- we cannot do this unless all static lists //delete Doxygen::symbolMap; <- we cannot do this unless all static lists
// (such as Doxygen::namespaceSDict) // (such as Doxygen::namespaceSDict)
// with objects based on Definition are made // with objects based on Definition are made
......
...@@ -42,6 +42,7 @@ class PageSDict; ...@@ -42,6 +42,7 @@ class PageSDict;
class PageDef; class PageDef;
class SearchIndex; class SearchIndex;
class DirDef; class DirDef;
class ParserManager;
typedef QList<QCString> StringList; typedef QList<QCString> StringList;
typedef QDict<FileDef> FileDict; typedef QDict<FileDef> FileDict;
...@@ -116,6 +117,7 @@ class Doxygen ...@@ -116,6 +117,7 @@ class Doxygen
static QCache<LookupInfo> lookupCache; static QCache<LookupInfo> lookupCache;
static DirSDict directories; static DirSDict directories;
static SDict<DirRelation> dirRelations; static SDict<DirRelation> dirRelations;
static ParserManager *parserManager;
}; };
void initDoxygen(); void initDoxygen();
......
...@@ -28,18 +28,18 @@ ...@@ -28,18 +28,18 @@
#include "outputlist.h" #include "outputlist.h"
#include "dot.h" #include "dot.h"
#include "message.h" #include "message.h"
#include "code.h"
#include "docparser.h" #include "docparser.h"
#include "ftvhelp.h" #include "ftvhelp.h"
#include "searchindex.h" #include "searchindex.h"
#include "htags.h" #include "htags.h"
#include "parserintf.h"
#if defined(_MSC_VER) || defined(__BORLANDC__) #if defined(_MSC_VER) || defined(__BORLANDC__)
#define popen _popen #define popen _popen
#define pclose _pclose #define pclose _pclose
#endif #endif
class DevNullCodeDocInterface : public BaseCodeDocInterface class DevNullCodeDocInterface : public CodeOutputInterface
{ {
public: public:
virtual void codify(const char *) {} virtual void codify(const char *) {}
...@@ -653,9 +653,10 @@ void FileDef::writeSource(OutputList &ol) ...@@ -653,9 +653,10 @@ void FileDef::writeSource(OutputList &ol)
ol.endTextLink(); ol.endTextLink();
} }
initParseCodeContext(); ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension());
pIntf->resetCodeParserState();
ol.startCodeFragment(); ol.startCodeFragment();
parseCode(ol,0, pIntf->parseCode(ol,0,
fileToString(absFilePath(),Config_getBool("FILTER_SOURCE_FILES")), fileToString(absFilePath(),Config_getBool("FILTER_SOURCE_FILES")),
FALSE,0,this FALSE,0,this
); );
...@@ -667,7 +668,10 @@ void FileDef::writeSource(OutputList &ol) ...@@ -667,7 +668,10 @@ void FileDef::writeSource(OutputList &ol)
void FileDef::parseSource() void FileDef::parseSource()
{ {
DevNullCodeDocInterface devNullIntf; DevNullCodeDocInterface devNullIntf;
parseCode(devNullIntf,0, ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension());
pIntf->resetCodeParserState();
pIntf->parseCode(
devNullIntf,0,
fileToString(absFilePath(),Config_getBool("FILTER_SOURCE_FILES")), fileToString(absFilePath(),Config_getBool("FILTER_SOURCE_FILES")),
FALSE,0,this FALSE,0,this
); );
......
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
#include "language.h" #include "language.h"
#include "doxygen.h" #include "doxygen.h"
#include "outputgen.h" #include "outputgen.h"
#include "code.h"
#include "dot.h" #include "dot.h"
#include "message.h" #include "message.h"
#include "config.h" #include "config.h"
#include "htmlgen.h" #include "htmlgen.h"
#include "parserintf.h"
static const int NUM_HTML_LIST_TYPES = 4; static const int NUM_HTML_LIST_TYPES = 4;
...@@ -49,8 +49,10 @@ static QString htmlAttribsToString(const HtmlAttribList &attribs) ...@@ -49,8 +49,10 @@ static QString htmlAttribsToString(const HtmlAttribList &attribs)
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
HtmlDocVisitor::HtmlDocVisitor(QTextStream &t,BaseCodeDocInterface &ci) HtmlDocVisitor::HtmlDocVisitor(QTextStream &t,CodeOutputInterface &ci,
: DocVisitor(DocVisitor_Html), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) 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) ...@@ -196,7 +198,9 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
{ {
case DocVerbatim::Code: // fall though case DocVerbatim::Code: // fall though
m_t << PREFRAG_START; 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; m_t << PREFRAG_END;
break; break;
case DocVerbatim::Verbatim: case DocVerbatim::Verbatim:
...@@ -253,7 +257,9 @@ void HtmlDocVisitor::visit(DocInclude *inc) ...@@ -253,7 +257,9 @@ void HtmlDocVisitor::visit(DocInclude *inc)
{ {
case DocInclude::Include: case DocInclude::Include:
m_t << PREFRAG_START; 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; m_t << PREFRAG_END;
break; break;
case DocInclude::IncWithLines: case DocInclude::IncWithLines:
...@@ -261,7 +267,11 @@ void HtmlDocVisitor::visit(DocInclude *inc) ...@@ -261,7 +267,11 @@ void HtmlDocVisitor::visit(DocInclude *inc)
m_t << PREFRAG_START; m_t << PREFRAG_START;
QFileInfo cfi( inc->file() ); QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() ); 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; m_t << PREFRAG_END;
} }
break; break;
...@@ -291,7 +301,13 @@ void HtmlDocVisitor::visit(DocIncOperator *op) ...@@ -291,7 +301,13 @@ void HtmlDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip) if (op->type()!=DocIncOperator::Skip)
{ {
popEnabled(); 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(); pushEnabled();
m_hide=TRUE; m_hide=TRUE;
} }
......
...@@ -21,16 +21,17 @@ ...@@ -21,16 +21,17 @@
#include "docvisitor.h" #include "docvisitor.h"
#include <qstack.h> #include <qstack.h>
#include <qcstring.h>
class QTextStream; class QTextStream;
class BaseCodeDocInterface; class CodeOutputInterface;
class QString; class QString;
/*! @brief Concrete visitor implementation for HTML output. */ /*! @brief Concrete visitor implementation for HTML output. */
class HtmlDocVisitor : public DocVisitor class HtmlDocVisitor : public DocVisitor
{ {
public: public:
HtmlDocVisitor(QTextStream &t,BaseCodeDocInterface &ci); HtmlDocVisitor(QTextStream &t,CodeOutputInterface &ci,const char *langExt);
//-------------------------------------- //--------------------------------------
// visitor functions for leaf nodes // visitor functions for leaf nodes
...@@ -77,8 +78,6 @@ class HtmlDocVisitor : public DocVisitor ...@@ -77,8 +78,6 @@ class HtmlDocVisitor : public DocVisitor
void visitPost(DocHtmlList *) ; void visitPost(DocHtmlList *) ;
void visitPre(DocHtmlListItem *); void visitPre(DocHtmlListItem *);
void visitPost(DocHtmlListItem *); void visitPost(DocHtmlListItem *);
//void visitPre(DocHtmlPre *);
//void visitPost(DocHtmlPre *);
void visitPre(DocHtmlDescList *); void visitPre(DocHtmlDescList *);
void visitPost(DocHtmlDescList *); void visitPost(DocHtmlDescList *);
void visitPre(DocHtmlDescTitle *); void visitPre(DocHtmlDescTitle *);
...@@ -111,8 +110,6 @@ class HtmlDocVisitor : public DocVisitor ...@@ -111,8 +110,6 @@ class HtmlDocVisitor : public DocVisitor
void visitPost(DocSecRefItem *); void visitPost(DocSecRefItem *);
void visitPre(DocSecRefList *); void visitPre(DocSecRefList *);
void visitPost(DocSecRefList *); void visitPost(DocSecRefList *);
//void visitPre(DocLanguage *);
//void visitPost(DocLanguage *);
void visitPre(DocParamSect *); void visitPre(DocParamSect *);
void visitPost(DocParamSect *); void visitPost(DocParamSect *);
void visitPre(DocParamList *); void visitPre(DocParamList *);
...@@ -147,10 +144,11 @@ class HtmlDocVisitor : public DocVisitor ...@@ -147,10 +144,11 @@ class HtmlDocVisitor : public DocVisitor
//-------------------------------------- //--------------------------------------
QTextStream &m_t; QTextStream &m_t;
BaseCodeDocInterface &m_ci; CodeOutputInterface &m_ci;
bool m_insidePre; bool m_insidePre;
bool m_hide; bool m_hide;
QStack<bool> m_enabled; QStack<bool> m_enabled;
QCString m_langExt;
}; };
#endif #endif
...@@ -1418,9 +1418,9 @@ void HtmlGenerator::endParamList() ...@@ -1418,9 +1418,9 @@ void HtmlGenerator::endParamList()
t << "</dl>"; 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); n->accept(visitor);
delete visitor; delete visitor;
} }
......
...@@ -45,7 +45,7 @@ class HtmlGenerator : public OutputGenerator ...@@ -45,7 +45,7 @@ class HtmlGenerator : public OutputGenerator
bool isEnabled(OutputType o) { return (o==Html && active); } bool isEnabled(OutputType o) { return (o==Html && active); }
OutputGenerator *get(OutputType o) { return (o==Html) ? this : 0; } 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 startFile(const char *name,const char *manName,const char *title);
void writeFooter(); void writeFooter();
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "message.h" #include "message.h"
#include "index.h" #include "index.h"
#include "doxygen.h" #include "doxygen.h"
#include "code.h"
#include "config.h" #include "config.h"
#include "filedef.h" #include "filedef.h"
#include "outputlist.h" #include "outputlist.h"
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
#include "language.h" #include "language.h"
#include "doxygen.h" #include "doxygen.h"
#include "outputgen.h" #include "outputgen.h"
#include "code.h"
#include "dot.h" #include "dot.h"
#include "util.h" #include "util.h"
#include "message.h" #include "message.h"
#include "parserintf.h"
static QString escapeLabelName(const char *s) static QString escapeLabelName(const char *s)
{ {
...@@ -79,10 +79,11 @@ QString LatexDocVisitor::escapeMakeIndexChars(const char *s) ...@@ -79,10 +79,11 @@ QString LatexDocVisitor::escapeMakeIndexChars(const char *s)
} }
LatexDocVisitor::LatexDocVisitor(QTextStream &t,BaseCodeDocInterface &ci, LatexDocVisitor::LatexDocVisitor(QTextStream &t,CodeOutputInterface &ci,
bool insideTabbing) const char *langExt,bool insideTabbing)
: DocVisitor(DocVisitor_Latex), m_t(t), m_ci(ci), m_insidePre(FALSE), : 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) ...@@ -251,7 +252,9 @@ void LatexDocVisitor::visit(DocVerbatim *s)
{ {
case DocVerbatim::Code: case DocVerbatim::Code:
m_t << "\n\n\\footnotesize\\begin{verbatim}"; 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; m_t << "\\end{verbatim}\n\\normalsize" << endl;
break; break;
case DocVerbatim::Verbatim: case DocVerbatim::Verbatim:
...@@ -316,13 +319,20 @@ void LatexDocVisitor::visit(DocInclude *inc) ...@@ -316,13 +319,20 @@ void LatexDocVisitor::visit(DocInclude *inc)
m_t << "\n\n\\footnotesize\\begin{verbatim}"; m_t << "\n\n\\footnotesize\\begin{verbatim}";
QFileInfo cfi( inc->file() ); QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() ); 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; m_t << "\\end{verbatim}\n\\normalsize" << endl;
} }
break; break;
case DocInclude::Include: case DocInclude::Include:
m_t << "\n\n\\footnotesize\\begin{verbatim}"; 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; m_t << "\\end{verbatim}\n\\normalsize" << endl;
break; break;
case DocInclude::DontInclude: case DocInclude::DontInclude:
...@@ -350,7 +360,12 @@ void LatexDocVisitor::visit(DocIncOperator *op) ...@@ -350,7 +360,12 @@ void LatexDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip) if (op->type()!=DocIncOperator::Skip)
{ {
popEnabled(); 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(); pushEnabled();
m_hide=TRUE; m_hide=TRUE;
} }
......
...@@ -21,16 +21,18 @@ ...@@ -21,16 +21,18 @@
#include "docvisitor.h" #include "docvisitor.h"
#include <qstack.h> #include <qstack.h>
#include <qcstring.h>
class QTextStream; class QTextStream;
class BaseCodeDocInterface; class CodeOutputInterface;
class QString; class QString;
/*! @brief Concrete visitor implementation for LaTeX output. */ /*! @brief Concrete visitor implementation for LaTeX output. */
class LatexDocVisitor : public DocVisitor class LatexDocVisitor : public DocVisitor
{ {
public: public:
LatexDocVisitor(QTextStream &t,BaseCodeDocInterface &ci,bool insideTabbing); LatexDocVisitor(QTextStream &t,CodeOutputInterface &ci,
const char *langExt,bool insideTabbing);
//-------------------------------------- //--------------------------------------
// visitor functions for leaf nodes // visitor functions for leaf nodes
...@@ -150,12 +152,13 @@ class LatexDocVisitor : public DocVisitor ...@@ -150,12 +152,13 @@ class LatexDocVisitor : public DocVisitor
//-------------------------------------- //--------------------------------------
QTextStream &m_t; QTextStream &m_t;
BaseCodeDocInterface &m_ci; CodeOutputInterface &m_ci;
bool m_insidePre; bool m_insidePre;
bool m_insideItem; bool m_insideItem;
bool m_hide; bool m_hide;
bool m_insideTabbing; bool m_insideTabbing;
QStack<bool> m_enabled; QStack<bool> m_enabled;
QCString m_langExt;
}; };
#endif #endif
...@@ -1542,9 +1542,9 @@ void LatexGenerator::endParamList() ...@@ -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); n->accept(visitor);
delete visitor; delete visitor;
} }
......
...@@ -43,7 +43,7 @@ class LatexGenerator : public OutputGenerator ...@@ -43,7 +43,7 @@ class LatexGenerator : public OutputGenerator
bool isEnabled(OutputType o) { return (o==Latex && active); } bool isEnabled(OutputType o) { return (o==Latex && active); }
OutputGenerator *get(OutputType o) { return (o==Latex) ? this : 0; } 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 startFile(const char *name,const char *manName,const char *title);
void writeFooter() {} void writeFooter() {}
......
...@@ -75,6 +75,8 @@ HEADERS = bufstr.h \ ...@@ -75,6 +75,8 @@ HEADERS = bufstr.h \
pngenc.h \ pngenc.h \
pre.h \ pre.h \
printdocvisitor.h \ printdocvisitor.h \
pycode.h \
pyscanner.h \
qtbc.h \ qtbc.h \
reflist.h \ reflist.h \
rtfdocvisitor.h \ rtfdocvisitor.h \
...@@ -176,6 +178,8 @@ SOURCES = ce_lex.cpp \ ...@@ -176,6 +178,8 @@ SOURCES = ce_lex.cpp \
perlmodgen.cpp \ perlmodgen.cpp \
pngenc.cpp \ pngenc.cpp \
pre.cpp \ pre.cpp \
pycode.cpp \
pyscanner.cpp \
reflist.cpp \ reflist.cpp \
rtfdocvisitor.cpp \ rtfdocvisitor.cpp \
rtfgen.cpp \ rtfgen.cpp \
......
...@@ -51,6 +51,12 @@ sub GenerateDep { ...@@ -51,6 +51,12 @@ sub GenerateDep {
#$ GenerateDep("code.cpp","code.l"); #$ GenerateDep("code.cpp","code.l");
$(LEX) -PcodeYY -t code.l | $(INCBUFSIZE) >code.cpp $(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"); #$ GenerateDep("pre.cpp","pre.l");
$(LEX) -PpreYY -t pre.l | $(INCBUFSIZE) >pre.cpp $(LEX) -PpreYY -t pre.l | $(INCBUFSIZE) >pre.cpp
......
...@@ -26,10 +26,12 @@ ...@@ -26,10 +26,12 @@
#include "util.h" #include "util.h"
#include "message.h" #include "message.h"
#include <qfileinfo.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), : 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) ...@@ -186,7 +188,9 @@ void ManDocVisitor::visit(DocVerbatim *s)
if (!m_firstCol) m_t << endl; if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl; m_t << ".PP" << endl;
m_t << ".nf" << 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; if (!m_firstCol) m_t << endl;
m_t << ".fi" << endl; m_t << ".fi" << endl;
m_t << ".PP" << endl; m_t << ".PP" << endl;
...@@ -231,7 +235,11 @@ void ManDocVisitor::visit(DocInclude *inc) ...@@ -231,7 +235,11 @@ void ManDocVisitor::visit(DocInclude *inc)
m_t << ".nf" << endl; m_t << ".nf" << endl;
QFileInfo cfi( inc->file() ); QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() ); 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; if (!m_firstCol) m_t << endl;
m_t << ".fi" << endl; m_t << ".fi" << endl;
m_t << ".PP" << endl; m_t << ".PP" << endl;
...@@ -242,7 +250,10 @@ void ManDocVisitor::visit(DocInclude *inc) ...@@ -242,7 +250,10 @@ void ManDocVisitor::visit(DocInclude *inc)
if (!m_firstCol) m_t << endl; if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl; m_t << ".PP" << endl;
m_t << ".nf" << 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; if (!m_firstCol) m_t << endl;
m_t << ".fi" << endl; m_t << ".fi" << endl;
m_t << ".PP" << endl; m_t << ".PP" << endl;
...@@ -283,7 +294,12 @@ void ManDocVisitor::visit(DocIncOperator *op) ...@@ -283,7 +294,12 @@ void ManDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip) if (op->type()!=DocIncOperator::Skip)
{ {
popEnabled(); 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(); pushEnabled();
m_hide=TRUE; m_hide=TRUE;
} }
......
...@@ -21,16 +21,17 @@ ...@@ -21,16 +21,17 @@
#include "docvisitor.h" #include "docvisitor.h"
#include <qstack.h> #include <qstack.h>
#include <qcstring.h>
class QTextStream; class QTextStream;
class BaseCodeDocInterface; class CodeOutputInterface;
class QString; class QString;
/*! @brief Concrete visitor implementation for LaTeX output. */ /*! @brief Concrete visitor implementation for LaTeX output. */
class ManDocVisitor : public DocVisitor class ManDocVisitor : public DocVisitor
{ {
public: public:
ManDocVisitor(QTextStream &t,BaseCodeDocInterface &ci); ManDocVisitor(QTextStream &t,CodeOutputInterface &ci,const char *langExt);
//-------------------------------------- //--------------------------------------
// visitor functions for leaf nodes // visitor functions for leaf nodes
...@@ -142,12 +143,13 @@ class ManDocVisitor : public DocVisitor ...@@ -142,12 +143,13 @@ class ManDocVisitor : public DocVisitor
//-------------------------------------- //--------------------------------------
QTextStream &m_t; QTextStream &m_t;
BaseCodeDocInterface &m_ci; CodeOutputInterface &m_ci;
bool m_insidePre; bool m_insidePre;
bool m_hide; bool m_hide;
bool m_firstCol; bool m_firstCol;
int m_indent; int m_indent;
QStack<bool> m_enabled; QStack<bool> m_enabled;
QCString m_langExt;
}; };
#endif #endif
...@@ -627,9 +627,9 @@ void ManGenerator::endParamList() ...@@ -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); n->accept(visitor);
delete visitor; delete visitor;
firstCol=FALSE; firstCol=FALSE;
......
...@@ -40,7 +40,7 @@ class ManGenerator : public OutputGenerator ...@@ -40,7 +40,7 @@ class ManGenerator : public OutputGenerator
bool isEnabled(OutputType o) { return (o==Man && active); } bool isEnabled(OutputType o) { return (o==Man && active); }
OutputGenerator *get(OutputType o) { return (o==Man) ? this : 0; } OutputGenerator *get(OutputType o) { return (o==Man) ? this : 0; }
void printDoc(DocNode *); void printDoc(DocNode *,const char *);
static void init(); static void init();
void startFile(const char *name,const char *manName,const char *title); void startFile(const char *name,const char *manName,const char *title);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "docparser.h" #include "docparser.h"
#include "dot.h" #include "dot.h"
#include "searchindex.h" #include "searchindex.h"
#include "parserintf.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -1577,9 +1578,10 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ...@@ -1577,9 +1578,10 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
else else
ol.parseText(theTranslator->trInitialValue()); ol.parseText(theTranslator->trInitialValue());
ol.endBold(); ol.endBold();
initParseCodeContext(); ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension());
pIntf->resetCodeParserState();
ol.startCodeFragment(); ol.startCodeFragment();
parseCode(ol,scopeName,init,FALSE,0); pIntf->parseCode(ol,scopeName,init,FALSE,0);
ol.endCodeFragment(); ol.endCodeFragment();
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "namespacedef.h" #include "namespacedef.h"
#include "filedef.h" #include "filedef.h"
#include "language.h" #include "language.h"
#include "scanner.h"
#include "groupdef.h" #include "groupdef.h"
#include "doxygen.h" #include "doxygen.h"
#include "docparser.h" #include "docparser.h"
......
...@@ -39,7 +39,7 @@ class GroupDef; ...@@ -39,7 +39,7 @@ class GroupDef;
/*! \brief Output interface for code parser. /*! \brief Output interface for code parser.
*/ */
class BaseCodeDocInterface class CodeOutputInterface
{ {
public: public:
/*! Writes an ASCII string to the output. This function should keep /*! Writes an ASCII string to the output. This function should keep
...@@ -78,7 +78,7 @@ class BaseCodeDocInterface ...@@ -78,7 +78,7 @@ class BaseCodeDocInterface
* or a list of formats (see OutputList). This interface * or a list of formats (see OutputList). This interface
* contains functions that generate fragments of the output. * contains functions that generate fragments of the output.
*/ */
class BaseOutputDocInterface : public BaseCodeDocInterface class BaseOutputDocInterface : public CodeOutputInterface
{ {
public: public:
enum ParamListTypes { Param, RetVal, Exception }; enum ParamListTypes { Param, RetVal, Exception };
...@@ -272,7 +272,7 @@ class OutputGenerator : public BaseOutputDocInterface ...@@ -272,7 +272,7 @@ class OutputGenerator : public BaseOutputDocInterface
void pushGeneratorState(); void pushGeneratorState();
void popGeneratorState(); void popGeneratorState();
virtual void printDoc(DocNode *) = 0; virtual void printDoc(DocNode *,const char *langExt) = 0;
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// structural output interface // structural output interface
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "outputgen.h" #include "outputgen.h"
#include "config.h" #include "config.h"
#include "message.h" #include "message.h"
#include "definition.h"
#include "docparser.h" #include "docparser.h"
...@@ -163,7 +164,9 @@ void OutputList::parseDoc(const char *fileName,int startLine, ...@@ -163,7 +164,9 @@ void OutputList::parseDoc(const char *fileName,int startLine,
og=outputs->first(); og=outputs->first();
while (og) 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(); og=outputs->next();
} }
...@@ -186,7 +189,7 @@ void OutputList::parseText(const QCString &textStr) ...@@ -186,7 +189,7 @@ void OutputList::parseText(const QCString &textStr)
og=outputs->first(); og=outputs->first();
while (og) while (og)
{ {
if (og->isEnabled()) og->printDoc(root); if (og->isEnabled()) og->printDoc(root,0);
og=outputs->next(); og=outputs->next();
} }
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#include <qdict.h> #include <qdict.h>
class Entry; class Entry;
class FileDef;
class CodeOutputInterface;
class MemberDef;
/** \brief Abstract interface for programming language parsers. /** \brief Abstract interface for programming language parsers.
* *
...@@ -31,13 +34,58 @@ class Entry; ...@@ -31,13 +34,58 @@ class Entry;
class ParserInterface class ParserInterface
{ {
public: 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] fileName The full name of the file.
* @param[in] fileBuf The contents of the file (zero terminated). * @param[in] fileBuf The contents of the file (zero terminated).
* @param[in,out] root The root of the tree of Entry *nodes * @param[in,out] root The root of the tree of Entry *nodes
* representing the information extracted from the file. * 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. /** Callback function called by the comment block scanner.
* It provides a string \a text containing the prototype of a function * It provides a string \a text containing the prototype of a function
...@@ -60,6 +108,8 @@ class ParserInterface ...@@ -60,6 +108,8 @@ class ParserInterface
virtual void handleGroupEndCommand() = 0; virtual void handleGroupEndCommand() = 0;
}; };
//-----------------------------------------------------------------------------
/** \brief Manages programming language parsers. /** \brief Manages programming language parsers.
* *
* This class manages the language parsers in the system. One can * This class manages the language parsers in the system. One can
...@@ -70,13 +120,13 @@ class ParserManager ...@@ -70,13 +120,13 @@ class ParserManager
public: public:
/** Creates the parser manager object. /** Creates the parser manager object.
* @param defaultParser The default parser that is used when * @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. * a given input file.
*/ */
ParserManager(ParserInterface *defaultParser) ParserManager(ParserInterface *defaultParser)
: m_defaultParser(defaultParser) {} : m_defaultParser(defaultParser) {}
/** Registers a new parser. /** Registers an additional parser.
* @param[in] extension The file extension that will trigger * @param[in] extension The file extension that will trigger
* the use of this parser (e.g. ".py", or ".bas"). * the use of this parser (e.g. ".py", or ".bas").
* @param[in] parser The parser that is to be used for the * @param[in] parser The parser that is to be used for the
...@@ -87,8 +137,8 @@ class ParserManager ...@@ -87,8 +137,8 @@ class ParserManager
m_parsers.insert(extension,parser); m_parsers.insert(extension,parser);
} }
/** Gets the interface to the parser associated with given \a extension, /** Gets the interface to the parser associated with given \a extension.
* if there is no parser explicitly registered for the supplied extension, * If there is no parser explicitly registered for the supplied extension,
* the interface to the default parser will be returned. * the interface to the default parser will be returned.
*/ */
ParserInterface *getParser(const char *extension) 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 @@ ...@@ -21,20 +21,21 @@
#include "language.h" #include "language.h"
#include "doxygen.h" #include "doxygen.h"
#include "outputgen.h" #include "outputgen.h"
#include "code.h"
#include "dot.h" #include "dot.h"
#include "util.h" #include "util.h"
#include "rtfstyle.h" #include "rtfstyle.h"
#include "message.h" #include "message.h"
#include <qfileinfo.h> #include <qfileinfo.h>
#include "parserintf.h"
#define DBG_RTF(x) m_t << x #define DBG_RTF(x) m_t << x
//#define DBG_RTF(x) do {} while(0) //#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), : 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) ...@@ -322,7 +323,9 @@ void RTFDocVisitor::visit(DocVerbatim *s)
m_t << "{" << endl; m_t << "{" << endl;
m_t << "\\par" << endl; m_t << "\\par" << endl;
m_t << rtf_Style_Reset << getStyle("CodeExample"); 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 << "\\par" << endl;
m_t << "}" << endl; m_t << "}" << endl;
break; break;
...@@ -401,7 +404,11 @@ void RTFDocVisitor::visit(DocInclude *inc) ...@@ -401,7 +404,11 @@ void RTFDocVisitor::visit(DocInclude *inc)
m_t << rtf_Style_Reset << getStyle("CodeExample"); m_t << rtf_Style_Reset << getStyle("CodeExample");
QFileInfo cfi( inc->file() ); QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() ); 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 << "\\par" << endl;
m_t << "}" << endl; m_t << "}" << endl;
} }
...@@ -410,7 +417,10 @@ void RTFDocVisitor::visit(DocInclude *inc) ...@@ -410,7 +417,10 @@ void RTFDocVisitor::visit(DocInclude *inc)
m_t << "{" << endl; m_t << "{" << endl;
m_t << "\\par" << endl; m_t << "\\par" << endl;
m_t << rtf_Style_Reset << getStyle("CodeExample"); 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 << "\\par" << endl;
m_t << "}" << endl; m_t << "}" << endl;
break; break;
...@@ -449,7 +459,12 @@ void RTFDocVisitor::visit(DocIncOperator *op) ...@@ -449,7 +459,12 @@ void RTFDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip) if (op->type()!=DocIncOperator::Skip)
{ {
popEnabled(); 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(); pushEnabled();
m_hide=TRUE; m_hide=TRUE;
} }
......
...@@ -21,16 +21,17 @@ ...@@ -21,16 +21,17 @@
#include "docvisitor.h" #include "docvisitor.h"
#include <qstack.h> #include <qstack.h>
#include <qcstring.h>
class QTextStream; class QTextStream;
class BaseCodeDocInterface; class CodeOutputInterface;
class QString; class QString;
/*! @brief Concrete visitor implementation for RTF output. */ /*! @brief Concrete visitor implementation for RTF output. */
class RTFDocVisitor : public DocVisitor class RTFDocVisitor : public DocVisitor
{ {
public: public:
RTFDocVisitor(QTextStream &t,BaseCodeDocInterface &ci); RTFDocVisitor(QTextStream &t,CodeOutputInterface &ci,const char *langExt);
//-------------------------------------- //--------------------------------------
// visitor functions for leaf nodes // visitor functions for leaf nodes
...@@ -149,12 +150,13 @@ class RTFDocVisitor : public DocVisitor ...@@ -149,12 +150,13 @@ class RTFDocVisitor : public DocVisitor
//-------------------------------------- //--------------------------------------
QTextStream &m_t; QTextStream &m_t;
BaseCodeDocInterface &m_ci; CodeOutputInterface &m_ci;
bool m_insidePre; bool m_insidePre;
bool m_hide; bool m_hide;
int m_indentLevel; int m_indentLevel;
QStack<bool> m_enabled; QStack<bool> m_enabled;
bool m_lastIsPara; bool m_lastIsPara;
QCString m_langExt;
}; };
#endif #endif
...@@ -2483,9 +2483,9 @@ void RTFGenerator::endParamList() ...@@ -2483,9 +2483,9 @@ void RTFGenerator::endParamList()
t << "}"; 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); n->accept(visitor);
delete visitor; delete visitor;
} }
......
...@@ -43,7 +43,7 @@ class RTFGenerator : public OutputGenerator ...@@ -43,7 +43,7 @@ class RTFGenerator : public OutputGenerator
bool isEnabled(OutputType o) { return (o==RTF && active); } bool isEnabled(OutputType o) { return (o==RTF && active); }
OutputGenerator *get(OutputType o) { return (o==RTF) ? this : 0; } 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 startFile(const char *name,const char *manName,const char *title);
void writeFooter() {} void writeFooter() {}
......
...@@ -24,32 +24,30 @@ ...@@ -24,32 +24,30 @@
* *
* This is the language parser for doxygen. It is somewhat fuzzy and * This is the language parser for doxygen. It is somewhat fuzzy and
* supports C++ and various languages that are closely related to C++, * 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 class CLanguageScanner : public ParserInterface
{ {
public: 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 parsePrototype(const char *text);
void handleGroupStartCommand(const char *header); void handleGroupStartCommand(const char *header);
void handleGroupEndCommand(); 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 #endif
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "defargs.h" #include "defargs.h"
#include "language.h" #include "language.h"
#include "commentscan.h" #include "commentscan.h"
#include "code.h"
#define YY_NEVER_INTERACTIVE 1 #define YY_NEVER_INTERACTIVE 1
...@@ -1843,6 +1844,42 @@ IDLATTR ("["[^\]]*"]"){BN}* ...@@ -1843,6 +1844,42 @@ IDLATTR ("["[^\]]*"]"){BN}*
handleGroupStartCommand(current->name); handleGroupStartCommand(current->name);
current = tmp; current = tmp;
initEntry(); 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}"}".*"*/" { <FindMembers,FindFields,ReadInitializer>"//"([!/]?){B}*{CMD}"}".*|"/*"([!*]?){B}*{CMD}"}".*"*/" {
handleGroupEndCommand(); handleGroupEndCommand();
...@@ -4540,12 +4577,42 @@ static void 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; g_thisParser = this;
::parseMain(fileName,fileBuf,root); ::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) void CLanguageScanner::parsePrototype(const char *text)
{ {
::parsePrototype(text); ::parsePrototype(text);
......
...@@ -2698,6 +2698,8 @@ static QCString getCanonicalTypeForIdentifier( ...@@ -2698,6 +2698,8 @@ static QCString getCanonicalTypeForIdentifier(
symName=word; symName=word;
} }
//printf("symName=%s templSpec=%s\n",symName.data(),templSpec.data());
if (!symName.isEmpty() && !templSpec.isEmpty() && if (!symName.isEmpty() && !templSpec.isEmpty() &&
(defList=Doxygen::symbolMap->find(symName+templSpec)) && (defList=Doxygen::symbolMap->find(symName+templSpec)) &&
defList->count()==1) // word without scope but with template specs defList->count()==1) // word without scope but with template specs
...@@ -2733,6 +2735,10 @@ static QCString getCanonicalTypeForIdentifier( ...@@ -2733,6 +2735,10 @@ static QCString getCanonicalTypeForIdentifier(
if (cd) // known type if (cd) // known type
{ {
result = cd->qualifiedNameWithTemplateParameters(); result = cd->qualifiedNameWithTemplateParameters();
if (cd->isTemplate())
{
*tSpec="";
}
} }
else if (mType && mType->isEnumerate()) // an enum else if (mType && mType->isEnumerate()) // an enum
{ {
...@@ -2799,15 +2805,15 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,const Argument *a ...@@ -2799,15 +2805,15 @@ static QCString extractCanonicalType(Definition *d,FileDef *fs,const Argument *a
// then resolve any identifiers inside. // then resolve any identifiers inside.
{ {
static QRegExp re("[a-z_A-Z][a-z_A-Z0-9]*"); 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 // 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 += templSpec.mid(tp,ti-tp);
canType += getCanonicalTypeForIdentifier(d,fs,word,0); canType += getCanonicalTypeForIdentifier(d,fs,templSpec.mid(ti,tl),0);
p=i+l; tp=ti+tl;
} }
canType+=templSpec.right(templSpec.length()-p); canType+=templSpec.right(templSpec.length()-tp);
} }
pp=p; pp=p;
......
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
#include "doxygen.h" #include "doxygen.h"
#include "outputgen.h" #include "outputgen.h"
#include "xmlgen.h" #include "xmlgen.h"
#include "code.h"
#include "dot.h" #include "dot.h"
#include "message.h" #include "message.h"
#include "util.h" #include "util.h"
#include <qfileinfo.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) : DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
{ {
} }
...@@ -169,7 +169,9 @@ void XmlDocVisitor::visit(DocVerbatim *s) ...@@ -169,7 +169,9 @@ void XmlDocVisitor::visit(DocVerbatim *s)
{ {
case DocVerbatim::Code: // fall though case DocVerbatim::Code: // fall though
m_t << "<programlisting>"; 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>"; m_t << "</programlisting>";
break; break;
case DocVerbatim::Verbatim: case DocVerbatim::Verbatim:
...@@ -219,13 +221,21 @@ void XmlDocVisitor::visit(DocInclude *inc) ...@@ -219,13 +221,21 @@ void XmlDocVisitor::visit(DocInclude *inc)
m_t << "<programlisting>"; m_t << "<programlisting>";
QFileInfo cfi( inc->file() ); QFileInfo cfi( inc->file() );
FileDef fd( cfi.dirPath(), cfi.fileName() ); 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>"; m_t << "</programlisting>";
} }
break; break;
case DocInclude::Include: case DocInclude::Include:
m_t << "<programlisting>"; 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>"; m_t << "</programlisting>";
break; break;
case DocInclude::DontInclude: case DocInclude::DontInclude:
...@@ -259,7 +269,13 @@ void XmlDocVisitor::visit(DocIncOperator *op) ...@@ -259,7 +269,13 @@ void XmlDocVisitor::visit(DocIncOperator *op)
if (op->type()!=DocIncOperator::Skip) if (op->type()!=DocIncOperator::Skip)
{ {
popEnabled(); 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(); pushEnabled();
m_hide=TRUE; m_hide=TRUE;
} }
......
...@@ -21,16 +21,17 @@ ...@@ -21,16 +21,17 @@
#include "docvisitor.h" #include "docvisitor.h"
#include <qstack.h> #include <qstack.h>
#include <qcstring.h>
class QTextStream; class QTextStream;
class BaseCodeDocInterface; class CodeOutputInterface;
class QString; class QString;
/*! @brief Concrete visitor implementation for XML output. */ /*! @brief Concrete visitor implementation for XML output. */
class XmlDocVisitor : public DocVisitor class XmlDocVisitor : public DocVisitor
{ {
public: public:
XmlDocVisitor(QTextStream &t,BaseCodeDocInterface &ci); XmlDocVisitor(QTextStream &t,CodeOutputInterface &ci);
//-------------------------------------- //--------------------------------------
// visitor functions for leaf nodes // visitor functions for leaf nodes
...@@ -145,10 +146,11 @@ class XmlDocVisitor : public DocVisitor ...@@ -145,10 +146,11 @@ class XmlDocVisitor : public DocVisitor
//-------------------------------------- //--------------------------------------
QTextStream &m_t; QTextStream &m_t;
BaseCodeDocInterface &m_ci; CodeOutputInterface &m_ci;
bool m_insidePre; bool m_insidePre;
bool m_hide; bool m_hide;
QStack<bool> m_enabled; QStack<bool> m_enabled;
QCString m_langExt;
}; };
#endif #endif
...@@ -28,13 +28,13 @@ ...@@ -28,13 +28,13 @@
#include "defargs.h" #include "defargs.h"
#include "outputgen.h" #include "outputgen.h"
#include "dot.h" #include "dot.h"
#include "code.h"
#include "pagedef.h" #include "pagedef.h"
#include "filename.h" #include "filename.h"
#include "version.h" #include "version.h"
#include "xmldocvisitor.h" #include "xmldocvisitor.h"
#include "docparser.h" #include "docparser.h"
#include "language.h" #include "language.h"
#include "parserintf.h"
#include <qdir.h> #include <qdir.h>
#include <qfile.h> #include <qfile.h>
...@@ -222,7 +222,7 @@ template<class T> class ValStack ...@@ -222,7 +222,7 @@ template<class T> class ValStack
}; };
class XMLCodeGenerator : public BaseCodeDocInterface class XMLCodeGenerator : public CodeOutputInterface
{ {
public: public:
...@@ -443,14 +443,15 @@ static void writeXMLDocBlock(QTextStream &t, ...@@ -443,14 +443,15 @@ static void writeXMLDocBlock(QTextStream &t,
void writeXMLCodeBlock(QTextStream &t,FileDef *fd) void writeXMLCodeBlock(QTextStream &t,FileDef *fd)
{ {
initParseCodeContext(); ParserInterface *pIntf=Doxygen::parserManager->getParser(fd->getDefFileExtension());
pIntf->resetCodeParserState();
XMLCodeGenerator *xmlGen = new XMLCodeGenerator(t); XMLCodeGenerator *xmlGen = new XMLCodeGenerator(t);
parseCode(*xmlGen, pIntf->parseCode(*xmlGen,
0, 0,
fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES")), fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES")),
FALSE, FALSE,
0, 0,
fd); fd);
xmlGen->finish(); xmlGen->finish();
delete xmlGen; delete xmlGen;
} }
...@@ -563,9 +564,10 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De ...@@ -563,9 +564,10 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De
case Private: t << "private"; break; case Private: t << "private"; break;
case Package: t << "package"; break; case Package: t << "package"; break;
} }
t << "\" static=\""; t << "\"";
if (md->isStatic()) t << "yes"; else t << "no";
t << " static=\"";
if (md->isStatic()) t << "yes"; else t << "no";
t << "\""; t << "\"";
if (isFunc) if (isFunc)
...@@ -573,22 +575,24 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De ...@@ -573,22 +575,24 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De
ArgumentList *al = md->argumentList(); ArgumentList *al = md->argumentList();
t << " const=\""; t << " const=\"";
if (al && al->constSpecifier) t << "yes"; else t << "no"; if (al && al->constSpecifier) t << "yes"; else t << "no";
t << "\"";
t << "\" explicit=\""; t << " explicit=\"";
if (md->isExplicit()) t << "yes"; else t << "no"; if (md->isExplicit()) t << "yes"; else t << "no";
t << "\"";
t << "\" inline=\""; t << " inline=\"";
if (md->isInline()) t << "yes"; else t << "no"; if (md->isInline()) t << "yes"; else t << "no";
t << "\"";
t << "\" virt=\""; t << " virt=\"";
switch (md->virtualness()) switch (md->virtualness())
{ {
case Normal: t << "non-virtual"; break; case Normal: t << "non-virtual"; break;
case Virtual: t << "virtual"; break; case Virtual: t << "virtual"; break;
case Pure: t << "pure-virtual"; break; case Pure: t << "pure-virtual"; break;
default: ASSERT(0); default: ASSERT(0);
} }
t << "\""; t << "\"";
} }
...@@ -598,15 +602,16 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De ...@@ -598,15 +602,16 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De
//t << " volatile=\""; //t << " volatile=\"";
//if (al && al->volatileSpecifier) t << "yes"; else t << "no"; //if (al && al->volatileSpecifier) t << "yes"; else t << "no";
t << "\" mutable=\""; t << " mutable=\"";
if (md->isMutable()) t << "yes"; else t << "no"; if (md->isMutable()) t << "yes"; else t << "no";
t << "\""; t << "\"";
} }
else if (md->memberType() == MemberDef::Property) else if (md->memberType() == MemberDef::Property)
{ {
t << " readable=\""; t << " readable=\"";
if (md->isReadable()) t << "yes"; else t << "no"; if (md->isReadable()) t << "yes"; else t << "no";
t << "\"";
t << "\" writable=\""; t << "\" writable=\"";
if (md->isWritable()) t << "yes"; else t << "no"; if (md->isWritable()) t << "yes"; else t << "no";
t << "\""; 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