Doxygen
Loading...
Searching...
No Matches
VHDLOutlineParser Class Reference

VHDL parser using state-based lexical scanning. More...

#include <src/vhdljjparser.h>

Inheritance diagram for VHDLOutlineParser:
Collaboration diagram for VHDLOutlineParser:

Classes

struct  Private

Public Member Functions

 VHDLOutlineParser ()
 ~VHDLOutlineParser () override
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.
bool needsPreprocessing (const QCString &) const override
 Returns TRUE if the language identified by extension needs the C preprocessor to be run before feed the result to the input parser.
void parsePrototype (const QCString &text) override
 Callback function called by the comment block scanner.
void setLineParsed (int tok)
int getLine (int tok)
int getLine ()
void lineCount (const QCString &)
void lineCount ()
void addProto (const QCString &s1, const QCString &s2, const QCString &s3, const QCString &s4, const QCString &s5, const QCString &s6)
void createFunction (const QCString &impure, VhdlSpecifier spec, const QCString &fname)
void addVhdlType (const QCString &n, int startLine, EntryType section, VhdlSpecifier spec, const QCString &args, const QCString &type, Protection prot)
void addCompInst (const QCString &n, const QCString &instName, const QCString &comp, int iLine)
void handleCommentBlock (const QCString &doc, bool brief)
void handleFlowComment (const QCString &)
void initEntry (Entry *e)
void newEntry ()
bool isFuncProcProced ()
void pushLabel (QCString &, QCString &)
QCString popLabel (QCString &q)
bool addLibUseClause (const QCString &type)
void mapLibPackage (Entry *root)
void createFlow ()
void error_skipto (int kind)
void oneLineComment (QCString qcs)
void setMultCommentLine ()
bool checkMultiComment (QCString &qcs, int line)
void insertEntryAtLine (std::shared_ptr< Entry > ce, int line)
QCString getNameID ()
 returns a unique id for each record member.
int checkInlineCode (QCString &doc)

Private Attributes

std::unique_ptr< Privatep

Detailed Description

VHDL parser using state-based lexical scanning.

This is the VHDL language parser for doxygen.

Definition at line 27 of file vhdljjparser.h.

Constructor & Destructor Documentation

◆ VHDLOutlineParser()

VHDLOutlineParser::VHDLOutlineParser ( )

Definition at line 122 of file vhdljjparser.cpp.

122 : p(std::make_unique<Private>())
123{
124}
std::unique_ptr< Private > p

References p.

◆ ~VHDLOutlineParser()

VHDLOutlineParser::~VHDLOutlineParser ( )
override

Definition at line 126 of file vhdljjparser.cpp.

127{
128}

Member Function Documentation

◆ addCompInst()

void VHDLOutlineParser::addCompInst ( const QCString & n,
const QCString & instName,
const QCString & comp,
int iLine )

Definition at line 476 of file vhdljjparser.cpp.

477{
478 VhdlParser::SharedState *s = &p->shared;
480 s->current->section=EntryType::makeVariable();
481 s->current->startLine=iLine;
482 s->current->bodyLine=iLine;
483 s->current->type=instName; // foo:instname e.g proto or work. proto(ttt)
484 s->current->exception=s->genLabels.lower(); // |arch|label1:label2...
485 s->current->name=n; // foo
486 if (s->lastCompound)
487 {
488 s->current->args=s->lastCompound->name; // architecture name
489 }
490 s->current->includeName=comp; // component/entity/configuration
491 int u=s->genLabels.find("|",1);
492 if (u>0)
493 {
494 s->current->write=s->genLabels.right(s->genLabels.length()-u);
495 s->current->read=s->genLabels.left(u);
496 }
497 //printf (" \n genlabel: [%s] inst: [%s] name: [%s] %d\n",n,instName,comp,iLine);
498
499 if (s->lastCompound)
500 {
501 s->current->args=s->lastCompound->name;
502 if (true) // !findInstant(current->type))
503 {
504 initEntry(s->current.get());
505 // TODO: protect with mutex
506 g_instFiles.emplace_back(std::make_shared<Entry>(*s->current));
507 // TODO: end protect with mutex
508 }
509
510 s->current=std::make_shared<Entry>();
511 }
512 else
513 {
514 newEntry();
515 }
516}
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
QCString lower() const
Definition qcstring.h:249
QCString right(size_t len) const
Definition qcstring.h:234
QCString left(size_t len) const
Definition qcstring.h:229
void initEntry(Entry *e)
std::shared_ptr< Entry > lastCompound
std::shared_ptr< Entry > current
@ INSTANTIATION
Definition types.h:751
static EntryList g_instFiles

