summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-06-10 20:25:50 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-06-10 20:25:50 (GMT)
commitb1f74a4dab61e57492435c45a104919b91dc5588 (patch)
tree1f8d4554c61f0e3bb378a65377d05d57a031277c
parent6b807dd23a21a45ead11a9af48c45d8adf211663 (diff)
parentcb5a9c3f31b0233a5dc72d13f9f4cfa7db5fe00c (diff)
downloadDoxygen-b1f74a4dab61e57492435c45a104919b91dc5588.zip
Doxygen-b1f74a4dab61e57492435c45a104919b91dc5588.tar.gz
Doxygen-b1f74a4dab61e57492435c45a104919b91dc5588.tar.bz2
Merge branch 'master' of github.com:doxygen/doxygen
-rwxr-xr-xcmake/FindJavacc.cmake17
-rw-r--r--src/vhdljjparser.cpp173
-rwxr-xr-xsrc/vhdljjparser.h1
-rw-r--r--vhdlparser/CMakeLists.txt6
-rwxr-xr-xvhdlparser/vhdlparser.jj2
5 files changed, 158 insertions, 41 deletions
diff --git a/cmake/FindJavacc.cmake b/cmake/FindJavacc.cmake
index c7de776..a134020 100755
--- a/cmake/FindJavacc.cmake
+++ b/cmake/FindJavacc.cmake
@@ -1,9 +1,24 @@
-
find_program(JAVACC_EXECUTABLE NAMES javacc javaCC Javacc JavaCC javacc.bat DOC "path to the javacc executable")
mark_as_advanced(JAVACC_EXECUTABLE)
if(JAVACC_EXECUTABLE)
set(JAVACC_FOUND 1)
message(STATUS "The javacc executable: ${JAVACC_EXECUTABLE}")
+ execute_process(
+ COMMAND "${JAVACC_EXECUTABLE}" -version
+ OUTPUT_VARIABLE JAVACC_TEMP_VERSION
+ )
+ string(REGEX MATCH ".* ([0-9]+(\\.[0-9]+)+) .*" JAVACC_TEMP_VERSION2_UNUSED "${JAVACC_TEMP_VERSION}")
+ if(CMAKE_MATCH_1)
+ set(JAVACC_VERSION ${CMAKE_MATCH_1})
+ else()
+ string(REGEX MATCH "([0-9]+(\\.[0-9]+)+)" JAVACC_TEMP_VERSION3_UNUSED "${JAVACC_TEMP_VERSION}")
+ if(CMAKE_MATCH_1)
+ set(JAVACC_VERSION ${CMAKE_MATCH_1})
+ else()
+ message(STATUS "Unable to determine JavaCC version, using existing files")
+ set(JAVACC_FOUND 0)
+ endif()
+ endif()
else()
set(JAVACC_FOUND 0)
message(STATUS "The javacc executable not found, using existing files")
diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp
index ea60dd6..38aa641 100644
--- a/src/vhdljjparser.cpp
+++ b/src/vhdljjparser.cpp
@@ -81,6 +81,7 @@ struct VHDLOutlineParser::Private
VHDLDocInfo str_doc;
VhdlParser::SharedState shared;
QCString forL;
+ int code = 0;
};
@@ -264,34 +265,128 @@ void VHDLOutlineParser::handleFlowComment(const char* doc)
}
}
+int VHDLOutlineParser::checkInlineCode(QCString &doc)
+{
+ QRegExp cs("[\\\\@]code");
+ QRegExp cend("[\\s ]*[\\\\@]endcode");
+ QRegExp cbrief("[\\\\@]brief");
+ int index = doc.find(cs);
+
+ if (doc.contains(cend) > 0)
+ return 1;
+
+ if (index < 0)
+ return index;
+
+ VhdlParser::SharedState *s = &p->shared;
+ p->strComment += doc;
+ p->code = p->inputString.find(cs, p->code + 1);
+ int com = p->inputString.find(p->strComment.data());
+ int ref = p->inputString.find(cend, p->code + 1);
+ int len = p->strComment.size();
+
+ int ll = com + len;
+ int diff = ref - ll - 3;
+ QCString code = p->inputString.mid(ll, diff);
+ int iLine = 0;
+ code = stripLeadingAndTrailingEmptyLines(code, iLine);
+ int val = code.contains('\n');
+ VhdlDocGen::prepareComment(p->strComment);
+ QCStringList ql = QCStringList::split('\n', p->strComment);
+
+ QCString co;
+ QCString na;
+ for (QCString qcs : ql)
+ {
+ qcs = qcs.simplifyWhiteSpace();
+ if (qcs.contains(cs))
+ {
+ int i = qcs.find('{');
+ int j = qcs.find('}');
+ if (i > 0 && j > 0 && j > i)
+ {
+ na = qcs.mid(i + 1, (j - i - 1));
+ }
+ continue;
+ }
+ qcs = qcs.replace(cbrief, "");
+ co += qcs;
+ co += '\n';
+ }
+
+ VhdlDocGen::prepareComment(co);
+
+ Entry gBlock;
+ if (!na.isEmpty())
+ gBlock.name = na;
+ else
+ gBlock.name = "misc" + VhdlDocGen::getRecordNumber();
+ gBlock.startLine = p->yyLineNr+iLine-1;
+ gBlock.bodyLine = p->yyLineNr+iLine-1 ;
+ gBlock.doc = code;
+ gBlock.inbodyDocs = code;
+ gBlock.brief = co;
+ gBlock.section = Entry::VARIABLE_SEC;
+ gBlock.spec = VhdlDocGen::MISCELLANEOUS;
+ gBlock.fileName = p->yyFileName;
+ gBlock.endBodyLine = p->yyLineNr + val +iLine;
+ gBlock.lang = SrcLangExt_VHDL;
+ std::shared_ptr<Entry> compound;
+
+ if (s->lastEntity)
+ compound = s->lastEntity;
+ else if (s->lastCompound)
+ compound = s->lastCompound;
+ else
+ compound = 0;
+
+ if (compound)
+ {
+ compound->copyToSubEntry(&gBlock);
+ }
+ else
+ {
+ gBlock.type = "misc"; // global code like library ieee...
+ s->current_root->copyToSubEntry(&gBlock);
+ }
+ p->strComment.resize(0);
+ return 1;
+}
-void VHDLOutlineParser::handleCommentBlock(const char* doc1,bool brief)
+void VHDLOutlineParser::handleCommentBlock(const char *doc1, bool brief)
{
+ int position = 0;
+ bool needsEntry = FALSE;
VhdlParser::SharedState *s = &p->shared;
QCString doc = doc1;
- if (doc.isEmpty()) return;
- if (checkMultiComment(doc,p->yyLineNr))
+ if (doc.isEmpty())
+ return;
+
+ if (checkMultiComment(doc, p->yyLineNr))
{
p->strComment.resize(0);
return;
}
- VhdlDocGen::prepareComment(doc);
+ if (checkInlineCode(doc) > 0)
+ {
+ return;
+ }
- Protection protection=Public;
+ Protection protection = Public;
+ VhdlDocGen::prepareComment(doc);
- if (p->oldEntry==s->current.get())
+ if (p->oldEntry == s->current.get())
{
- //printf("\n find pending message < %s > at line: %d \n ",doc.data(),iDocLine);
- p->str_doc.doc=doc;
- p->str_doc.iDocLine=p->iDocLine;
- p->str_doc.brief=brief;
- p->str_doc.pending=TRUE;
+ p->str_doc.doc = doc;
+ p->str_doc.iDocLine = p->iDocLine;
+ p->str_doc.brief = brief;
+ p->str_doc.pending = TRUE;
return;
}
- p->oldEntry=s->current.get();
+ p->oldEntry = s->current.get();
if (brief)
{
@@ -302,45 +397,45 @@ void VHDLOutlineParser::handleCommentBlock(const char* doc1,bool brief)
s->current->docLine = p->yyLineNr;
}
- int j=doc.find("[plant]");
- if (j>=0)
+ int j = doc.find("[plant]");
+ if (j >= 0)
{
- doc=doc.remove(j,7);
- s->current->stat=true;
+ doc = doc.remove(j, 7);
+ s->current->stat = true;
}
- int position=0;
- bool needsEntry=FALSE;
- QCString processedDoc = processMarkdownForCommentBlock(doc,p->yyFileName,p->iDocLine);
+ //int position=0;
+
+ QCString processedDoc = processMarkdownForCommentBlock(doc, p->yyFileName, p->iDocLine);
+
while (p->commentScanner.parseCommentBlock(
- p->thisParser,
- s->current.get(),
- processedDoc, // text
- p->yyFileName, // file
- p->iDocLine, // line of block start
- brief,
- 0,
- FALSE,
- protection,
- position,
- needsEntry
- )
- )
- {
- if (needsEntry) newEntry();
+ p->thisParser,
+ s->current.get(),
+ processedDoc, // text
+ p->yyFileName, // file
+ p->iDocLine, // line of block start
+ brief,
+ 0,
+ FALSE,
+ protection,
+ position,
+ needsEntry))
+ {
+ if (needsEntry)
+ newEntry();
}
if (needsEntry)
{
if (p->varr)
{
- p->varr=FALSE;
- s->current->name=p->varName;
- s->current->section=Entry::VARIABLEDOC_SEC;
- p->varName="";
+ p->varr = FALSE;
+ s->current->name = p->varName;
+ s->current->section = Entry::VARIABLEDOC_SEC;
+ p->varName = "";
}
newEntry();
}
- p->iDocLine=-1;
+ p->iDocLine = -1;
p->strComment.resize(0);
}
diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h
index c4a55de..940631d 100755
--- a/src/vhdljjparser.h
+++ b/src/vhdljjparser.h
@@ -72,6 +72,7 @@ class VHDLOutlineParser : public OutlineParserInterface
bool checkMultiComment(QCString& qcs,int line);
void insertEntryAtLine(std::shared_ptr<Entry> ce,int line);
QString getNameID();
+ int checkInlineCode(QCString & doc);
private:
struct Private;
std::unique_ptr<Private> p;
diff --git a/vhdlparser/CMakeLists.txt b/vhdlparser/CMakeLists.txt
index 3e52817..343f126 100644
--- a/vhdlparser/CMakeLists.txt
+++ b/vhdlparser/CMakeLists.txt
@@ -1,11 +1,17 @@
find_package(Javacc)
if (JAVACC_FOUND)
+ if (JAVACC_VERSION VERSION_LESS 7.0.5)
+ message(STATUS " Doxygen requires at least JavaCC version 7.0.5 (installed: ${JAVACC_VERSION})")
+ message(STATUS " Fall back to JavaCC not installed, using existing files.")
+ else()
+
add_custom_command(
COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${CMAKE_SOURCE_DIR}/vhdlparser ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj
DEPENDS ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj
OUTPUT ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.cc ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.h ${CMAKE_SOURCE_DIR}/vhdlparser/ErrorHandler.h ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.cc ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.h ${CMAKE_SOURCE_DIR}/vhdlparser/Token.cc ${CMAKE_SOURCE_DIR}/vhdlparser/Token.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenManager.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.cc ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserConstants.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.h
)
+ endif()
endif()
include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/qtools ${GENERATED_SRC})
diff --git a/vhdlparser/vhdlparser.jj b/vhdlparser/vhdlparser.jj
index 4287871..007bd5b 100755
--- a/vhdlparser/vhdlparser.jj
+++ b/vhdlparser/vhdlparser.jj
@@ -783,7 +783,7 @@ block_statement()
LOOKAHEAD([identifier() ":"] [<POSTPONED_T>] <PROCESS_T>)
process_statement()
|
-LOOKAHEAD(generate_statement())
+LOOKAHEAD(3)
generate_statement()
|
case_scheme()