diff options
author | albert-github <albert.tests@gmail.com> | 2019-12-11 19:14:29 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2019-12-11 19:14:29 (GMT) |
commit | 1a5bbadb43b2d30e338d26a0d495b60e2b12f704 (patch) | |
tree | 36fe86281370507e9ba4706b5edcfd31dc8c8116 /src/vhdljjparser.cpp | |
parent | 2ed458302d43a6385c310c685fa4174818f0b67e (diff) | |
download | Doxygen-1a5bbadb43b2d30e338d26a0d495b60e2b12f704.zip Doxygen-1a5bbadb43b2d30e338d26a0d495b60e2b12f704.tar.gz Doxygen-1a5bbadb43b2d30e338d26a0d495b60e2b12f704.tar.bz2 |
issue #7436 Incorrect handling of block comments in VHDL
The search for `/*` or /*!` ended at the last `*/` in a file and thus skipping other intermediate block end and new starts. Also the intermediate code was lost see as comment.
The filter pattern used was incorrect and should have been `<"/*" (~["*"])* "*" ("*" | ~["*","/"] (~["*"])* "*")* "/">` (thanks to https://javacc.org/contrib/C.jj).
Here also the space plus one or more `*` at the end beginning of the line are still incorporated as well as multiple `*` before the colosing `*/` this is also filtered.
Diffstat (limited to 'src/vhdljjparser.cpp')
-rw-r--r-- | src/vhdljjparser.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
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(); +} |