References vhdl::parser::VhdlParser::SharedState::current, QCString::find(), g_instFiles, vhdl::parser::VhdlParser::SharedState::genLabels, initEntry(), INSTANTIATION, vhdl::parser::VhdlParser::SharedState::lastCompound, QCString::left(), QCString::length(), QCString::lower(), newEntry(), p, and QCString::right().

◆ addLibUseClause()

bool VHDLOutlineParser::addLibUseClause ( const QCString & type)

Definition at line 709 of file vhdljjparser.cpp.

710{
711 bool showIEEESTD=Config_getBool(FORCE_LOCAL_INCLUDES);
712
713 if (showIEEESTD) // all standard packages and libraries will not be shown
714 {
715 if (type.lower().stripPrefix("ieee")) return FALSE;
716 if (type.lower().stripPrefix("std")) return FALSE;
717 }
718 return TRUE;
719}
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:213
#define Config_getBool(name)
Definition config.h:33
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

References Config_getBool, FALSE, QCString::lower(), QCString::stripPrefix(), and TRUE.

Referenced by mapLibPackage().

◆ addProto()

void VHDLOutlineParser::addProto ( const QCString & s1,
const QCString & s2,
const QCString & s3,
const QCString & s4,
const QCString & s5,
const QCString & s6 )

Definition at line 630 of file vhdljjparser.cpp.

632{
633 VhdlParser::SharedState *s = &p->shared;
634 (void)s5; // avoid unused warning
635 StringVector ql=split(s2.str(),",");
636
637 for (const auto &n : ql)
638 {
639 Argument arg;
640 arg.name=n;
641 if (!s3.isEmpty())
642 {
643 arg.type=s3;
644 }
645 arg.type+=" ";
646 arg.type+=s4;
647 if (!s6.isEmpty())
648 {
649 arg.type+=s6;
650 }
652 {
653 arg.defval="generic";
654 }
655
657 {
658 // assert(false);
659 }
660
661 arg.defval+=s1;
662 arg.attrib="";//s6;
663
664 s->current->argList.push_back(arg);
665 s->current->args+=s2;
666 s->current->args+=",";
667 }
668}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
const std::string & str() const
Definition qcstring.h:552
std::vector< std::string > StringVector
Definition containers.h:33
QCString type
Definition arguments.h:42
QCString name
Definition arguments.h:44
QCString defval
Definition arguments.h:46
QCString attrib
Definition arguments.h:41
StringVector split(const std::string &s, const std::string &delimiter)
split input string s by string delimiter delimiter.
Definition util.cpp:6568

References Argument::attrib, vhdl::parser::VhdlParser::SharedState::current, Argument::defval, GEN_SEC, QCString::isEmpty(), Argument::name, p, PARAM_SEC, vhdl::parser::VhdlParser::SharedState::param_sec, vhdl::parser::VhdlParser::SharedState::parse_sec, split(), QCString::str(), Argument::type, and UNKNOWN.

◆ addVhdlType()

void VHDLOutlineParser::addVhdlType ( const QCString & n,
int startLine,
EntryType section,
VhdlSpecifier spec,
const QCString & args,
const QCString & type,
Protection prot )

Definition at line 518 of file vhdljjparser.cpp.

520{
521 VhdlParser::SharedState *s = &p->shared;
523
525 {
527 }
528
529 StringVector ql=split(n.str(),",");
530
531 for (size_t u=0;u<ql.size();u++)
532 {
533 s->current->name=ql[u];
534 s->current->startLine=startLine;
535 s->current->bodyLine=startLine;
536 s->current->section=section;
537 s->current->vhdlSpec=spec;
538 s->current->fileName=p->yyFileName;
539 if (s->current->args.isEmpty())
540 {
541 s->current->args=args;
542 }
543 s->current->type=type;
544 s->current->protection=prot;
545
546 if (!s->lastCompound && section.isVariable() && (spec == VhdlSpecifier::USE || spec == VhdlSpecifier::LIBRARY) )
547 {
548 p->libUse.emplace_back(std::make_shared<Entry>(*s->current));
549 s->current->reset();
550 }
551 newEntry();
552 }
553}
static const MemberDef * getFlowMember()

