88 const QCString &inputBuffer,
bool inLine)
97 tokenManager->
ReInit(stream,0);
100 vhdlParser->setErrorHandler(parserErrHandler);
113 catch( std::exception &){ }
135 p->inputString=fileBuf;
139 bool inLine = fileName.
isEmpty();
141 if (!inLine)
msg(
"Parsing file {}...\n",fileName);
143 p->yyFileName=fileName;
164 p->oldEntry =
nullptr;
165 s->
current=std::make_shared<Entry>();
167 p->commentScanner.enterFile(fileName,
p->yyLineNr);
168 p->lineParse.reserve(200);
169 p->parseVhdlfile(fileName,fileBuf,inLine);
170 p->commentScanner.leaveFile(fileName,
p->yyLineNr);
177 p->yyFileName.clear();
190 for (
const char* c=text.
data() ; *c ; ++c )
192 if (*c ==
'\n')
p->yyLineNr++;
200 e->
lang = SrcLangExt::VHDL;
201 if (
p->str_doc.pending)
205 p->iDocLine=
p->str_doc.iDocLine;
209 p->commentScanner.initGroupInfo(e);
277 static const reg::Ex csRe(R
"([\\@]code)");
278 static const reg::Ex cendRe(R
"(\s*[\\@]endcode)");
279 static const reg::Ex cbriefRe(R
"([\\@]brief)");
282 auto findRe = [](
const QCString &str,
const reg::Ex &re,
int pos=0) ->
int
284 if ((
int)str.
length()<pos)
return -1;
288 return (
int)match.position();
300 int index = findRe(doc,csRe);
302 if (findRe(doc,cendRe)!=-1)
309 p->strComment += doc;
310 p->code = findRe(
p->inputString,csRe,
p->code + 1);
311 int com =
p->inputString.find(
p->strComment.data());
312 int ref = findRe(
p->inputString,cendRe,
p->code + 1);
313 int len =
static_cast<int>(
p->strComment.size());
316 int diff = ref - ll - 3;
317 QCString code =
p->inputString.mid(ll, diff);
326 for (
const auto &qcs_ : ql)
330 if (findRe(qcs,csRe)!=-1)
332 int i = qcs.
find(
'{');
333 int j = qcs.
find(
'}');
334 if (i > 0 && j > 0 && j > i)
336 na = qcs.
mid(i + 1, (j - i - 1));
340 qcs = replaceRe(qcs,cbriefRe,
"");
357 gBlock.
section = EntryType::makeVariable();
361 gBlock.
lang = SrcLangExt::VHDL;
362 std::shared_ptr<Entry> compound;
373 compound->copyToSubEntry(&gBlock);
377 gBlock.
type =
"misc";
380 p->strComment.clear();
387 bool needsEntry =
FALSE;
396 p->strComment.clear();
409 if (
p->oldEntry == s->
current.get())
411 p->str_doc.doc = doc;
412 p->str_doc.iDocLine =
p->iDocLine;
413 p->str_doc.brief = brief;
414 p->str_doc.pending =
TRUE;
422 s->
current->briefLine =
p->yyLineNr;
432 int lineNr =
p->iDocLine;
436 while (
p->commentScanner.parseCommentBlock(
461 s->
current->section = EntryType::makeVariableDoc();
467 p->strComment.clear();
480 s->
current->section=EntryType::makeVariable();
510 s->
current=std::make_shared<Entry>();
531 for (
size_t u=0;u<ql.size();u++)
534 s->
current->startLine=startLine;
535 s->
current->bodyLine=startLine;
539 if (s->
current->args.isEmpty())
548 p->libUse.emplace_back(std::make_shared<Entry>(*s->
current));
559 s->
current->section=EntryType::makeFunction();
561 if (impure==
"impure" || impure==
"pure")
569 s->
current->section=EntryType::makeFunction();
590 for (
const auto &name : q1)
594 s->
current->argList.push_back(arg);
637 for (
const auto &n : ql)
664 s->
current->argList.push_back(arg);
684 for (
const auto &rt :
p->libUse)
689 for (
const auto ¤t : root->
children())
693 if (current->startLine > rt->startLine)
696 current->copyToSubEntry(rt);
728 if ((
int)
p->lineParse.size()<=tok)
p->lineParse.resize(tok+1);
729 p->lineParse[tok]=
p->yyLineNr;
734 int val=
p->lineParse[tok];
793 p->iDocLine=
p->yyLineNr;
798 int j=qcs.
find(
"--!");
812 if (
p->lineEntry.empty())
return false;
815 while (!
p->lineEntry.empty())
817 std::shared_ptr<Entry> e=
p->lineEntry.back();
821 p->lineEntry.pop_back();
829 for (
const auto &rt : ce->children())
831 if (rt->bodyLine==line)
833 p->lineEntry.push_back(rt);
850 p->vhdlParser->getNextToken();
851 op=
p->vhdlParser->getToken(1);
852 if (op==
nullptr)
break;
854 }
while (op->
kind != kind);
855 p->vhdlParser->clearError();
865 if (s.
length()<4)
return s;
868 const char *p=s.
data()+3;
870 while (*p ==
' ' || *p ==
'\t') p++;
877 while (*p ==
' ' || *p ==
'\t') p++;
878 while (*p ==
'*') p++;
884 size_t len = result.
length();
885 if (len>=2 && result[len-1]==
'/' && result[len-2]==
'*')
888 while (len>0 && result[len-1] ==
'*') len--;
889 while (len>0 && ((c = result[len-1]) ==
' ' || c ==
'\t')) len--;
Clang parser object for a single translation unit, which consists of a source file and the directly o...
Represents an unstructured piece of information, about an entity found in the sources.
VhdlSpecifier vhdlSpec
VHDL specifiers.
const std::vector< std::shared_ptr< Entry > > & children() const
int endBodyLine
line number where the definition ends
SrcLangExt lang
programming language in which this entry was found
QCString inbodyDocs
documentation inside the body of a function
QCString fileName
file this entry was extracted from
int startLine
start line of entry in the source
EntryType section
entry type (see Sections);
int bodyLine
line number of the body in the source
void copyToSubEntry(Entry *e)
QCString doc
documentation block (partly parsed)
QCString brief
brief description (doc block)
Wrapper class for the Entry type.
static void alignFuncProc(QCString &q, const ArgumentList &al, bool isFunc)
static void addFlowChart(int type, const QCString &text, const QCString &exp, const QCString &label=QCString())
static void writeFlowChart()
Helper class to process markdown formatted text.
QCString process(const QCString &input, int &startNewlines, bool fromParseInput=false)
This is an alternative implementation of QCString.
int find(char c, int index=0, bool cs=TRUE) const
QCString & prepend(const char *s)
size_t length() const
Returns the length of the string, not counting the 0-terminator.
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
bool isEmpty() const
Returns TRUE iff the string is empty.
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
void resize(size_t newlen)
const std::string & str() const
QCString & setNum(short n)
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
QCString right(size_t len) const
size_t size() const
Returns the length of the string, not counting the 0-terminator.
void reserve(size_t size)
Reserve space for size bytes without changing the string contents.
int findRev(char c, int index=-1, bool cs=TRUE) const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
QCString left(size_t len) const
int contains(char c, bool cs=TRUE) const
bool stripPrefix(const QCString &prefix)
int checkInlineCode(QCString &doc)
void error_skipto(int kind)
void handleCommentBlock(const QCString &doc, bool brief)
void setLineParsed(int tok)
std::unique_ptr< Private > p
void addVhdlType(const QCString &n, int startLine, EntryType section, VhdlSpecifier spec, const QCString &args, const QCString &type, Protection prot)
~VHDLOutlineParser() override
void insertEntryAtLine(std::shared_ptr< Entry > ce, int line)
void oneLineComment(QCString qcs)
QCString popLabel(QCString &q)
void pushLabel(QCString &, QCString &)
bool addLibUseClause(const QCString &type)
void addCompInst(const QCString &n, const QCString &instName, const QCString &comp, int iLine)
bool checkMultiComment(QCString &qcs, int line)
void parsePrototype(const QCString &text) override
Callback function called by the comment block scanner.
void handleFlowComment(const QCString &)
void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &root, ClangTUParser *clangParser) override
Parses a single input file with the goal to build an Entry tree.
QCString getNameID()
returns a unique id for each record member.
void createFunction(const QCString &impure, VhdlSpecifier spec, const QCString &fname)
void setMultCommentLine()
void addProto(const QCString &s1, const QCString &s2, const QCString &s3, const QCString &s4, const QCString &s5, const QCString &s6)
void mapLibPackage(Entry *root)
static const MemberDef * getFlowMember()
static QCString getRecordNumber()
static bool isVhdlClass(const Entry *cu)
static void prepareComment(QCString &)
static void parseUCF(const QCString &input, Entry *entity, const QCString &f, bool vendor)
static void deleteAllChars(QCString &s, char c)
Class representing a regular expression.
Object representing the matching results.
This class describes a character stream that maintains line and column number positions of the charac...
Describes the input token stream.
int kind
An integer that describes the kind of this token.
void setLexParser(VhdlParser *p)
void ReInit(JAVACC_CHARSTREAM *stream, int lexState=0)
void setErrorHandler(TokenManagerErrorHandler *eh)
#define Config_getBool(name)
std::vector< int > IntVector
std::vector< std::string > StringVector
std::vector< std::shared_ptr< Entry > > EntryList
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
std::string replace(std::string_view str, const Ex &re, std::string_view replacement)
Searching in a given input string for parts that match regular expression re and replaces those parts...
Web server based search engine.
This class contains the information about the argument of a function or template.
void parseVhdlfile(const QCString &fileName, const QCString &inputBuffer, bool inLine)
VHDLOutlineParser * thisParser
CommentScanner commentScanner
VhdlParser::SharedState shared
std::shared_ptr< Entry > lastEntity
std::shared_ptr< Entry > lastCompound
std::shared_ptr< Entry > current_root
std::shared_ptr< Entry > tempEntry
std::shared_ptr< Entry > current
This file contains a number of basic enums and types.
StringVector split(const std::string &s, const std::string &delimiter)
split input string s by string delimiter delimiter.
QCString stripLeadingAndTrailingEmptyLines(const QCString &s, int &docLine)
Special version of QCString::stripWhiteSpace() that only strips completely blank lines.
A bunch of utility functions.
const EntryList & getVhdlInstList()
QCString filter2008VhdlComment(const QCString &s)
static EntryList g_instFiles
static bool isConstraintFile(const QCString &fileName, const QCString &ext)