summaryrefslogtreecommitdiff
path: root/src/vhdljjparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vhdljjparser.cpp')
-rw-r--r--src/vhdljjparser.cpp41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp
index b9cc8a8..40883da 100644
--- a/src/vhdljjparser.cpp
+++ b/src/vhdljjparser.cpp
@@ -88,8 +88,8 @@ struct VHDLOutlineParser::Private
void VHDLOutlineParser::Private::parseVhdlfile(const QCString &fileName,
const char* inputBuffer,bool inLine)
{
- JAVACC_STRING_TYPE s =inputBuffer;
- CharStream *stream = new CharStream(s.c_str(), (int)s.size(), 1, 1);
+ QCString s =inputBuffer;
+ CharStream *stream = new CharStream(reinterpret_cast<const JJChar*>(s.data()), (int)s.size(), 1, 1);
VhdlParserTokenManager *tokenManager = new VhdlParserTokenManager(stream);
VhdlTokenManagerErrorHandler *tokErrHandler=new VhdlTokenManagerErrorHandler(fileName.data());
vhdlParser=new VhdlParser(tokenManager);
@@ -108,6 +108,7 @@ void VHDLOutlineParser::Private::parseVhdlfile(const QCString &fileName,
}
else
{
+ // vhdlParser->interface_variable_declaration(); //interface_declaration() ;
vhdlParser->design_file();
}
}
@@ -139,6 +140,8 @@ void VHDLOutlineParser::parseInput(const QCString &fileName,const char *fileBuf,
bool inLine = fileName.isEmpty();
+ if (!inLine) msg("Parsing file %s...\n",qPrint(fileName));
+
p->yyFileName=fileName;
bool xilinx_ucf=isConstraintFile(p->yyFileName,".ucf");
@@ -183,11 +186,14 @@ void VHDLOutlineParser::lineCount()
p->yyLineNr++;
}
-void VHDLOutlineParser::lineCount(const char* text)
+void VHDLOutlineParser::lineCount(const QCString &text)
{
- for (const char* c=text ; *c ; ++c )
+ if (!text.isEmpty())
{
- if (*c == '\n') p->yyLineNr++;
+ for (const char* c=text.data() ; *c ; ++c )
+ {
+ if (*c == '\n') p->yyLineNr++;
+ }
}
}
@@ -256,7 +262,7 @@ QCString VHDLOutlineParser::getNameID()
return QCString().setNum(idCounter++);
}
-void VHDLOutlineParser::handleFlowComment(const char* doc)
+void VHDLOutlineParser::handleFlowComment(const QCString &doc)
{
lineCount(doc);
@@ -400,8 +406,9 @@ void VHDLOutlineParser::handleCommentBlock(const QCString &doc1, bool brief)
return;
}
- Protection protection = Public;
+ Protection protection = Protection::Public;
VhdlDocGen::prepareComment(doc);
+ if (doc.isEmpty()) return;
if (p->oldEntry == s->current.get())
{
@@ -510,7 +517,7 @@ void VHDLOutlineParser::addCompInst(const char *n, const char* instName, const c
}
void VHDLOutlineParser::addVhdlType(const char *n,int startLine,int section,
- uint64 spec,const char* args,const char* type,Protection prot)
+ uint64_t spec,const char* args,const char* type,Protection prot)
{
VhdlParser::SharedState *s = &p->shared;
QCString name(n);
@@ -547,11 +554,9 @@ void VHDLOutlineParser::addVhdlType(const char *n,int startLine,int section,
}
}
-void VHDLOutlineParser::createFunction(const char *imp,uint64 spec,const char *fn)
+void VHDLOutlineParser::createFunction(const QCString &impure,uint64_t spec,const QCString &fname)
{
VhdlParser::SharedState *s = &p->shared;
- QCString impure(imp);
- QCString fname(fn);
s->current->spec=spec;
s->current->section=Entry::FUNCTION_SEC;
@@ -648,7 +653,7 @@ void VHDLOutlineParser::addProto(const char *s1,const char *s2,const char *s3,
}
if (s->parse_sec==GEN_SEC && s->param_sec==0)
{
- arg.defval="gen!";
+ arg.defval="generic";
}
if (s->parse_sec==PARAM_SEC)
@@ -858,10 +863,11 @@ void VHDLOutlineParser::error_skipto(int kind)
// "if"/"while".
}
-QCString filter2008VhdlComment(const char *s)
+QCString filter2008VhdlComment(const QCString &s)
{
+ if (s.length()<4) return s;
GrowBuf growBuf;
- const char *p=s+3; // skip /*!
+ const char *p=s.data()+3; // skip /*!
char c='\0';
while (*p == ' ' || *p == '\t') p++;
while ((c=*p++))
@@ -878,12 +884,11 @@ QCString filter2008VhdlComment(const char *s)
}
// special attention in case */ at end of last line
size_t len = growBuf.getPos();
- if (growBuf.at(len-1) == '/' && growBuf.at(len-2) == '*')
+ if (len>=2 && 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--;
+ while (len>0 && growBuf.at(len-1) == '*') len--;
+ while (len>0 && ((c = growBuf.at(len-1)) == ' ' || c == '\t')) len--;
growBuf.setPos(len);
}
growBuf.addChar(0);