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 123 of file vhdljjparser.cpp.

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

References p.

◆ ~VHDLOutlineParser()

VHDLOutlineParser::~VHDLOutlineParser ( )
override

Definition at line 127 of file vhdljjparser.cpp.

128{
129}

Member Function Documentation

◆ addCompInst()

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

Definition at line 477 of file vhdljjparser.cpp.

478{
479 VhdlParser::SharedState *s = &p->shared;
481 s->current->section=EntryType::makeVariable();
482 s->current->startLine=iLine;
483 s->current->bodyLine=iLine;
484 s->current->type=instName; // foo:instname e.g proto or work. proto(ttt)
485 s->current->exception=s->genLabels.lower(); // |arch|label1:label2...
486 s->current->name=n; // foo
487 if (s->lastCompound)
488 {
489 s->current->args=s->lastCompound->name; // architecture name
490 }
491 s->current->includeName=comp; // component/entity/configuration
492 int u=s->genLabels.find("|",1);
493 if (u>0)
494 {
495 s->current->write=s->genLabels.right(s->genLabels.length()-u);
496 s->current->read=s->genLabels.left(u);
497 }
498 //printf (" \n genlabel: [%s] inst: [%s] name: [%s] %d\n",n,instName,comp,iLine);
499
500 if (s->lastCompound)
501 {
502 s->current->args=s->lastCompound->name;
503 if (true) // !findInstant(current->type))
504 {
505 initEntry(s->current.get());
506 // TODO: protect with mutex
507 g_instFiles.emplace_back(std::make_shared<Entry>(*s->current));
508 // TODO: end protect with mutex
509 }
510
511 s->current=std::make_shared<Entry>();
512 }
513 else
514 {
515 newEntry();
516 }
517}
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 710 of file vhdljjparser.cpp.

711{
712 bool showIEEESTD=Config_getBool(FORCE_LOCAL_INCLUDES);
713
714 if (showIEEESTD) // all standard packages and libraries will not be shown
715 {
716 if (type.lower().stripPrefix("ieee")) return FALSE;
717 if (type.lower().stripPrefix("std")) return FALSE;
718 }
719 return TRUE;
720}
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 631 of file vhdljjparser.cpp.

633{
634 VhdlParser::SharedState *s = &p->shared;
635 (void)s5; // avoid unused warning
636 StringVector ql=split(s2.str(),",");
637
638 for (const auto &n : ql)
639 {
640 Argument arg;
641 arg.name=n;
642 if (!s3.isEmpty())
643 {
644 arg.type=s3;
645 }
646 arg.type+=" ";
647 arg.type+=s4;
648 if (!s6.isEmpty())
649 {
650 arg.type+=s6;
651 }
653 {
654 arg.defval="generic";
655 }
656
658 {
659 // assert(false);
660 }
661
662 arg.defval+=s1;
663 arg.attrib="";//s6;
664
665 s->current->argList.push_back(arg);
666 s->current->args+=s2;
667 s->current->args+=",";
668 }
669}
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:6555

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 519 of file vhdljjparser.cpp.

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

