From 0dd59398b3f62288897c8c3405977a27a94fbfee Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 4 Aug 2014 14:07:53 +0200 Subject: Bug 734099 - Add support for non-parsed language --- doc/commands.doc | 14 ++++++++++++++ doc/docblocks.doc | 19 +++++++++++++++++- src/doxygen.cpp | 4 +++- src/fileparser.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ src/fileparser.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ src/libdoxygen.pro.in | 2 ++ src/parserintf.h | 10 ++++++---- src/util.cpp | 32 ++++++++++++++++++++++++++----- winbuild/Doxygen.vcproj | 8 ++++++++ 9 files changed, 179 insertions(+), 11 deletions(-) create mode 100644 src/fileparser.cpp create mode 100644 src/fileparser.h diff --git a/doc/commands.doc b/doc/commands.doc index 5743832..9175856 100644 --- a/doc/commands.doc +++ b/doc/commands.doc @@ -2356,6 +2356,20 @@ Commands for visual enhancements \endcode \endverbatim + If the contents of the code block are in a language that doxygen cannot parse, doxygen + will just show the output as-is. You can make this explicit using .unparsed, or by + giving some other extension that doxygen doesn't support, e.g. + +\verbatim + \code{.unparsed} + Show this as-is please + \endcode + + \code{.sh} + echo "This is a shell script" + \endcode +\endverbatim + \sa section \ref cmdendcode "\\endcode" and section \ref cmdverbatim "\\verbatim".
diff --git a/doc/docblocks.doc b/doc/docblocks.doc index c74211c..333e5d2 100644 --- a/doc/docblocks.doc +++ b/doc/docblocks.doc @@ -371,7 +371,7 @@ typedef, enum or preprocessor definition you must first document the file that contains it (usually this will be a header file, because that file contains the information that is exported to other source files). -Let's repeat that, because it is often overlooked: +@attention Let's repeat that, because it is often overlooked: to document global objects (functions, typedefs, enum, macros, etc), you must document the file in which they are defined. In other words, there must at least be a \verbatim /*! \file */ \endverbatim @@ -395,6 +395,23 @@ using structural commands: in comment blocks which are place in front of a function. This is clearly a case where the \\fn command is redundant and will only lead to problems. + When you place a comment block in a file with one of the following extensions + `.dox`, `.txt`, or `.doc` then doxygen will hide this file from the file list. + + If you have a file that doxygen cannot parse but still would like to document it, + you can show it as-is using \ref cmdverbinclude "\\verbinclude", e.g. + +\verbatim +/*! \file myscript.sh + * Look at this nice script: + * \verbinclude myscript.sh + */ +\endverbatim + +Make sure that the script is explicitly listed in the \ref cfg_input "INPUT" or +that \ref cfg_file_patterns "FILE_PATTERNS" includes the `.sh` extention and the +the script can be found in the path set via \ref cfg_example_path "EXAMPLE_PATH". + \subsection pythonblocks Comment blocks in Python For Python there is a standard way of documenting the code using 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 + + @@ -2383,6 +2387,10 @@ > + + -- cgit v0.12