References vhdl::parser::VhdlParser::SharedState::current, GEN_SEC, GENERIC, VhdlDocGen::getFlowMember(), isFuncProcProced(), vhdl::parser::VhdlParser::SharedState::lastCompound, LIBRARY, newEntry(), p, vhdl::parser::VhdlParser::SharedState::parse_sec, split(), QCString::str(), and USE.

◆ checkInlineCode()

int VHDLOutlineParser::checkInlineCode ( QCString & doc)

Definition at line 275 of file vhdljjparser.cpp.

276{
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)");
280
281 // helper to simulate behavior of QString.find(const QRegExp &re,int pos)
282 auto findRe = [](const QCString &str,const reg::Ex &re,int pos=0) -> int
283 {
284 if ((int)str.length()<pos) return -1;
285 reg::Match match;
286 if (reg::search(str.str(),match,re,pos)) // match found
287 {
288 return (int)match.position();
289 }
290 else // not found
291 {
292 return -1;
293 }
294 };
295 auto replaceRe = [](const QCString &str,const reg::Ex &re,const QCString &replacement) -> QCString
296 {
297 return reg::replace(str.str(), re, replacement.str());
298 };
299
300 int index = findRe(doc,csRe);
301
302 if (findRe(doc,cendRe)!=-1)
303 return 1;
304
305 if (index < 0)
306 return index;
307
308 VhdlParser::SharedState *s = &p->shared;
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());
314
315 int ll = com + len;
316 int diff = ref - ll - 3;
317 QCString code = p->inputString.mid(ll, diff);
318 int iLine = 0;
319 code = stripLeadingAndTrailingEmptyLines(code, iLine);
320 int val = code.contains('\n');
321 VhdlDocGen::prepareComment(p->strComment);
322 StringVector ql = split(p->strComment.str(),"\n");
323
324 QCString co;
325 QCString na;
326 for (const auto &qcs_ : ql)
327 {
328 QCString qcs(qcs_);
329 qcs = qcs.simplifyWhiteSpace();
330 if (findRe(qcs,csRe)!=-1)
331 {
332 int i = qcs.find('{');
333 int j = qcs.find('}');
334 if (i > 0 && j > 0 && j > i)
335 {
336 na = qcs.mid(i + 1, (j - i - 1));
337 }
338 continue;
339 }
340 qcs = replaceRe(qcs,cbriefRe, "");
341 co += qcs;
342 co += '\n';
343 }
344
346
347 Entry gBlock;
348 if (!na.isEmpty())
349 gBlock.name = na;
350 else
351 gBlock.name = "misc" + VhdlDocGen::getRecordNumber();
352 gBlock.startLine = p->yyLineNr+iLine-1;
353 gBlock.bodyLine = p->yyLineNr+iLine-1 ;
354 gBlock.doc = code;
355 gBlock.inbodyDocs = code;
356 gBlock.brief = co;
357 gBlock.section = EntryType::makeVariable();
359 gBlock.fileName = p->yyFileName;
360 gBlock.endBodyLine = p->yyLineNr + val +iLine;
361 gBlock.lang = SrcLangExt::VHDL;
362 std::shared_ptr<Entry> compound;
363
364 if (s->lastEntity)
365 compound = s->lastEntity;
366 else if (s->lastCompound)
367 compound = s->lastCompound;
368 else
369 compound = nullptr;
370
371 if (compound)
372 {
373 compound->copyToSubEntry(&gBlock);
374 }
375 else
376 {
377 gBlock.type = "misc"; // global code like library ieee...
378 s->current_root->copyToSubEntry(&gBlock);
379 }
380 p->strComment.clear();
381 return 1;
382}
VhdlSpecifier vhdlSpec
VHDL specifiers.
Definition entry.h:183
int endBodyLine
line number where the definition ends
Definition entry.h:218
SrcLangExt lang
programming language in which this entry was found
Definition entry.h:227
QCString inbodyDocs
documentation inside the body of a function
Definition entry.h:206
QCString fileName
file this entry was extracted from
Definition entry.h:223
QCString type
member type
Definition entry.h:173
int startLine
start line of entry in the source
Definition entry.h:224
QCString name
member name
Definition entry.h:174
EntryType section
entry type (see Sections);
Definition entry.h:172
int bodyLine
line number of the body in the source
Definition entry.h:216
QCString doc
documentation block (partly parsed)
Definition entry.h:200
QCString brief
brief description (doc block)
Definition entry.h:203
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
int contains(char c, bool cs=TRUE) const
Definition qcstring.cpp:148
static QCString getRecordNumber()
static void prepareComment(QCString &)
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.
Definition regex.cpp:844
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...
Definition regex.cpp:866
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:855
std::shared_ptr< Entry > lastEntity
std::shared_ptr< Entry > current_root
@ MISCELLANEOUS
Definition types.h:757
QCString stripLeadingAndTrailingEmptyLines(const QCString &s, int &docLine)
Special version of QCString::stripWhiteSpace() that only strips completely blank lines.
Definition util.cpp:4966