277{
278 static const reg::Ex csRe(R"([\\@]code)");
279 static const reg::Ex cendRe(R"(\s*[\\@]endcode)");
280 static const reg::Ex cbriefRe(R"([\\@]brief)");
281
282 // helper to simulate behavior of QString.find(const QRegExp &re,int pos)
283 auto findRe = [](const QCString &str,const reg::Ex &re,int pos=0) -> int
284 {
285 if ((int)str.length()<pos) return -1;
286 reg::Match match;
287 if (reg::search(str.str(),match,re,pos)) // match found
288 {
289 return (int)match.position();
290 }
291 else // not found
292 {
293 return -1;
294 }
295 };
296 auto replaceRe = [](const QCString &str,const reg::Ex &re,const QCString &replacement) -> QCString
297 {
298 return reg::replace(str.str(), re, replacement.str());
299 };
300
301 int index = findRe(doc,csRe);
302
303 if (findRe(doc,cendRe)!=-1)
304 return 1;
305
306 if (index < 0)
307 return index;
308
309 VhdlParser::SharedState *s = &p->shared;
310 p->strComment += doc;
311 p->code = findRe(p->inputString,csRe, p->code + 1);
312 int com = p->inputString.find(p->strComment.data());
313 int ref = findRe(p->inputString,cendRe, p->code + 1);
314 int len = static_cast<int>(p->strComment.size());
315
316 int ll = com + len;
317 int diff = ref - ll - 3;
318 QCString code = p->inputString.mid(ll, diff);
319 int iLine = 0;
320 code = stripLeadingAndTrailingEmptyLines(code, iLine);
321 int val = code.contains('\n');
322 VhdlDocGen::prepareComment(p->strComment);
323 StringVector ql = split(p->strComment.str(),"\n");
324
325 QCString co;
326 QCString na;
327 for (const auto &qcs_ : ql)
328 {
329 QCString qcs(qcs_);
330 qcs = qcs.simplifyWhiteSpace();
331 if (findRe(qcs,csRe)!=-1)
332 {
333 int i = qcs.find('{');
334 int j = qcs.find('}');
335 if (i > 0 && j > 0 && j > i)
336 {
337 na = qcs.mid(i + 1, (j - i - 1));
338 }
339 continue;
340 }
341 qcs = replaceRe(qcs,cbriefRe, "");
342 co += qcs;
343 co += '\n';
344 }
345
347
348 Entry gBlock;
349 if (!na.isEmpty())
350 gBlock.name = na;
351 else
352 gBlock.name = "misc" + VhdlDocGen::getRecordNumber();
353 gBlock.startLine = p->yyLineNr+iLine-1;
354 gBlock.bodyLine = p->yyLineNr+iLine-1 ;
355 gBlock.doc = code;
356 gBlock.inbodyDocs = code;
357 gBlock.brief = co;
358 gBlock.section = EntryType::makeVariable();
360 gBlock.fileName = p->yyFileName;
361 gBlock.endBodyLine = p->yyLineNr + val +iLine;
362 gBlock.lang = SrcLangExt::VHDL;
363 std::shared_ptr<Entry> compound;
364
365 if (s->lastEntity)
366 compound = s->lastEntity;
367 else if (s->lastCompound)
368 compound = s->lastCompound;
369 else
370 compound = nullptr;
371
372 if (compound)
373 {
374 compound->copyToSubEntry(&gBlock);
375 }
376 else
377 {
378 gBlock.type = "misc"; // global code like library ieee...
379 s->current_root->copyToSubEntry(&gBlock);
380 }
381 p->strComment.clear();
382 return 1;
383}
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:842
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:864
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:853
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:4953

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 808 of file vhdljjparser.cpp.

809{
810 VhdlParser::SharedState *s = &p->shared;
812
813 if (p->lineEntry.empty()) return false;
814
816 while (!p->lineEntry.empty())
817 {
818 std::shared_ptr<Entry> e=p->lineEntry.back();
819 e->briefLine=line;
820 e->brief+=qcs;
821
822 p->lineEntry.pop_back();
823 }
824 return true;
825}
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 742 of file vhdljjparser.cpp.

743{
744 VhdlParser::SharedState *s = &p->shared;
746 {
747 return;
748 }
749 QCString q,ret;
750
752 {
753 q=":function( ";
754 FlowChart::alignFuncProc(q,s->tempEntry->argList,true);
755 q+=")";
756 }
757 else if (s->currP==VhdlSpecifier::PROCEDURE)
758 {
759 q=":procedure (";
760 FlowChart::alignFuncProc(q,s->tempEntry->argList,false);
761 q+=")";
762 }
763 else
764 {
765 q=":process( "+s->tempEntry->args;
766 q+=")";
767 }
768
770
772
774 {
775 ret="end function ";
776 }
777 else if (s->currP==VhdlSpecifier::PROCEDURE)
778 {
779 ret="end procedure";
780 }
781 else
782 {
783 ret="end process ";
784 }
785
787 // FlowChart::printFlowList();
790}
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 556 of file vhdljjparser.cpp.

557{
558 VhdlParser::SharedState *s = &p->shared;
559 s->current->vhdlSpec=spec;
560 s->current->section=EntryType::makeFunction();
561
562 if (impure=="impure" || impure=="pure")
563 {
564 s->current->exception=impure;
565 }
566
568 {
569 s->current->vhdlSpec=VhdlSpecifier::GENERIC;
570 s->current->section=EntryType::makeFunction();
571 }
572
574 {
575 s->current->name=impure;
576 s->current->exception="";
577 }
578 else
579 {
580 s->current->name=fname;
581 }
582
583 if (spec==VhdlSpecifier::PROCESS)
584 {
585 s->current->args=fname;
586 s->current->name=impure;
588 if (!fname.isEmpty())
589 {
590 StringVector q1=split(fname.str(),",");
591 for (const auto &name : q1)
592 {
593 Argument arg;
594 arg.name=name;
595 s->current->argList.push_back(arg);
596 }
597 }
598 }
599}
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 846 of file vhdljjparser.cpp.

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

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

◆ getLine() [1/2]

int VHDLOutlineParser::getLine ( )

Definition at line 722 of file vhdljjparser.cpp.

723{
724 return p->yyLineNr;
725}

References p.

◆ getLine() [2/2]

int VHDLOutlineParser::getLine ( int tok)

