summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-12-12 20:11:53 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-12-12 20:11:53 (GMT)
commitec2f456688dcc33008f7649d33930b49a71dff30 (patch)
treea2daf8ca66bc624aca958cea35f2e3a1afe7489e
parent8e9306fe1f1673772b6695ee390ce781898e8565 (diff)
parentac303e2ff9e3a66cbe128c30c2986ed92851ceb6 (diff)
downloadDoxygen-ec2f456688dcc33008f7649d33930b49a71dff30.zip
Doxygen-ec2f456688dcc33008f7649d33930b49a71dff30.tar.gz
Doxygen-ec2f456688dcc33008f7649d33930b49a71dff30.tar.bz2
Merge branch 'feature/issue_7436' of https://github.com/albert-github/doxygen into albert-github-feature/issue_7436
-rw-r--r--doc/docblocks.doc3
-rw-r--r--src/growbuf.h1
-rw-r--r--src/vhdljjparser.cpp35
-rw-r--r--src/vhdljjparser.h2
-rw-r--r--vhdlparser/vhdlparser.jj12
5 files changed, 45 insertions, 8 deletions
diff --git a/doc/docblocks.doc b/doc/docblocks.doc
index 9d14f6e..a427b76 100644
--- a/doc/docblocks.doc
+++ b/doc/docblocks.doc
@@ -513,6 +513,9 @@ Here is an example VHDL file with doxygen comments:
for the corresponding \mbox{\LaTeX} documentation that is generated by doxygen.
\endlatexonly
+As of VHDL 2008 it is also to use `/&zwj;*` type comments. Doxygen will handle `/&zwj;* ... *&zwj;/`
+as plain comments and `/&zwj;*! ... *&zwj;/` comments as special doxygen comments with documentaton.
+
To get proper looking output you need to set
\ref cfg_optimize_output_vhdl "OPTIMIZE_OUTPUT_VHDL" to \c YES in the
configuration file. This will also affect a number of other settings. When they
diff --git a/src/growbuf.h b/src/growbuf.h
index 4c49dce..bf6d74e 100644
--- a/src/growbuf.h
+++ b/src/growbuf.h
@@ -47,6 +47,7 @@ class GrowBuf
}
const char *get() { return str; }
int getPos() const { return pos; }
+ void setPos(const int newPos) { pos = newPos; }
char at(int i) const { return str[i]; }
private:
char *str;
diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp
index 8b7ebf6..4848a3e 100644
--- a/src/vhdljjparser.cpp
+++ b/src/vhdljjparser.cpp
@@ -29,6 +29,7 @@
#include "arguments.h"
#include "types.h"
#include "VhdlParserIF.h"
+#include "growbuf.h"
using namespace vhdl::parser;
using namespace std;
@@ -169,7 +170,7 @@ void VhdlParser::lineCount(const char* text)
{
for (const char* c=text ; *c ; ++c )
{
- yyLineNr += (*c == '\n') ;
+ if (*c == '\n') yyLineNr++;
}
}
@@ -744,3 +745,35 @@ const char *getVhdlFileName(void)
{
return vhdlFileName;
}
+
+QCString filter2008VhdlComment(const char *s)
+{
+ GrowBuf growBuf;
+ const char *p=s+3; // skip /*!
+ char c,pc='\0';
+ while (*p == ' ' || *p == '\t') p++;
+ while ((c=*p++))
+ {
+ growBuf.addChar(c);
+ if (c == '\n')
+ {
+ // special handling of space followed by * at beginning of line
+ while (*p == ' ' || *p == '\t') p++;
+ while (*p == '*') p++;
+ // special attention in case character at end is /
+ if (*p == '/') p++;
+ }
+ }
+ // special attention in case */ at end of last line
+ int len = growBuf.getPos();
+ if (growBuf.at(len-1) == '/' && growBuf.at(len-2) == '*')
+ {
+ len -= 2;
+ while (growBuf.at(len-1) == '*') len--;
+ c = growBuf.at(len-1);
+ while ((c = growBuf.at(len-1)) == ' ' || c == '\t') len--;
+ growBuf.setPos(len);
+ }
+ growBuf.addChar(0);
+ return growBuf.get();
+}
diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h
index 53eb0be..f6cd17d 100644
--- a/src/vhdljjparser.h
+++ b/src/vhdljjparser.h
@@ -83,5 +83,5 @@ void vhdlscanFreeScanner();
const QList<VhdlConfNode>& getVhdlConfiguration();
const std::vector<std::shared_ptr<Entry> >&getVhdlInstList();
-
+QCString filter2008VhdlComment(const char *s);
#endif
diff --git a/vhdlparser/vhdlparser.jj b/vhdlparser/vhdlparser.jj
index 8a76bc6..3151528 100644
--- a/vhdlparser/vhdlparser.jj
+++ b/vhdlparser/vhdlparser.jj
@@ -107,17 +107,17 @@ SKIP:
// VHDL 2008 doxygen comment /*! .... */
SKIP :
{
- <MULT_DOXYGEN_VHDL_COMMENT_2008 : "/*!" (~[])* "*/" >
+ <MULT_DOXYGEN_VHDL_COMMENT_2008 : "/*!" (~["*"])* "*" ("*" | ~["*","/"] (~["*"])* "*")* "/">
{
{
- QCString q(image.data());
- q.stripPrefix("/*!");
- q.resize(q.length()-2);
+ QCString q = filter2008VhdlComment(image.data());
::vhdl::parser::VhdlParser::handleCommentBlock(q.data(),TRUE);image.clear();
}
}
- | <MULT_VHDL_2008_COMMENT : "/*" (~[])* "*/" > {::vhdl::parser::VhdlParser::lineCount(image.data());image.clear();}
-}
+ | <MULT_VHDL_2008_COMMENT : "/*" (~["*"])* "*" ("*" | ~["*","/"] (~["*"])* "*")* "/">
+ {
+ ::vhdl::parser::VhdlParser::lineCount(image.data());image.clear();}
+ }
/* KEYWORDS */