References Entry::bodyLine, Entry::brief, QCString::contains(), vhdl::parser::VhdlParser::SharedState::current_root, Entry::doc, Entry::endBodyLine, Entry::fileName, QCString::find(), VhdlDocGen::getRecordNumber(), Entry::inbodyDocs, QCString::isEmpty(), Entry::lang, vhdl::parser::VhdlParser::SharedState::lastCompound, vhdl::parser::VhdlParser::SharedState::lastEntity, QCString::length(), QCString::mid(), MISCELLANEOUS, Entry::name, p, VhdlDocGen::prepareComment(), reg::replace(), reg::search(), Entry::section, QCString::simplifyWhiteSpace(), split(), Entry::startLine, QCString::str(), stripLeadingAndTrailingEmptyLines(), Entry::type, and Entry::vhdlSpec.

Referenced by handleCommentBlock().

◆ checkMultiComment()

bool VHDLOutlineParser::checkMultiComment ( QCString & qcs,
int line )

Definition at line 807 of file vhdljjparser.cpp.

808{
809 VhdlParser::SharedState *s = &p->shared;
811
812 if (p->lineEntry.empty()) return false;
813
815 while (!p->lineEntry.empty())
816 {
817 std::shared_ptr<Entry> e=p->lineEntry.back();
818 e->briefLine=line;
819 e->brief+=qcs;
820
821 p->lineEntry.pop_back();
822 }
823 return true;
824}
void insertEntryAtLine(std::shared_ptr< Entry > ce, int line)

References vhdl::parser::VhdlParser::SharedState::current_root, insertEntryAtLine(), p, and VhdlDocGen::prepareComment().

Referenced by handleCommentBlock(), and oneLineComment().

◆ createFlow()

void VHDLOutlineParser::createFlow ( )

Definition at line 741 of file vhdljjparser.cpp.

742{
743 VhdlParser::SharedState *s = &p->shared;
745 {
746 return;
747 }
748 QCString q,ret;
749
751 {
752 q=":function( ";
753 FlowChart::alignFuncProc(q,s->tempEntry->argList,true);
754 q+=")";
755 }
756 else if (s->currP==VhdlSpecifier::PROCEDURE)
757 {
758 q=":procedure (";
759 FlowChart::alignFuncProc(q,s->tempEntry->argList,false);
760 q+=")";
761 }
762 else
763 {
764 q=":process( "+s->tempEntry->args;
765 q+=")";
766 }
767
769
771
773 {
774 ret="end function ";
775 }
776 else if (s->currP==VhdlSpecifier::PROCEDURE)
777 {
778 ret="end procedure";
779 }
780 else
781 {
782 ret="end process ";
783 }
784
786 // FlowChart::printFlowList();
789}
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()
QCString & prepend(const char *s)
Definition qcstring.h:422
std::shared_ptr< Entry > tempEntry

References FlowChart::addFlowChart(), FlowChart::alignFuncProc(), vhdl::parser::VhdlParser::SharedState::currP, FlowChart::END_NO, FUNCTION, VhdlDocGen::getFlowMember(), p, QCString::prepend(), PROCEDURE, FlowChart::START_NO, vhdl::parser::VhdlParser::SharedState::tempEntry, UNKNOWN, and FlowChart::writeFlowChart().