Definition at line 733 of file vhdljjparser.cpp.

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

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 258 of file vhdljjparser.cpp.

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

References idCounter, and QCString::setNum().

◆ handleCommentBlock()

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

Definition at line 385 of file vhdljjparser.cpp.

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

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

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

◆ initEntry()

void VHDLOutlineParser::initEntry ( Entry * e)

Definition at line 198 of file vhdljjparser.cpp.

199{
200 e->fileName = p->yyFileName;
201 e->lang = SrcLangExt::VHDL;
202 if (p->str_doc.pending)
203 {
204 p->str_doc.pending=FALSE;
205 p->oldEntry=nullptr; // prevents endless recursion
206 p->iDocLine=p->str_doc.iDocLine;
207 handleCommentBlock(p->str_doc.doc,p->str_doc.brief);
208 p->iDocLine=-1;
209 }
210 p->commentScanner.initGroupInfo(e);
211}
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 828 of file vhdljjparser.cpp.

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

References insertEntryAtLine(), and p.

Referenced by checkMultiComment(), and insertEntryAtLine().

◆ isFuncProcProced()

bool VHDLOutlineParser::isFuncProcProced ( )

Definition at line 602 of file vhdljjparser.cpp.

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

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 182 of file vhdljjparser.cpp.

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

References p.

Referenced by handleFlowComment().

◆ lineCount() [2/2]

void VHDLOutlineParser::lineCount ( const QCString & text)

Definition at line 187 of file vhdljjparser.cpp.

188{
189 if (!text.isEmpty())
190 {
191 for (const char* c=text.data() ; *c ; ++c )
192 {
193 if (*c == '\n') p->yyLineNr++;
194 }
195 }
196}
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 683 of file vhdljjparser.cpp.

684{
685 for (const auto &rt : p->libUse)
686 {
687 if (addLibUseClause(rt->name))
688 {
689 bool bFound=FALSE;
690 for (const auto &current : root->children())
691 {
692 if (VhdlDocGen::isVhdlClass(current.get()))
693 {
694 if (current->startLine > rt->startLine)
695 {
696 bFound=TRUE;
697 current->copyToSubEntry(rt);
698 break;
699 }
700 }
701 }//for
702 if (!bFound)
703 {
704 root->copyToSubEntry(rt);
705 }
706 } //if
707 }// for
708}//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 213 of file vhdljjparser.cpp.

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

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 797 of file vhdljjparser.cpp.

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

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 131 of file vhdljjparser.cpp.

133{
134 VhdlParser::SharedState *s = &p->shared;
135 p->thisParser=this;
136 p->inputString=fileBuf;
137
138 // fprintf(stderr,"\n ============= %s\n ==========\n",fileBuf);
139
140 bool inLine = fileName.isEmpty();
141
142 if (!inLine) msg("Parsing file {}...\n",fileName);
143
144 p->yyFileName=fileName;
145
146 bool xilinx_ucf=isConstraintFile(p->yyFileName,".ucf");
147 bool altera_qsf=isConstraintFile(p->yyFileName,".qsf");
148
149 // support XILINX(ucf) and ALTERA (qsf) file
150
151 if (xilinx_ucf)
152 {
153 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,FALSE);
154 return;
155 }
156 if (altera_qsf)
157 {
158 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,TRUE);
159 return;
160 }
161 p->yyLineNr=1;
162 s->current_root=root;
163 s->lastCompound=nullptr;
164 s->lastEntity=nullptr;
165 p->oldEntry = nullptr;
166 s->current=std::make_shared<Entry>();
167 initEntry(s->current.get());
168 p->commentScanner.enterFile(fileName,p->yyLineNr);
169 p->lineParse.reserve(200);
170 p->parseVhdlfile(fileName,fileBuf,inLine);
171 p->commentScanner.leaveFile(fileName,p->yyLineNr);
172
173 s->current.reset();
174
175 if (!inLine)
176 mapLibPackage(root.get());
177
178 p->yyFileName.clear();
179 p->libUse.clear();
180}
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 471 of file vhdljjparser.cpp.

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

References p, and TRUE.

◆ popLabel()

QCString VHDLOutlineParser::popLabel ( QCString & q)

Definition at line 621 of file vhdljjparser.cpp.

622{
623 int i=q.findRev("|");
624 if (i<0) return QCString();
625 q = q.left(i);
626 return q;
627}
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 615 of file vhdljjparser.cpp.

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

◆ setLineParsed()

void VHDLOutlineParser::setLineParsed ( int tok)

Definition at line 727 of file vhdljjparser.cpp.

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

References p.

◆ setMultCommentLine()

void VHDLOutlineParser::setMultCommentLine ( )

Definition at line 792 of file vhdljjparser.cpp.

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

References p.

Member Data Documentation

◆ p


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