summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2014-08-04 12:08:44 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2014-08-04 12:08:44 (GMT)
commit7d204d1d76c6531dd55e7d59415d07e846596f98 (patch)
tree9f5bacca36d0ec1aaf23a3a167d154dcc957db5e /src
parentfe533aeb3d6618d30d2b1c99527812a8cf8cf1fe (diff)
parent0dd59398b3f62288897c8c3405977a27a94fbfee (diff)
downloadDoxygen-7d204d1d76c6531dd55e7d59415d07e846596f98.zip
Doxygen-7d204d1d76c6531dd55e7d59415d07e846596f98.tar.gz
Doxygen-7d204d1d76c6531dd55e7d59415d07e846596f98.tar.bz2
Merge branch 'bug734099'
Diffstat (limited to 'src')
-rw-r--r--src/doxygen.cpp4
-rw-r--r--src/fileparser.cpp51
-rw-r--r--src/fileparser.h50
-rw-r--r--src/libdoxygen.pro.in2
-rw-r--r--src/parserintf.h10
-rw-r--r--src/util.cpp32
6 files changed, 139 insertions, 10 deletions
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index c012050..7caac5e 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -98,6 +98,7 @@
#include "formula.h"
#include "settings.h"
#include "context.h"
+#include "fileparser.h"
#define RECURSE_ENTRYTREE(func,var) \
do { if (var->children()) { \
@@ -9895,7 +9896,8 @@ void initDoxygen()
initPreprocessor();
Doxygen::parserManager = new ParserManager;
- Doxygen::parserManager->registerParser("c", new CLanguageScanner, TRUE);
+ Doxygen::parserManager->registerDefaultParser( new FileParser);
+ Doxygen::parserManager->registerParser("c", new CLanguageScanner);
Doxygen::parserManager->registerParser("python", new PythonLanguageScanner);
Doxygen::parserManager->registerParser("fortran", new FortranLanguageScanner);
Doxygen::parserManager->registerParser("fortranfree", new FortranLanguageScannerFree);
diff --git a/src/fileparser.cpp b/src/fileparser.cpp
new file mode 100644
index 0000000..31434a8
--- /dev/null
+++ b/src/fileparser.cpp
@@ -0,0 +1,51 @@
+/******************************************************************************
+ *
+ * Copyright (C) 1997-2014 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.
+ *
+ */
+
+#include "fileparser.h"
+#include "outputgen.h"
+
+void FileParser::parseCode(CodeOutputInterface &codeOutIntf,
+ const char *, // scopeName
+ const QCString & input,
+ SrcLangExt, // lang
+ bool, // isExampleBlock
+ const char *, // exampleName
+ FileDef *, // fileDef
+ int startLine,
+ int endLine,
+ bool, // inlineFragment
+ MemberDef *, // memberDef
+ bool showLineNumbers,
+ Definition *, // searchCtx,
+ bool // collectXRefs
+ )
+{
+ int lineNr = startLine!=-1 ? startLine : 1;
+ int length = input.length();
+ int i=0;
+ while (i<length && (endLine==-1 || lineNr<=endLine))
+ {
+ int j=i;
+ while (j<length && input[j]!='\n') j++;
+ QCString lineStr = input.mid(i,j-i);
+ codeOutIntf.startCodeLine(showLineNumbers);
+ if (showLineNumbers) codeOutIntf.writeLineNumber(0,0,0,lineNr);
+ codeOutIntf.codify(lineStr);
+ codeOutIntf.endCodeLine();
+ lineNr++;
+ i=j+1;
+ }
+}
+
diff --git a/src/fileparser.h b/src/fileparser.h
new file mode 100644
index 0000000..f9a7c7b
--- /dev/null
+++ b/src/fileparser.h
@@ -0,0 +1,50 @@
+/******************************************************************************
+ *
+ * Copyright (C) 1997-2014 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.
+ *
+ */
+
+#ifndef FILEPARSER_H
+#define FILEPARSER_H
+
+#include "parserintf.h"
+
+/** @brief General file parser */
+class FileParser : public ParserInterface
+{
+ public:
+ virtual ~FileParser() {}
+ void startTranslationUnit(const char *) {}
+ void finishTranslationUnit() {}
+ void parseInput(const char *, const char *,Entry *, bool, QStrList &) {}
+ bool needsPreprocessing(const QCString &) { return FALSE; }
+ void parseCode(CodeOutputInterface &codeOutIntf,
+ const char *scopeName,
+ const QCString &input,
+ SrcLangExt lang,
+ bool isExampleBlock,
+ const char *exampleName=0,
+ FileDef *fileDef=0,
+ int startLine=-1,
+ int endLine=-1,
+ bool inlineFragment=FALSE,
+ MemberDef *memberDef=0,
+ bool showLineNumbers=TRUE,
+ Definition *searchCtx=0,
+ bool collectXRefs=TRUE
+ );
+ void resetCodeParserState() {}
+ void parsePrototype(const char *) {}
+};
+
+
+#endif
diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in
index 435a4c5..f50f987 100644
--- a/src/libdoxygen.pro.in
+++ b/src/libdoxygen.pro.in
@@ -50,6 +50,7 @@ HEADERS = arguments.h \
example.h \
filedef.h \
filename.h \
+ fileparser.h \
formula.h \
ftextstream.h \
ftvhelp.h \
@@ -146,6 +147,7 @@ SOURCES = arguments.cpp \
entry.cpp \
filedef.cpp \
filename.cpp \
+ fileparser.cpp \
formula.cpp \
ftextstream.cpp \
ftvhelp.cpp \
diff --git a/src/parserintf.h b/src/parserintf.h
index c389597..019b4a9 100644
--- a/src/parserintf.h
+++ b/src/parserintf.h
@@ -148,17 +148,19 @@ class ParserManager
ParserManager()
: m_defaultParser(0) { m_parsers.setAutoDelete(TRUE); }
+ void registerDefaultParser(ParserInterface *parser)
+ {
+ m_defaultParser = parser;
+ }
+
/** Registers an additional parser.
* @param[in] name A symbolic name of the parser, i.e. "c",
* "python", "fortran", "vhdl", ...
* @param[in] parser The parser that is to be used for the
* given name.
- * @param[in] defParser Use this parser as the default parser, used
- * for unregistered file extensions.
*/
- void registerParser(const char *name,ParserInterface *parser,bool defParser=FALSE)
+ void registerParser(const char *name,ParserInterface *parser)
{
- if (defParser && m_defaultParser==0) m_defaultParser=parser;
m_parsers.insert(name,parser);
}
diff --git a/src/util.cpp b/src/util.cpp
index 73a863a..bcb1390 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -6704,15 +6704,37 @@ void initDefaultExtensionMapping()
{
g_extLookup.setAutoDelete(TRUE);
// extension parser id
- updateLanguageMapping(".idl", "idl");
- updateLanguageMapping(".ddl", "idl");
- updateLanguageMapping(".odl", "idl");
+ updateLanguageMapping(".dox", "c");
+ updateLanguageMapping(".txt", "c");
+ updateLanguageMapping(".doc", "c");
+ updateLanguageMapping(".c", "c");
+ updateLanguageMapping(".C", "c");
+ updateLanguageMapping(".cc", "c");
+ updateLanguageMapping(".CC", "c");
+ updateLanguageMapping(".cxx", "c");
+ updateLanguageMapping(".cpp", "c");
+ updateLanguageMapping(".c++", "c");
+ updateLanguageMapping(".ii", "c");
+ updateLanguageMapping(".ixx", "c");
+ updateLanguageMapping(".ipp", "c");
+ updateLanguageMapping(".i++", "c");
+ updateLanguageMapping(".inl", "c");
+ updateLanguageMapping(".h", "c");
+ updateLanguageMapping(".H", "c");
+ updateLanguageMapping(".hh", "c");
+ updateLanguageMapping(".HH", "c");
+ updateLanguageMapping(".hxx", "c");
+ updateLanguageMapping(".hpp", "c");
+ updateLanguageMapping(".h++", "c");
+ updateLanguageMapping(".idl", "idl");
+ updateLanguageMapping(".ddl", "idl");
+ updateLanguageMapping(".odl", "idl");
updateLanguageMapping(".java", "java");
- updateLanguageMapping(".as", "javascript");
+ updateLanguageMapping(".as", "javascript");
updateLanguageMapping(".js", "javascript");
updateLanguageMapping(".cs", "csharp");
updateLanguageMapping(".d", "d");
- updateLanguageMapping(".php", "php");
+ updateLanguageMapping(".php", "php");
updateLanguageMapping(".php4", "php");
updateLanguageMapping(".php5", "php");
updateLanguageMapping(".inc", "php");