◆ createFunction()

void VHDLOutlineParser::createFunction ( const QCString & impure,
VhdlSpecifier spec,
const QCString & fname )

Definition at line 555 of file vhdljjparser.cpp.

556{
557 VhdlParser::SharedState *s = &p->shared;
558 s->current->vhdlSpec=spec;
559 s->current->section=EntryType::makeFunction();
560
561 if (impure=="impure" || impure=="pure")
562 {
563 s->current->exception=impure;
564 }
565
567 {
568 s->current->vhdlSpec=VhdlSpecifier::GENERIC;
569 s->current->section=EntryType::makeFunction();
570 }
571
573 {
574 s->current->name=impure;
575 s->current->exception="";
576 }
577 else
578 {
579 s->current->name=fname;
580 }
581
582 if (spec==VhdlSpecifier::PROCESS)
583 {
584 s->current->args=fname;
585 s->current->name=impure;
587 if (!fname.isEmpty())
588 {
589 StringVector q1=split(fname.str(),",");
590 for (const auto &name : q1)
591 {
592 Argument arg;
593 arg.name=name;
594 s->current->argList.push_back(arg);
595 }
596 }
597 }
598}
static void deleteAllChars(QCString &s, char c)

References vhdl::parser::VhdlParser::SharedState::current, vhdl::parser::VhdlParser::SharedState::currP, VhdlDocGen::deleteAllChars(), GEN_SEC, GENERIC, QCString::isEmpty(), Argument::name, p, vhdl::parser::VhdlParser::SharedState::parse_sec, PROCEDURE, PROCESS, split(), and QCString::str().

◆ error_skipto()

void VHDLOutlineParser::error_skipto ( int kind)

Definition at line 845 of file vhdljjparser.cpp.

846{
847 Token *op;
848 do
849 {
850 p->vhdlParser->getNextToken(); // step to next token
851 op=p->vhdlParser->getToken(1); // get first token
852 if (op==nullptr) break;
853 //fprintf(stderr,"\n %s",qPrint(t->image));
854 } while (op->kind != kind);
855 p->vhdlParser->clearError();
856 // The above loop consumes tokens all the way up to a token of
857 // "kind". We use a do-while loop rather than a while because the
858 // current token is the one immediately before the erroneous token
859 // (in our case the token immediately before what should have been
860 // "if"/"while".
861}

References vhdl::parser::Token::kind, and p.

◆ getLine() [1/2]

int VHDLOutlineParser::getLine ( )

Definition at line 721 of file vhdljjparser.cpp.

722{
723 return p->yyLineNr;
724}

References p.

◆ getLine() [2/2]

int VHDLOutlineParser::getLine ( int tok)

Definition at line 732 of file vhdljjparser.cpp.

733{
734 int val=p->lineParse[tok];
735 if (val<0) val=0;
736 //assert(val>=0 && val<=yyLineNr);
737 return val;
738}

References p.

◆ getNameID()

QCString VHDLOutlineParser::getNameID ( )

returns a unique id for each record member.

type first_rec is record RE: data_type; end;

type second_rec is record RE: data_type; end;

Definition at line 257 of file vhdljjparser.cpp.

258{
259 return QCString().setNum(idCounter++);
260}
static int idCounter

References idCounter, and QCString::setNum().

◆ handleCommentBlock()

void VHDLOutlineParser::handleCommentBlock ( const QCString & doc,
bool brief )

Definition at line 384 of file vhdljjparser.cpp.

