summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-12-12 21:21:57 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-12-12 21:21:57 (GMT)
commit568bb9eed0b52a0dd0eda1a078bb895072084d43 (patch)
treea7eb8c8768d5026f93d478203884dbaff23fbdc8
parent8e9306fe1f1673772b6695ee390ce781898e8565 (diff)
parent5698b7556966fe39c1a808f609a3e14bd648786d (diff)
downloadDoxygen-568bb9eed0b52a0dd0eda1a078bb895072084d43.zip
Doxygen-568bb9eed0b52a0dd0eda1a078bb895072084d43.tar.gz
Doxygen-568bb9eed0b52a0dd0eda1a078bb895072084d43.tar.bz2
Merge branch 'albert-github-feature/issue_7436'
-rw-r--r--doc/docblocks.doc4
-rw-r--r--src/growbuf.h1
-rw-r--r--src/vhdljjparser.cpp35
-rw-r--r--src/vhdljjparser.h2
-rw-r--r--vhdlparser/VhdlParserTokenManager.cc204
-rw-r--r--vhdlparser/VhdlParserTokenManager.h4
-rw-r--r--vhdlparser/vhdlparser.jj12
7 files changed, 167 insertions, 95 deletions
diff --git a/doc/docblocks.doc b/doc/docblocks.doc
index 9d14f6e..8e99669 100644
--- a/doc/docblocks.doc
+++ b/doc/docblocks.doc
@@ -513,6 +513,10 @@ 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 possible to use `/&zwj;*` style comments.
+Doxygen will handle `/&zwj;* ... *&zwj;/`as plain comments and `/&zwj;*! ... *&zwj;/`
+style comments as special comments to be parsed by doxygen.
+
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..5dfa9f6 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='\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/VhdlParserTokenManager.cc b/vhdlparser/VhdlParserTokenManager.cc
index 01e8d37..5edbfc5 100644
--- a/vhdlparser/VhdlParserTokenManager.cc
+++ b/vhdlparser/VhdlParserTokenManager.cc
@@ -13,10 +13,10 @@ static const unsigned long long jjbitVec3[] = {
0x0ULL, 0x0ULL, 0xffffffff00000000ULL, 0xffffffffffffffffULL
};
static const int jjnextStates[] = {
- 54, 55, 56, 57, 58, 61, 65, 66, 67, 76, 21, 48, 49, 2, 37, 38,
+ 58, 59, 60, 61, 62, 65, 69, 70, 71, 80, 21, 50, 51, 2, 37, 38,
0, 3, 4, 5, 7, 12, 13, 15, 16, 24, 23, 25, 33, 34, 36, 39,
- 40, 42, 56, 57, 58, 61, 60, 59, 61, 65, 66, 67, 68, 69, 71, 9,
- 10, 28, 29, 45, 47, 50, 52, 27, 30,
+ 40, 42, 46, 47, 49, 53, 54, 56, 60, 61, 62, 65, 64, 63, 65, 69,
+ 70, 71, 72, 73, 75, 9, 10, 28, 29, 27, 30,
};
static JAVACC_CHAR_TYPE jjstrLiteralChars_0[] = {0};
static JAVACC_CHAR_TYPE jjstrLiteralChars_1[] = {0};
@@ -2687,7 +2687,7 @@ int VhdlParserTokenManager::jjMoveNfa_0(int startState, int curPos){
curChar = input_stream->readChar();
curPos = 0;
int startsAt = 0;
- jjnewStateCnt = 77;
+ jjnewStateCnt = 81;
int i = 1;
jjstateSet[0] = startState;
int kind = 0x7fffffff;
@@ -2916,122 +2916,140 @@ int VhdlParserTokenManager::jjMoveNfa_0(int startState, int curPos){
break;
case 44:
if (curChar == 33)
- { jjCheckNAddTwoStates(45, 47); }
+ { jjCheckNAddTwoStates(45, 46); }
break;
case 45:
- { jjCheckNAddTwoStates(45, 47); }
+ if ((0xfffffbffffffffffULL & l) != 0L)
+ { jjCheckNAddTwoStates(45, 46); }
break;
case 46:
- if (curChar == 47 && kind > 9)
- kind = 9;
+ if (curChar == 42)
+ { jjCheckNAddStates(34, 36); }
break;
case 47:
- if (curChar == 42)
- jjstateSet[jjnewStateCnt++] = 46;
+ if ((0xffff7bffffffffffULL & l) != 0L)
+ { jjCheckNAddTwoStates(48, 46); }
break;
case 48:
- if (curChar == 42)
- jjstateSet[jjnewStateCnt++] = 44;
+ if ((0xfffffbffffffffffULL & l) != 0L)
+ { jjCheckNAddTwoStates(48, 46); }
break;
case 49:
- if (curChar == 42)
- { jjCheckNAddTwoStates(50, 52); }
+ if (curChar == 47 && kind > 9)
+ kind = 9;
break;
case 50:
- { jjCheckNAddTwoStates(50, 52); }
+ if (curChar == 42)
+ jjstateSet[jjnewStateCnt++] = 44;
break;
case 51:
- if (curChar == 47 && kind > 10)
- kind = 10;
+ if (curChar == 42)
+ { jjCheckNAddTwoStates(52, 53); }
break;
case 52:
- if (curChar == 42)
- jjstateSet[jjnewStateCnt++] = 51;
+ if ((0xfffffbffffffffffULL & l) != 0L)
+ { jjCheckNAddTwoStates(52, 53); }
break;
case 53:
+ if (curChar == 42)
+ { jjCheckNAddStates(37, 39); }
+ break;
+ case 54:
+ if ((0xffff7bffffffffffULL & l) != 0L)
+ { jjCheckNAddTwoStates(55, 53); }
+ break;
+ case 55:
+ if ((0xfffffbffffffffffULL & l) != 0L)
+ { jjCheckNAddTwoStates(55, 53); }
+ break;
+ case 56:
+ if (curChar == 47 && kind > 10)
+ kind = 10;
+ break;
+ case 57:
if ((0x3ff000000000000ULL & l) == 0L)
break;
if (kind > 165)
kind = 165;
{ jjCheckNAddStates(0, 10); }
break;
- case 55:
+ case 59:
if ((0x3ff000000000000ULL & l) == 0L)
break;
if (kind > 165)
kind = 165;
- { jjCheckNAddTwoStates(54, 55); }
+ { jjCheckNAddTwoStates(58, 59); }
break;
- case 57:
+ case 61:
if ((0x3ff000000000000ULL & l) == 0L)
break;
if (kind > 170)
kind = 170;
- { jjCheckNAddStates(34, 37); }
+ { jjCheckNAddStates(40, 43); }
break;
- case 58:
+ case 62:
if (curChar == 46)
- { jjCheckNAdd(59); }
+ { jjCheckNAdd(63); }
break;
- case 59:
+ case 63:
if ((0x3ff000000000000ULL & l) == 0L)
break;
if (kind > 170)
kind = 170;
- { jjCheckNAddStates(38, 40); }
+ { jjCheckNAddStates(44, 46); }
break;
- case 62:
+ case 66:
if ((0x280000000000ULL & l) != 0L)
- { jjCheckNAdd(63); }
+ { jjCheckNAdd(67); }
break;
- case 63:
+ case 67:
if ((0x3ff000000000000ULL & l) == 0L)
break;
if (kind > 170)
kind = 170;
- { jjCheckNAddTwoStates(64, 63); }
+ { jjCheckNAddTwoStates(68, 67); }
break;
- case 66:
+ case 70:
if ((0x3ff000000000000ULL & l) != 0L)
- { jjCheckNAddStates(41, 43); }
+ { jjCheckNAddStates(47, 49); }
break;
- case 67:
+ case 71:
if (curChar == 35)
- { jjCheckNAdd(68); }
+ { jjCheckNAdd(72); }
break;
- case 68:
+ case 72:
if ((0x3ff000000000000ULL & l) != 0L)
- { jjCheckNAddStates(44, 46); }
+ { jjCheckNAddStates(50, 52); }
break;
- case 69:
+ case 73:
if (curChar == 46)
- { jjCheckNAdd(70); }
+ { jjCheckNAdd(74); }
break;
- case 70:
+ case 74:
if ((0x3ff000000000000ULL & l) != 0L)
- { jjCheckNAddTwoStates(70, 71); }
+ { jjCheckNAddTwoStates(74, 75); }
break;
- case 71:
+ case 75:
if (curChar != 35)
break;
if (kind > 172)
kind = 172;
- jjstateSet[jjnewStateCnt++] = 72;
+ jjstateSet[jjnewStateCnt++] = 76;
break;
- case 73:
+ case 77:
if ((0x280000000000ULL & l) != 0L)
- { jjCheckNAdd(74); }
+ { jjCheckNAdd(78); }
break;
- case 74:
+ case 78:
if ((0x3ff000000000000ULL & l) == 0L)
break;
if (kind > 172)
kind = 172;
- { jjCheckNAddTwoStates(75, 74); }
+ { jjCheckNAddTwoStates(79, 78); }
break;
- case 76:
+ case 80:
if ((0x3ff000000000000ULL & l) != 0L)
- { jjCheckNAddTwoStates(76, 21); }
+ { jjCheckNAddTwoStates(80, 21); }
break;
default : break;
}
@@ -3072,7 +3090,7 @@ int VhdlParserTokenManager::jjMoveNfa_0(int startState, int curPos){
break;
case 9:
if ((0x7fffffffffffffffULL & l) != 0L)
- { jjAddStates(47, 48); }
+ { jjAddStates(53, 54); }
break;
case 12:
if (curChar == 95)
@@ -3126,7 +3144,7 @@ int VhdlParserTokenManager::jjMoveNfa_0(int startState, int curPos){
break;
case 28:
if ((0x7fffffffffffffffULL & l) != 0L)
- { jjAddStates(49, 50); }
+ { jjAddStates(55, 56); }
break;
case 30:
if ((0x7fffffffffffffffULL & l) == 0L)
@@ -3146,50 +3164,58 @@ int VhdlParserTokenManager::jjMoveNfa_0(int startState, int curPos){
{ jjAddStates(31, 33); }
break;
case 45:
- { jjAddStates(51, 52); }
+ { jjCheckNAddTwoStates(45, 46); }
break;
- case 50:
- { jjAddStates(53, 54); }
+ case 47:
+ case 48:
+ { jjCheckNAddTwoStates(48, 46); }
+ break;
+ case 52:
+ { jjCheckNAddTwoStates(52, 53); }
break;
case 54:
- if (curChar == 95)
- jjstateSet[jjnewStateCnt++] = 55;
+ case 55:
+ { jjCheckNAddTwoStates(55, 53); }
break;
- case 56:
+ case 58:
if (curChar == 95)
- jjstateSet[jjnewStateCnt++] = 57;
+ jjstateSet[jjnewStateCnt++] = 59;
break;
case 60:
if (curChar == 95)
- jjstateSet[jjnewStateCnt++] = 59;
- break;
- case 61:
- if ((0x2000000020ULL & l) != 0L)
- { jjCheckNAddTwoStates(62, 63); }
+ jjstateSet[jjnewStateCnt++] = 61;
break;
case 64:
if (curChar == 95)
- { jjCheckNAdd(63); }
+ jjstateSet[jjnewStateCnt++] = 63;
break;
case 65:
- if (curChar == 95)
- jjstateSet[jjnewStateCnt++] = 66;
+ if ((0x2000000020ULL & l) != 0L)
+ { jjCheckNAddTwoStates(66, 67); }
break;
case 68:
+ if (curChar == 95)
+ { jjCheckNAdd(67); }
+ break;
+ case 69:
+ if (curChar == 95)
+ jjstateSet[jjnewStateCnt++] = 70;
+ break;
+ case 72:
if ((0x7fffffe07fffffeULL & l) != 0L)
- { jjCheckNAddStates(44, 46); }
+ { jjCheckNAddStates(50, 52); }
break;
- case 70:
+ case 74:
if ((0x7fffffe07fffffeULL & l) != 0L)
- { jjCheckNAddTwoStates(70, 71); }
+ { jjCheckNAddTwoStates(74, 75); }
break;
- case 72:
+ case 76:
if ((0x2000000020ULL & l) != 0L)
- { jjCheckNAddTwoStates(73, 74); }
+ { jjCheckNAddTwoStates(77, 78); }
break;
- case 75:
+ case 79:
if (curChar == 95)
- { jjCheckNAdd(74); }
+ { jjCheckNAdd(78); }
break;
default : break;
}
@@ -3215,7 +3241,7 @@ int VhdlParserTokenManager::jjMoveNfa_0(int startState, int curPos){
break;
case 9:
if (jjCanMove_1(hiByte, i1, i2, l1, l2))
- { jjAddStates(47, 48); }
+ { jjAddStates(53, 54); }
break;
case 15:
if (jjCanMove_1(hiByte, i1, i2, l1, l2))
@@ -3227,14 +3253,14 @@ int VhdlParserTokenManager::jjMoveNfa_0(int startState, int curPos){
break;
case 28:
if (jjCanMove_1(hiByte, i1, i2, l1, l2))
- { jjAddStates(49, 50); }
+ { jjAddStates(55, 56); }
break;
case 30:
if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
break;
if (kind > 189)
kind = 189;
- { jjAddStates(55, 56); }
+ { jjAddStates(57, 58); }
break;
case 33:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
@@ -3252,11 +3278,21 @@ int VhdlParserTokenManager::jjMoveNfa_0(int startState, int curPos){
break;
case 45:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- { jjAddStates(51, 52); }
+ { jjCheckNAddTwoStates(45, 46); }
break;
- case 50:
+ case 47:
+ case 48:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- { jjAddStates(53, 54); }
+ { jjCheckNAddTwoStates(48, 46); }
+ break;
+ case 52:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ { jjCheckNAddTwoStates(52, 53); }
+ break;
+ case 54:
+ case 55:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ { jjCheckNAddTwoStates(55, 53); }
break;
default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break;
}
@@ -3269,7 +3305,7 @@ int VhdlParserTokenManager::jjMoveNfa_0(int startState, int curPos){
kind = 0x7fffffff;
}
++curPos;
- if ((i = jjnewStateCnt), (jjnewStateCnt = startsAt), (i == (startsAt = 77 - startsAt)))
+ if ((i = jjnewStateCnt), (jjnewStateCnt = startsAt), (i == (startsAt = 81 - startsAt)))
break;
if (input_stream->endOfInput()) { break; }
curChar = input_stream->readChar();
@@ -3447,16 +3483,14 @@ void VhdlParserTokenManager::SkipLexicalActions(Token *matchedToken){
case 9 : {
image.append(input_stream->GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
{
- 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();
}
break;
}
case 10 : {
image.append(input_stream->GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
- ::vhdl::parser::VhdlParser::lineCount(image.data());image.clear();
+ ::vhdl::parser::VhdlParser::lineCount(image.data());image.clear();
break;
}
default :
@@ -3609,7 +3643,7 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){
void VhdlParserTokenManager::ReInitRounds() {
int i;
jjround = 0x80000001;
- for (i = 77; i-- > 0;)
+ for (i = 81; i-- > 0;)
jjrounds[i] = 0x80000000;
}
diff --git a/vhdlparser/VhdlParserTokenManager.h b/vhdlparser/VhdlParserTokenManager.h
index 8109bf0..96a2449 100644
--- a/vhdlparser/VhdlParserTokenManager.h
+++ b/vhdlparser/VhdlParserTokenManager.h
@@ -121,8 +121,8 @@ void TokenLexicalActions(Token *matchedToken);
const JAVACC_SIMPLE_STRING jjKindsForBitVector(int i, unsigned long long vec);
const JAVACC_SIMPLE_STRING jjKindsForStateVector(int lexState, int vec[], int start, int end);
JAVACC_CHARSTREAM* input_stream;
- int jjrounds[77];
- int jjstateSet[2 * 77];
+ int jjrounds[81];
+ int jjstateSet[2 * 81];
JAVACC_STRING_TYPE jjimage;
JAVACC_STRING_TYPE image;
int jjimageLen;
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 */