summaryrefslogtreecommitdiffstats
path: root/src/fortranscanner.l
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2015-01-01 14:28:08 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2015-01-02 09:45:18 (GMT)
commit4d52beec3760244d959ab4d5528aea1acba505e7 (patch)
tree44f7a6a04769b6c6e60cb1448e2acbdf31c03a39 /src/fortranscanner.l
parent312bef563a5be72f6423377247db1b80044bf711 (diff)
downloadDoxygen-4d52beec3760244d959ab4d5528aea1acba505e7.zip
Doxygen-4d52beec3760244d959ab4d5528aea1acba505e7.tar.gz
Doxygen-4d52beec3760244d959ab4d5528aea1acba505e7.tar.bz2
Documenting RESULT variable of Fortran FUNCTION
Fortran functions can specify the return value by means of a variable in the RESULT attribute. Analogous to argument variables (@param) it is now possible to document also the return / RESULT variable (@returns).
Diffstat (limited to 'src/fortranscanner.l')
-rw-r--r--src/fortranscanner.l53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index 4875606..e28158f 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -72,7 +72,7 @@
#define YY_NEVER_INTERACTIVE 1
#define YY_NO_INPUT 1
-enum ScanVar { V_IGNORE, V_VARIABLE, V_PARAMETER};
+enum ScanVar { V_IGNORE, V_VARIABLE, V_PARAMETER, V_RESULT};
enum InterfaceType { IF_NONE, IF_SPECIFIC, IF_GENERIC, IF_ABSTRACT };
// {{{ ----- Helper structs -----
@@ -202,6 +202,7 @@ static int yyread(char *buf,int max_size);
static void startCommentBlock(bool);
static void handleCommentBlock(const QCString &doc,bool brief);
static void subrHandleCommentBlock(const QCString &doc,bool brief);
+static void subrHandleCommentBlockResult(const QCString &doc,bool brief);
static void addCurrentEntry(int case_insens);
static void addModule(const char *name, bool isModule=FALSE);
static void addSubprogram(const char *text);
@@ -844,6 +845,7 @@ private {
QCString rght;
if (strt != -1)
{
+ v_type = V_RESULT;
lft = "";
rght = "";
if (strt != 0) lft = current_root->type.left(strt).stripWhiteSpace();
@@ -864,6 +866,10 @@ private {
}
if (current_root->type.length() > 0) current_root->type += " ";
current_root->type += "function";
+ if (!docBlock.isNull())
+ {
+ subrHandleCommentBlockResult(docBlock,TRUE);
+ }
}
else
{
@@ -1105,6 +1111,10 @@ private {
{
subrHandleCommentBlock(docBlock,TRUE);
}
+ else if (v_type == V_RESULT)
+ {
+ subrHandleCommentBlockResult(docBlock,TRUE);
+ }
yy_pop_state();
docBlock.resize(0);
}
@@ -2322,6 +2332,47 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief)
// reset current back to the part inside the routine
current=tmp_entry;
}
+//----------------------------------------------------------------------------
+/// Handle result description as defined after the declaration of the parameter
+static void subrHandleCommentBlockResult(const QCString &doc,bool brief)
+{
+ QCString loc_doc;
+ loc_doc = doc.stripWhiteSpace();
+
+ Entry *tmp_entry = current;
+ current = subrCurrent.getFirst(); // temporarily switch to the entry of the subroutine / function
+
+ // Still in the specification section so no inbodyDocs yet, but parameter documentation
+ current->inbodyDocs = "";
+
+ // strip \\param or @param, so we can do some extra checking. We will add it later on again.
+ if (loc_doc.find("\\returns") == 0)
+ {
+ loc_doc = loc_doc.right(loc_doc.length()-strlen("\\returns")).stripWhiteSpace();
+ }
+ else if (loc_doc.find("@returns") == 0)
+ {
+ loc_doc = loc_doc.right(loc_doc.length()-strlen("@returns")).stripWhiteSpace();
+ }
+ if (loc_doc.find("\\return") == 0)
+ {
+ loc_doc = loc_doc.right(loc_doc.length()-strlen("\\return")).stripWhiteSpace();
+ }
+ else if (loc_doc.find("@return") == 0)
+ {
+ loc_doc = loc_doc.right(loc_doc.length()-strlen("@return")).stripWhiteSpace();
+ }
+
+ if (loc_doc.isEmpty() || (loc_doc.lower() == argName.lower()))
+ {
+ current=tmp_entry;
+ return;
+ }
+ handleCommentBlock(QCString("\n\n@returns ") + loc_doc,brief);
+
+ // reset current back to the part inside the routine
+ current=tmp_entry;
+}
//----------------------------------------------------------------------------
#if 0