385{
386 int position = 0;
387 bool needsEntry = FALSE;
388 VhdlParser::SharedState *s = &p->shared;
389 QCString doc = doc1;
390
391 if (doc.isEmpty())
392 return;
393
394 if (checkMultiComment(doc, p->yyLineNr))
395 {
396 p->strComment.clear();
397 return;
398 }
399
400 if (checkInlineCode(doc) > 0)
401 {
402 return;
403 }
404
405 Protection protection = Protection::Public;
407 if (doc.isEmpty()) return;
408
409 if (p->oldEntry == s->current.get())
410 {
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;
415 return;
416 }
417
418 p->oldEntry = s->current.get();
419
420 if (brief)
421 {
422 s->current->briefLine = p->yyLineNr;
423 }
424 else
425 {
426 s->current->docLine = p->yyLineNr;
427 }
428
429
430
431 Markdown markdown(p->yyFileName,p->iDocLine);
432 int lineNr = p->iDocLine;
433 GuardedSectionStack guards;
434 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(doc,lineNr) : doc;
435
436 while (p->commentScanner.parseCommentBlock(
437 p->thisParser,
438 s->current.get(),
439 processedDoc, // text
440 p->yyFileName, // file
441 lineNr, // line of block start
442 brief,
443 0,
444 FALSE,
445 protection,
446 position,
447 needsEntry,
448 Config_getBool(MARKDOWN_SUPPORT),
449 &guards
450 ))
451 {
452 if (needsEntry)
453 newEntry();
454 }
455 if (needsEntry)
456 {
457 if (p->varr)
458 {
459 p->varr = FALSE;
460 s->current->name = p->varName;
461 s->current->section = EntryType::makeVariableDoc();
462 p->varName = "";
463 }
464 newEntry();
465 }
466 p->iDocLine = -1;
467 p->strComment.clear();
468}
int checkInlineCode(QCString &doc)
bool checkMultiComment(QCString &qcs, int line)
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
Protection
Definition types.h:32

References checkInlineCode(), checkMultiComment(), Config_getBool, vhdl::parser::VhdlParser::SharedState::current, FALSE, QCString::isEmpty(), newEntry(), p, VhdlDocGen::prepareComment(), Markdown::process(), and TRUE.

Referenced by initEntry(), and oneLineComment().

◆ handleFlowComment()

void VHDLOutlineParser::handleFlowComment ( const QCString & doc)

Definition at line 262 of file vhdljjparser.cpp.

263{
264 lineCount(doc);
265
267 {
268 QCString qcs(doc);
269 qcs=qcs.stripWhiteSpace();
270 qcs.stripPrefix("--#");
271 FlowChart::addFlowChart(FlowChart::COMMENT_NO,QCString(),QCString(),qcs);
272 }
273}

References FlowChart::addFlowChart(), FlowChart::COMMENT_NO, VhdlDocGen::getFlowMember(), lineCount(), QCString::stripPrefix(), and QCString::stripWhiteSpace().

◆ initEntry()

void VHDLOutlineParser::initEntry ( Entry * e)

Definition at line 197 of file vhdljjparser.cpp.

198{
199 e->fileName = p->yyFileName;
200 e->lang = SrcLangExt::VHDL;
201 if (p->str_doc.pending)
202 {
203 p->str_doc.pending=FALSE;
204 p->oldEntry=nullptr; // prevents endless recursion
205 p->iDocLine=p->str_doc.iDocLine;
206 handleCommentBlock(p->str_doc.doc,p->str_doc.brief);
207 p->iDocLine=-1;
208 }
209 p->commentScanner.initGroupInfo(e);
210}
void handleCommentBlock(const QCString &doc, bool brief)

References FALSE, Entry::fileName, handleCommentBlock(), Entry::lang, and p.

Referenced by addCompInst(), newEntry(), and parseInput().

◆ insertEntryAtLine()

void VHDLOutlineParser::insertEntryAtLine ( std::shared_ptr< Entry > ce,
int line )

Definition at line 827 of file vhdljjparser.cpp.

828{
829 for (const auto &rt : ce->children())
830 {
831 if (rt->bodyLine==line)
832 {
833 p->lineEntry.push_back(rt);
834 }
835
836 insertEntryAtLine(rt,line);
837 }
838}

References insertEntryAtLine(), and p.

Referenced by checkMultiComment(), and insertEntryAtLine().

◆ isFuncProcProced()

bool VHDLOutlineParser::isFuncProcProced ( )

Definition at line 601 of file vhdljjparser.cpp.

602{
603 VhdlParser::SharedState *s = &p->shared;
607 )
608 {
609 return TRUE;
610 }
611 return FALSE;
612}

References vhdl::parser::VhdlParser::SharedState::currP, FALSE, FUNCTION, p, PROCEDURE, PROCESS, and TRUE.

Referenced by addVhdlType().

◆ lineCount() [1/2]

void VHDLOutlineParser::lineCount ( )

Definition at line 181 of file vhdljjparser.cpp.

182{
183 p->yyLineNr++;
184}

References p.

Referenced by handleFlowComment().

◆ lineCount() [2/2]

void VHDLOutlineParser::lineCount ( const QCString & text)

Definition at line 186 of file vhdljjparser.cpp.

187{
188 if (!text.isEmpty())
189 {
190 for (const char* c=text.data() ; *c ; ++c )
191 {
192 if (*c == '\n') p->yyLineNr++;
193 }
194 }
195}
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:172

References QCString::data(), QCString::isEmpty(), and p.

◆ mapLibPackage()

void VHDLOutlineParser::mapLibPackage ( Entry * root)

Definition at line 682 of file vhdljjparser.cpp.

683{
684 for (const auto &rt : p->libUse)
685 {
686 if (addLibUseClause(rt->name))
687 {
688 bool bFound=FALSE;
689 for (const auto &current : root->children())
690 {
691 if (VhdlDocGen::isVhdlClass(current.get()))
692 {
693 if (current->startLine > rt->startLine)
694 {
695 bFound=TRUE;
696 current->copyToSubEntry(rt);
697 break;
698 }
699 }
700 }//for
701 if (!bFound)
702 {
703 root->copyToSubEntry(rt);
704 }
705 } //if
706 }// for
707}//MapLib
const std::vector< std::shared_ptr< Entry > > & children() const
Definition entry.h:139
void copyToSubEntry(Entry *e)
Definition entry.cpp:156
bool addLibUseClause(const QCString &type)
static bool isVhdlClass(const Entry *cu)
Definition vhdldocgen.h:212

References addLibUseClause(), Entry::children(), Entry::copyToSubEntry(), FALSE, VhdlDocGen::isVhdlClass(), p, and TRUE.

Referenced by parseInput().

◆ needsPreprocessing()

bool VHDLOutlineParser::needsPreprocessing ( const QCString & extension) const
inlineoverridevirtual

Returns TRUE if the language identified by extension needs the C preprocessor to be run before feed the result to the input parser.

See also
parseInput()

Implements OutlineParserInterface.

Definition at line 38 of file vhdljjparser.h.

38{ return TRUE; }

References TRUE.

◆ newEntry()

void VHDLOutlineParser::newEntry ( )

Definition at line 212 of file vhdljjparser.cpp.

213{
214 VhdlParser::SharedState *s = &p->shared;
215 p->previous = s->current.get();
216 if (s->current->vhdlSpec==VhdlSpecifier::ENTITY ||
217 s->current->vhdlSpec==VhdlSpecifier::PACKAGE ||
218 s->current->vhdlSpec==VhdlSpecifier::ARCHITECTURE ||
220 {
221 s->current_root->moveToSubEntryAndRefresh(s->current);
222 }
223 else
224 {
225 if (s->lastCompound)
226 {
227 s->lastCompound->moveToSubEntryAndRefresh(s->current);
228 }
229 else
230 {
231 if (s->lastEntity)
232 {
233 s->lastEntity->moveToSubEntryAndRefresh(s->current);
234 }
235 else
236 {
237 s->current_root->moveToSubEntryAndRefresh(s->current);
238 }
239 }
240 }
241 initEntry(s->current.get());
242}

References ARCHITECTURE, vhdl::parser::VhdlParser::SharedState::current, vhdl::parser::VhdlParser::SharedState::current_root, ENTITY, initEntry(), vhdl::parser::VhdlParser::SharedState::lastCompound, vhdl::parser::VhdlParser::SharedState::lastEntity, p, PACKAGE, and PACKAGE_BODY.

Referenced by addCompInst(), addVhdlType(), and handleCommentBlock().

◆ oneLineComment()

void VHDLOutlineParser::oneLineComment ( QCString qcs)

Definition at line 796 of file vhdljjparser.cpp.

797{
798 int j=qcs.find("--!");
799 qcs=qcs.right(qcs.length()-3-j);
800 if (!checkMultiComment(qcs,p->iDocLine))
801 {
803 }
804}

References checkMultiComment(), QCString::find(), handleCommentBlock(), QCString::length(), p, QCString::right(), and TRUE.

◆ parseInput()

void VHDLOutlineParser::parseInput ( const QCString & fileName,
const char * fileBuf,
const std::shared_ptr< Entry > & root,
ClangTUParser * clangParser )
overridevirtual

Parses a single input file with the goal to build an Entry tree.

Parameters
[in]fileNameThe full name of the file.
[in]fileBufThe contents of the file (zero terminated).
[in,out]rootThe root of the tree of Entry *nodes representing the information extracted from the file.
[in]clangParserThe clang translation unit parser object or nullptr if disabled.

Implements OutlineParserInterface.

Definition at line 130 of file vhdljjparser.cpp.

132{
133 VhdlParser::SharedState *s = &p->shared;
134 p->thisParser=this;
135 p->inputString=fileBuf;
136
137 // fprintf(stderr,"\n ============= %s\n ==========\n",fileBuf);
138
139 bool inLine = fileName.isEmpty();
140
141 if (!inLine) msg("Parsing file {}...\n",fileName);
142
143 p->yyFileName=fileName;
144
145 bool xilinx_ucf=isConstraintFile(p->yyFileName,".ucf");
146 bool altera_qsf=isConstraintFile(p->yyFileName,".qsf");
147
148 // support XILINX(ucf) and ALTERA (qsf) file
149
150 if (xilinx_ucf)
151 {
152 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,FALSE);
153 return;
154 }
155 if (altera_qsf)
156 {
157 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,TRUE);
158 return;
159 }
160 p->yyLineNr=1;
161 s->current_root=root;
162 s->lastCompound=nullptr;
163 s->lastEntity=nullptr;
164 p->oldEntry = nullptr;
165 s->current=std::make_shared<Entry>();
166 initEntry(s->current.get());
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);
171
172 s->current.reset();
173
174 if (!inLine)
175 mapLibPackage(root.get());
176
177 p->yyFileName.clear();
178 p->libUse.clear();
179}
void mapLibPackage(Entry *root)
static void parseUCF(const QCString &input, Entry *entity, const QCString &f, bool vendor)
#define msg(fmt,...)
Definition message.h:94
static bool isConstraintFile(const QCString &fileName, const QCString &ext)

References vhdl::parser::VhdlParser::SharedState::current, vhdl::parser::VhdlParser::SharedState::current_root, FALSE, initEntry(), isConstraintFile(), QCString::isEmpty(), vhdl::parser::VhdlParser::SharedState::lastCompound, vhdl::parser::VhdlParser::SharedState::lastEntity, mapLibPackage(), msg, p, VhdlDocGen::parseUCF(), and TRUE.

◆ parsePrototype()

void VHDLOutlineParser::parsePrototype ( const QCString & text)
overridevirtual

Callback function called by the comment block scanner.

It provides a string text containing the prototype of a function or variable. The parser should parse this and store the information in the Entry node that corresponds with the node for which the comment block parser was invoked.

Implements OutlineParserInterface.

Definition at line 470 of file vhdljjparser.cpp.

471{
472 p->varName=text;
473 p->varr=TRUE;
474}

References p, and TRUE.

◆ popLabel()

QCString VHDLOutlineParser::popLabel ( QCString & q)

Definition at line 620 of file vhdljjparser.cpp.

621{
622 int i=q.findRev("|");
623 if (i<0) return QCString();
624 q = q.left(i);
625 return q;
626}
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:96

References QCString::findRev(), and QCString::left().

◆ pushLabel()

void VHDLOutlineParser::pushLabel ( QCString & label,
QCString & val )

Definition at line 614 of file vhdljjparser.cpp.

615{
616 label+="|";
617 label+=val;
618}

◆ setLineParsed()

void VHDLOutlineParser::setLineParsed ( int tok)

Definition at line 726 of file vhdljjparser.cpp.

727{
728 if ((int)p->lineParse.size()<=tok) p->lineParse.resize(tok+1);
729 p->lineParse[tok]=p->yyLineNr;
730}

References p.

◆ setMultCommentLine()

void VHDLOutlineParser::setMultCommentLine ( )

Definition at line 791 of file vhdljjparser.cpp.

792{
793 p->iDocLine=p->yyLineNr;
794}

References p.

Member Data Documentation

◆ p


The documentation for this class was generated from the following files: